List of usage examples for javax.swing JPanel setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:au.com.jwatmuff.eventmanager.gui.scoreboard.ScoreboardDisplayPanel.java
protected ScoreboardDisplayPanel(ScoreboardLayout scoreboardLayout) { this.scoreboardLayout = scoreboardLayout; ScalableAbsoluteLayout layout;//w w w.j av a2 s . c o m setLayout(new GridLayout(1, 1)); layeredPane = new JLayeredPane(); layeredPane.setLayout(new OverlayLayout(layeredPane)); add(layeredPane); /* * Image screen layer */ imageLayer = new JXImagePanel(); imageLayer.setVisible(false); imageLayer.setStyle(JXImagePanel.Style.SCALED_KEEP_ASPECT_RATIO); imageLayer.setBackground(Color.BLACK); layeredPane.add(imageLayer, new Integer(13)); /* * No fight screen layer */ noFightLayer = new JPanel(); noFightLayer.setOpaque(true); noFightLayer.setVisible(false); layeredPane.add(noFightLayer, new Integer(12)); layout = new ScalableAbsoluteLayout(noFightLayer, 16, 12); noFightLayer.setLayout(layout); layout.addComponent(new ScalableLabel("No Fight"), 4, 4, 8, 4); /* * Player vs Player layer */ vsLayer = new JPanel(); vsLayer.setOpaque(true); vsLayer.setVisible(false); layeredPane.add(vsLayer, new Integer(11)); layout = new ScalableAbsoluteLayout(vsLayer, 16, 12); vsLayer.setLayout(layout); vsPlayer = new ScalableLabel[] { new ScalableLabel("Player 1"), new ScalableLabel("Player 2") }; vs = new ScalableLabel("vs"); vsDivision = new ScalableLabel(" "); layout.addComponent(vsPlayer[0], 1, 1, 11, 3); layout.addComponent(vsPlayer[1], 4, 8, 11, 3); layout.addComponent(vs, 7, 5, 2, 2); layout.addComponent(vsDivision, scoreboardLayout.getDivisionRect()); /* * Pending fight layer */ pendingFightLayer = new JPanel(); pendingFightLayer.setOpaque(true); pendingFightLayer.setVisible(false); layeredPane.add(pendingFightLayer, new Integer(10)); layout = new ScalableAbsoluteLayout(pendingFightLayer, 16, 12); pendingFightLayer.setLayout(layout); pendingPlayer = new ScalableLabel[] { new ScalableLabel("Player 1"), new ScalableLabel("Player 2") }; pendingFightTimer = new ScalableLabel[] { new ScalableLabel("0:00"), new ScalableLabel("0:00") }; pendingDivision = new ScalableLabel(" "); layout.addComponent(pendingPlayer[0], 1, 2.5, 6, 1.5); layout.addComponent(pendingPlayer[1], 9, 2.5, 6, 1.5); layout.addComponent(pendingFightTimer[0], 2, 5, 4, 2); layout.addComponent(pendingFightTimer[1], 10, 5, 4, 2); layout.addComponent(pendingDivision, scoreboardLayout.getDivisionRect()); /* * Winning result layer */ resultLayer = new JPanel(); resultLayer.setOpaque(false); layeredPane.add(resultLayer, new Integer(9)); layout = new ScalableAbsoluteLayout(resultLayer, 16, 12); resultLayer.setLayout(layout); result = new ScalableLabel(""); result.setVisible(false); layout.addComponent(result, scoreboardLayout.getResultRect()); goldenScore = new ScalableLabel("Golden Score"); goldenScore.setVisible(false); layout.addComponent(goldenScore, scoreboardLayout.getGoldenScoreRect()); goldenScoreApprove = new ScalableLabel("Golden Score"); goldenScoreApprove.setVisible(false); layout.addComponent(goldenScoreApprove, scoreboardLayout.getGoldenScoreApproveRect()); /* * Pending score layers */ JPanel[] psLayer = new JPanel[3]; pendingScores = new ScalableLabel[2][3]; for (int i = 0; i < 3; i++) { psLayer[i] = new JPanel(); psLayer[i].setOpaque(false); layeredPane.add(psLayer[i], new Integer(8 - i)); layout = new ScalableAbsoluteLayout(psLayer[i], 16, 12); psLayer[i].setLayout(layout); for (int j = 0; j < 2; j++) { ScalableLabel label = new ScalableLabel(""); label.setVisible(false); layout.addComponent(label, scoreboardLayout.getHolddownScoreRect(j, i)); pendingScores[j][i] = label; } } /* * Holddown layer */ JPanel hdLayer = new JPanel(); hdLayer.setOpaque(false); layeredPane.add(hdLayer, new Integer(3)); layout = new ScalableAbsoluteLayout(hdLayer, 16, 12); hdLayer.setLayout(layout); holddownTimer = new ScalableLabel(" "); holddownTimer.setVisible(false); layout.addComponent(holddownTimer, scoreboardLayout.getHolddownRect()); /* * Bottom layer - background and core elements such as timer, player * names and scores */ bottomLayer = new JPanel(); layeredPane.add(bottomLayer, new Integer(1)); layout = new ScalableAbsoluteLayout(bottomLayer, 16, 12); bottomLayer.setLayout(layout); bottomLayer.setOpaque(false); timer = new ScalableLabel("5:00"); player = new ScalableLabel[] { new ScalableLabel("Player 1"), new ScalableLabel("Player 2") }; team = new ScalableLabel[] { new ScalableLabel("Team A"), new ScalableLabel("Team B") }; if (scoreboardLayout instanceof IJFScoreboardLayout) { player[0].setHorizontalAlignment(JLabel.LEFT); player[1].setHorizontalAlignment(JLabel.LEFT); team[0].setHorizontalAlignment(JLabel.LEFT); team[1].setHorizontalAlignment(JLabel.LEFT); } layout.addComponent(timer, scoreboardLayout.getTimerRect()); for (int i = 0; i < 2; i++) { layout.addComponent(player[i], scoreboardLayout.getPlayerLabelRect(i)); layout.addComponent(team[i], scoreboardLayout.getTeamLabelRect(i)); } scoreLabels = new ScalableLabel[2][2]; score = new ScalableLabel[2][2]; String[] iwyk = new String[] { "I", "W" }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { Score s = Score.values()[j]; scoreLabels[i][j] = new ScalableLabel(iwyk[j]); Rect rect = scoreboardLayout.getScoreLabelRect(i, s); if (rect != null) layout.addComponent(scoreLabels[i][j], rect); score[i][j] = new ScalableLabel("0"); layout.addComponent(score[i][j], scoreboardLayout.getScoreRect(i, s)); } } shido = new ScalableLabel[2][4]; for (int i = 0; i < 2; i++) { for (int j = 0; j < 4; j++) { shido[i][j] = new ScalableLabel(""); shido[i][j].setVisible(false); // shidos get laid out dynamically in updateShidos // layout.addComponent(shido[i][j], scoreboardLayout.getShidoRect(i, index, s, model)); } } division = new ScalableLabel(" "); layout.addComponent(division, scoreboardLayout.getDivisionRect()); // IJF Scoreboard has no borders on core components if (scoreboardLayout instanceof IJFScoreboardLayout) { // Remove borders for (Component c : bottomLayer.getComponents()) { if (c instanceof ScalableLabel) { ScalableLabel l = (ScalableLabel) c; l.setBorder(new EmptyBorder(0, 0, 0, 0)); } } } /* * Background layer - purely for background colours as used by IJF * scoreboard */ backgroundLayer = new JPanel(); layeredPane.add(backgroundLayer, new Integer(0)); layout = new ScalableAbsoluteLayout(backgroundLayer, 16, 12); backgroundLayer.setLayout(layout); backgroundLayer.setOpaque(false); // Add background last playerBackground = new ScalableLabel[2]; for (int i = 0; i < 2; i++) { playerBackground[i] = new ScalableLabel(""); playerBackground[i].setBorder(new EmptyBorder(0, 0, 0, 0)); Rect r = scoreboardLayout.getPlayerBackgroundRect(i); if (r != null) layout.addComponent(playerBackground[i], r); } { Rect r = scoreboardLayout.getTimerBackgroundRect(); timerBackground = new ScalableLabel(""); timerBackground.setBorder(new EmptyBorder(0, 0, 0, 0)); if (r != null) layout.addComponent(timerBackground, r); } }
From source file:com.digitalgeneralists.assurance.ui.components.ComparisonResultPanel.java
private JPanel createFileAttributesPanel(FileReference fileReference, FileReference comparedFileReference, int anchor) { // NOTE: I'm very unhappy with this entire method implementation. It needs to be refactored. JPanel attributePanel = new JPanel(); GridBagLayout attributePanelGridbag = new GridBagLayout(); attributePanel.setOpaque(false); attributePanel.setLayout(attributePanelGridbag); if (fileReference != null) { int index = 0; FileAttributes attributes = fileReference.getFileAttributes(); FileAttributes comparisonAttributes = comparedFileReference.getFileAttributes(); if (((attributes.getContentsHash() == null) && (comparisonAttributes.getContentsHash() != null)) || ((attributes.getContentsHash() != null) && (!attributes.getContentsHash().equals(comparisonAttributes.getContentsHash())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Contents Hash: ", (attributes.getContentsHash() != null) ? attributes.getContentsHash().toString() : ""); index++;//from w w w . ja v a2 s . co m } if (((attributes.getCreationTime() == null) && (comparisonAttributes.getCreationTime() != null)) || ((attributes.getCreationTime() != null) && (!attributes.getCreationTime().equals(comparisonAttributes.getCreationTime())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Creation Time: ", (attributes.getCreationTime() != null) ? attributes.getCreationTime().toString() : ""); index++; } if (((attributes.getIsDirectory() == null) && (comparisonAttributes.getIsDirectory() != null)) || ((attributes.getIsDirectory() != null) && (!attributes.getIsDirectory().equals(comparisonAttributes.getIsDirectory())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Directory: ", (attributes.getIsDirectory() != null) ? attributes.getIsDirectory().toString() : ""); index++; } if (((attributes.getIsOther() == null) && (comparisonAttributes.getIsOther() != null)) || ((attributes.getIsOther() != null) && (!attributes.getIsOther().equals(comparisonAttributes.getIsOther())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Other: ", (attributes.getIsOther() != null) ? attributes.getIsOther().toString() : ""); index++; } if (((attributes.getIsRegularFile() == null) && (comparisonAttributes.getIsRegularFile() != null)) || ((attributes.getIsRegularFile() != null) && (!attributes.getIsRegularFile().equals(comparisonAttributes.getIsRegularFile())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Regular File: ", (attributes.getIsRegularFile() != null) ? attributes.getIsRegularFile().toString() : ""); index++; } if (((attributes.getIsSymbolicLink() == null) && (comparisonAttributes.getIsSymbolicLink() != null)) || ((attributes.getIsSymbolicLink() != null) && (!attributes.getIsSymbolicLink() .equals(comparisonAttributes.getIsSymbolicLink())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Symbolic Link: ", (attributes.getIsSymbolicLink() != null) ? attributes.getIsSymbolicLink().toString() : ""); index++; } if (((attributes.getLastAccessTime() == null) && (comparisonAttributes.getLastAccessTime() != null)) || ((attributes.getLastAccessTime() != null) && (!attributes.getLastAccessTime() .equals(comparisonAttributes.getLastAccessTime())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Last Access Time: ", (attributes.getLastAccessTime() != null) ? attributes.getLastAccessTime().toString() : ""); index++; } if (((attributes.getLastModifiedTime() == null) && (comparisonAttributes.getLastModifiedTime() != null)) || ((attributes.getLastModifiedTime() != null) && (!attributes.getLastModifiedTime() .equals(comparisonAttributes.getLastModifiedTime())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Last Modified Time: ", (attributes.getLastModifiedTime() != null) ? attributes.getLastModifiedTime().toString() : ""); index++; } if (((attributes.getSize() == null) && (comparisonAttributes.getSize() != null)) || ((attributes.getSize() != null) && (!attributes.getSize().equals(comparisonAttributes.getSize())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "File Size: ", (attributes.getSize() != null) ? attributes.getSize().toString() : ""); index++; } // DOS Attributes if (((attributes.getIsArchive() == null) && (comparisonAttributes.getIsArchive() != null)) || ((attributes.getIsArchive() != null) && (!attributes.getIsArchive().equals(comparisonAttributes.getIsArchive())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Archive: ", (attributes.getIsArchive() != null) ? attributes.getIsArchive().toString() : ""); index++; } if (((attributes.getIsHidden() == null) && (comparisonAttributes.getIsHidden() != null)) || ((attributes.getIsHidden() != null) && (!attributes.getIsHidden().equals(comparisonAttributes.getIsHidden())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Hidden: ", (attributes.getIsHidden() != null) ? attributes.getIsHidden().toString() : ""); index++; } if (((attributes.getIsReadOnly() == null) && (comparisonAttributes.getIsReadOnly() != null)) || ((attributes.getIsReadOnly() != null) && (!attributes.getIsReadOnly().equals(comparisonAttributes.getIsReadOnly())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Read Only: ", (attributes.getIsReadOnly() != null) ? attributes.getIsReadOnly().toString() : ""); index++; } if (((attributes.getIsSystem() == null) && (comparisonAttributes.getIsSystem() != null)) || ((attributes.getIsSystem() != null) && (!attributes.getIsSystem().equals(comparisonAttributes.getIsSystem())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "System File: ", (attributes.getIsSystem() != null) ? attributes.getIsSystem().toString() : ""); index++; } // POSIX Attributes if (((attributes.getGroupName() == null) && (comparisonAttributes.getGroupName() != null)) || ((attributes.getGroupName() != null) && (!attributes.getGroupName().equals(comparisonAttributes.getGroupName())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Group Name: ", (attributes.getGroupName() != null) ? attributes.getGroupName() : ""); index++; } if (((attributes.getOwner() == null) && (comparisonAttributes.getOwner() != null)) || ((attributes.getOwner() != null) && (!attributes.getOwner().equals(comparisonAttributes.getOwner())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Owner: ", (attributes.getOwner() != null) ? attributes.getOwner() : ""); index++; } if (((attributes.getPermissions() == null) && (comparisonAttributes.getPermissions() != null)) || ((attributes.getPermissions() != null) && (!attributes.getPermissions().equals(comparisonAttributes.getPermissions())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "Permissions: ", (attributes.getPermissions() != null) ? attributes.getPermissions() : ""); index++; } // File-owner Attributes if (((attributes.getFileOwner() == null) && (comparisonAttributes.getFileOwner() != null)) || ((attributes.getFileOwner() != null) && (!attributes.getFileOwner().equals(comparisonAttributes.getFileOwner())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "File Owner: ", (attributes.getFileOwner() != null) ? attributes.getFileOwner() : ""); index++; } // ACL Attributes if (((attributes.getAclDescription() == null) && (comparisonAttributes.getAclDescription() != null)) || ((attributes.getAclDescription() != null) && (!attributes.getAclDescription() .equals(comparisonAttributes.getAclDescription())))) { this.addFileAttributeToPanel(attributePanel, anchor, index, "ACLs: ", (attributes.getAclDescription() != null) ? attributes.getAclDescription() : ""); index++; } this.numberOfLines = index; } return attributePanel; }
From source file:com.xmage.launcher.XMageLauncher.java
private XMageLauncher() { locale = Locale.getDefault(); //locale = new Locale("it", "IT"); messages = ResourceBundle.getBundle("MessagesBundle", locale); localize();/*from ww w. j a v a 2 s . c om*/ serverConsole = new XMageConsole("XMage Server console"); clientConsole = new XMageConsole("XMage Client console"); frame = new JFrame(messages.getString("frameTitle") + " " + Config.getVersion()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(800, 500)); frame.setResizable(false); createToolbar(); ImageIcon icon = new ImageIcon(XMageLauncher.class.getResource("/icon-mage-flashed.png")); frame.setIconImage(icon.getImage()); Random r = new Random(); int imageNum = 1 + r.nextInt(17); ImageIcon background = new ImageIcon(new ImageIcon( XMageLauncher.class.getResource("/backgrounds/" + Integer.toString(imageNum) + ".jpg")).getImage() .getScaledInstance(800, 480, Image.SCALE_SMOOTH)); mainPanel = new JLabel(background) { @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); Dimension lmPrefSize = getLayout().preferredLayoutSize(this); size.width = Math.max(size.width, lmPrefSize.width); size.height = Math.max(size.height, lmPrefSize.height); return size; } }; mainPanel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { grabPoint = e.getPoint(); mainPanel.getComponentAt(grabPoint); } }); mainPanel.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { // get location of Window int thisX = frame.getLocation().x; int thisY = frame.getLocation().y; // Determine how much the mouse moved since the initial click int xMoved = (thisX + e.getX()) - (thisX + grabPoint.x); int yMoved = (thisY + e.getY()) - (thisY + grabPoint.y); // Move window to this position int X = thisX + xMoved; int Y = thisY + yMoved; frame.setLocation(X, Y); } }); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(10, 10, 10, 10); Font font16 = new Font("Arial", Font.BOLD, 16); Font font12 = new Font("Arial", Font.PLAIN, 12); Font font12b = new Font("Arial", Font.BOLD, 12); mainPanel.add(Box.createRigidArea(new Dimension(250, 50))); ImageIcon logo = new ImageIcon(new ImageIcon(XMageLauncher.class.getResource("/label-xmage.png")).getImage() .getScaledInstance(150, 75, Image.SCALE_SMOOTH)); xmageLogo = new JLabel(logo); constraints.gridx = 3; constraints.gridy = 0; constraints.gridheight = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.anchor = GridBagConstraints.EAST; mainPanel.add(xmageLogo, constraints); textArea = new JTextArea(5, 40); textArea.setEditable(false); textArea.setForeground(Color.WHITE); textArea.setBackground(Color.BLACK); DefaultCaret caret = (DefaultCaret) textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); constraints.gridx = 2; constraints.gridy = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; mainPanel.add(scrollPane, constraints); labelProgress = new JLabel(messages.getString("progress")); labelProgress.setFont(font12); labelProgress.setForeground(Color.WHITE); constraints.gridy = 2; constraints.weightx = 0.0; constraints.weighty = 0.0; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.WEST; mainPanel.add(labelProgress, constraints); progressBar = new JProgressBar(0, 100); constraints.gridx = 3; constraints.weightx = 1.0; constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(progressBar, constraints); JPanel pnlButtons = new JPanel(); pnlButtons.setLayout(new GridBagLayout()); pnlButtons.setOpaque(false); constraints.gridx = 0; constraints.gridy = 3; constraints.gridheight = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.BOTH; mainPanel.add(pnlButtons, constraints); btnLaunchClient = new JButton(messages.getString("launchClient")); btnLaunchClient.setToolTipText(messages.getString("launchClient.tooltip")); btnLaunchClient.setFont(font16); btnLaunchClient.setForeground(Color.GRAY); btnLaunchClient.setEnabled(false); btnLaunchClient.setPreferredSize(new Dimension(180, 60)); btnLaunchClient.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleClient(); } }); constraints.gridx = GridBagConstraints.RELATIVE; constraints.gridy = 0; constraints.gridwidth = 1; constraints.fill = GridBagConstraints.BOTH; pnlButtons.add(btnLaunchClient, constraints); btnLaunchClientServer = new JButton(messages.getString("launchClientServer")); btnLaunchClientServer.setToolTipText(messages.getString("launchClientServer.tooltip")); btnLaunchClientServer.setFont(font12b); btnLaunchClientServer.setEnabled(false); btnLaunchClientServer.setForeground(Color.GRAY); btnLaunchClientServer.setPreferredSize(new Dimension(80, 40)); btnLaunchClientServer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleServer(); handleClient(); } }); constraints.fill = GridBagConstraints.HORIZONTAL; pnlButtons.add(btnLaunchClientServer, constraints); btnLaunchServer = new JButton(messages.getString("launchServer")); btnLaunchServer.setToolTipText(messages.getString("launchServer.tooltip")); btnLaunchServer.setFont(font12b); btnLaunchServer.setEnabled(false); btnLaunchServer.setForeground(Color.GRAY); btnLaunchServer.setPreferredSize(new Dimension(80, 40)); btnLaunchServer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleServer(); } }); pnlButtons.add(btnLaunchServer, constraints); btnUpdate = new JButton(messages.getString("update.xmage")); btnUpdate.setToolTipText(messages.getString("update.xmage.tooltip")); btnUpdate.setFont(font12b); btnUpdate.setForeground(Color.BLACK); btnUpdate.setPreferredSize(new Dimension(80, 40)); btnUpdate.setEnabled(true); btnUpdate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleUpdate(); } }); pnlButtons.add(btnUpdate, constraints); btnCheck = new JButton(messages.getString("check.xmage")); btnCheck.setToolTipText(messages.getString("check.xmage.tooltip")); btnCheck.setFont(font12b); btnCheck.setForeground(Color.BLACK); btnCheck.setPreferredSize(new Dimension(80, 40)); btnCheck.setEnabled(true); btnCheck.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { handleCheckUpdates(); } }); pnlButtons.add(btnCheck, constraints); frame.add(mainPanel); frame.pack(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
private void criaInterfaceVisualEscalavel() { miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR); painel = new JPanel(); frameSilvinha.setJMenuBar(this.criaMenuBar()); textAreaSourceCode.setTipoHTML();/* ww w. j a v a2 s. co m*/ textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE)); frameSilvinha.setTitle(XHTML_Panel.TIT_CORR_EVT); painel.setLayout(new GridLayout(2, 1)); setBackground(frameSilvinha.corDefault); Container contentPane = this; contentPane.setLayout(new GridLayout(1, 1)); painel.add(textAreaSourceCode); JPanel panelBtnTabela = new JPanel(); panelBtnTabela.setLayout(new BorderLayout()); /* * Barra de botes */ btnPanel = new JPanel(); btnPanel.setLayout(null); btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR); btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR); btn_salvar.setBounds(10, 0, 150, 25); btnPanel.add(btn_salvar); btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR); btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR); btn_abrir.setBounds(165, 0, 150, 25); btnPanel.add(btn_abrir); btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO); btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO); btn_salvarComo.setBounds(320, 0, 150, 25); btnPanel.add(btn_salvarComo); btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR); btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR); btn_cancelar.setBounds(480, 0, 150, 25); btnPanel.add(btn_cancelar); btnPanel.setPreferredSize(new Dimension(430, 30)); /* * Barra de correcao */ btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR); btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR); btnAplicar.setEnabled(false); texto = new JTextField(); texto.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JPanel borda = new JPanel(new BorderLayout()); lbl_texto = new JLabel("JavaScript: "); lbl_texto.setToolTipText(XHTML_Panel.DICA_JAVASCRIPT); borda.add(lbl_texto, BorderLayout.WEST); borda.add(texto, BorderLayout.CENTER); borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); borda.setOpaque(false); panelCorretor = new JPanel(new BorderLayout()); panelCorretor.add(borda, BorderLayout.CENTER); panelCorretor.add(btnAplicar, BorderLayout.EAST); // panelCorretor.add(btnPanel,BorderLayout.WEST); panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); panelCorretor.setOpaque(false); /* * Tabela de erros */ tabelaDeErros = new TabelaErros(); scrollPaneTabela = new JScrollPane(); scrollPaneTabela.setViewportView(tabelaDeErros); panelBtnTabela.add(panelCorretor, BorderLayout.NORTH); panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER); panelBtnTabela.add(btnPanel, BorderLayout.SOUTH); scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS)); painel.add(panelBtnTabela); btnPanel.setBackground(frameSilvinha.corDefault); { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(480, 0, 150, 25); btnPanel.add(reverter); reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); frameSilvinha.showPainelFerramentaEventoDependente(); setVisible(true); } }); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(640, 0, 150, 25); btnPanel.add(reverter); } panelBtnTabela.setBackground(frameSilvinha.corDefault); painel.setBackground(frameSilvinha.corDefault); contentPane.setBackground(frameSilvinha.corDefault); scrollPaneTabela.setBackground(frameSilvinha.corDefault); textAreaSourceCode.setBackground(frameSilvinha.corDefault); miBtnSalvar.setEnabled(false); btn_salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha); String fil[] = { ".html", ".htm" }; salvaAlteracoes.setFiltro(fil); contentPane.add(painel); // pack(); this.setVisible(true); }
From source file:lol.search.RankedStatsPage.java
private JPanel statsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); panel.setOpaque(false); panel.setLayout(new FlowLayout()); panel.setPreferredSize(new Dimension(910, 464)); JPanel statsPanelTotals = new JPanel(); statsPanelTotals.setLayout(new BoxLayout(statsPanelTotals, BoxLayout.X_AXIS)); statsPanelTotals.setOpaque(false);//w ww . j ava 2s. com //statsPanelTotals.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); //totals statsPanelTotals.setPreferredSize(new Dimension(910, 45)); totalJLabel(winsLabel, " W: ", Color.WHITE); winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT); totalJLabel(totalWins, "" + this.wins, valueOrange); totalJLabel(lossesLabel, " L: ", Color.WHITE); totalJLabel(totalLosses, "" + this.losses, valueOrange); totalJLabel(winPercentLabel, " Win Ratio: ", Color.WHITE); totalJLabel(winPercent, winPercentage + "%", valueOrange); totalJLabel(totalGames, " Total Games Played: ", Color.WHITE); totalJLabel(this.totalGamesPlayed, String.valueOf(totalGamesInt), valueOrange); statsPanelTotals.add(winsLabel); statsPanelTotals.add(totalWins); statsPanelTotals.add(lossesLabel); statsPanelTotals.add(totalLosses); statsPanelTotals.add(winPercentLabel); statsPanelTotals.add(winPercent); statsPanelTotals.add(totalGames); statsPanelTotals.add(totalGamesPlayed); JPanel totalsAndAverages = new JPanel(); totalsAndAverages.setOpaque(false); totalsAndAverages.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); totalsAndAverages.setPreferredSize(new Dimension(910, 405)); totalsAndAverages.setLayout(new GridLayout()); JPanel leftSide = new JPanel(); leftSide.setOpaque(false); leftSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel leftSideHeader = new JPanel(); leftSideHeader.setOpaque(false); leftSideHeader.setLayout(new FlowLayout()); leftSideHeader.setPreferredSize(new Dimension(455, 35)); //leftSideHeader.setBorder(BorderFactory.createLineBorder(Color.CYAN)); totalJLabel(this.leftSideHeaderLabel, " Per Game Averages:", Color.WHITE); leftSideHeader.add(this.leftSideHeaderLabel); JPanel leftSideBody = new JPanel(); leftSideBody.setOpaque(false); leftSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); leftSideBody.setPreferredSize(new Dimension(250, 360)); //leftSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); JPanel avgKillsPanel = new JPanel(); avgKillsPanel.setOpaque(false); //avgKillsPanel.setBorder(BorderFactory.createLineBorder(Color.CYAN)); JPanel avgDeathsPanel = new JPanel(); avgDeathsPanel.setOpaque(false); JPanel avgAssistsPanel = new JPanel(); avgAssistsPanel.setOpaque(false); JPanel avgMinionsPanel = new JPanel(); avgMinionsPanel.setOpaque(false); JPanel avgDoubleKillsPanel = new JPanel(); avgDoubleKillsPanel.setOpaque(false); JPanel avgTripleKillsPanel = new JPanel(); avgTripleKillsPanel.setOpaque(false); JPanel avgQuadKillsPanel = new JPanel(); avgQuadKillsPanel.setOpaque(false); JPanel avgPentaKillsPanel = new JPanel(); avgPentaKillsPanel.setOpaque(false); totalJLabel(this.avgKillsLabel, " Avg. Kills: ", Color.WHITE); totalJLabel(this.avgDeathsLabel, " Avg. Deaths: ", Color.WHITE); totalJLabel(this.avgAssistsLabel, " Avg. Assists: ", Color.WHITE); totalJLabel(this.avgMinionKillsLabel, " Avg. Minion Kills: ", Color.WHITE); totalJLabel(this.avgDoubleKillsLabel, " Avg. Double Kills: ", Color.WHITE); totalJLabel(this.avgTripleKillsLabel, " Avg. Triple Kills: ", Color.WHITE); totalJLabel(this.avgQuadKillsLabel, " Avg. Quadra Kills: ", Color.WHITE); totalJLabel(this.avgPentaKillsLabel, " Avg. Penta Kills: ", Color.WHITE); double totalKills = 00000; double totalDeaths = 00000; double totalAssists = 00000; double totalMinions = 00000; double totalDoubleKills = 00000; double totalTripleKills = 00000; double totalQuadraKills = 00000; double totalPentaKills = 00000; double avgKills = 99999; double avgAssists = 99999; double avgDeaths = 99999; double avgMinions = 99999; double avgDoubleKills = 99999; double avgTripleKills = 99999; double avgQuadraKills = 99999; double avgPentaKills = 99999; try { double totalGamesPlayed = this.objChampRankedList.get(0).getJSONObject("stats") .getInt("totalSessionsPlayed"); //operations totalKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalChampionKills"); avgKills = totalKills / totalGamesPlayed; totalDeaths = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDeathsPerSession"); avgDeaths = totalDeaths / totalGamesPlayed; totalAssists = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalAssists"); avgAssists = totalAssists / totalGamesPlayed; totalMinions = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalMinionKills"); avgMinions = totalMinions / totalGamesPlayed; totalDoubleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDoubleKills"); avgDoubleKills = totalDoubleKills / totalGamesPlayed; totalTripleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalTripleKills"); avgTripleKills = totalTripleKills / totalGamesPlayed; totalQuadraKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalQuadraKills"); avgQuadraKills = totalQuadraKills / totalGamesPlayed; totalPentaKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalPentaKills"); avgPentaKills = totalPentaKills / totalGamesPlayed; } catch (JSONException ex) { Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex); } String avgKillsString = new DecimalFormat("##.##").format(avgKills); String avgDeathsString = new DecimalFormat("##.##").format(avgDeaths); String avgAssistsString = new DecimalFormat("##.##").format(avgAssists); String avgMinionsString = new DecimalFormat("##.##").format(avgMinions); String avgDoubleKillsString = new DecimalFormat("##.##").format(avgDoubleKills); String avgTripleKillsString = new DecimalFormat("##.##").format(avgTripleKills); String avgQuadraKillsString = new DecimalFormat("##.##").format(avgQuadraKills); String avgPentaKillsString = new DecimalFormat("##.##").format(avgPentaKills); totalJLabel(this.avgKillsLabelValue, avgKillsString, valueOrange); totalJLabel(this.avgDeathsLabelValue, avgDeathsString, valueOrange); totalJLabel(this.avgAssistsLabelValue, avgAssistsString, valueOrange); totalJLabel(this.avgMinionKillsLabelValue, avgMinionsString, valueOrange); totalJLabel(this.avgDoubleKillsLabelValue, avgDoubleKillsString, valueOrange); totalJLabel(this.avgTripleKillsLabelValue, avgTripleKillsString, valueOrange); totalJLabel(this.avgQuadKillsLabelValue, avgQuadraKillsString, valueOrange); totalJLabel(this.avgPentaKillsLabelValue, avgPentaKillsString, valueOrange); avgKillsPanel.add(avgKillsLabel); avgKillsPanel.add(avgKillsLabelValue); avgDeathsPanel.add(avgDeathsLabel); avgDeathsPanel.add(avgDeathsLabelValue); avgAssistsPanel.add(avgAssistsLabel); avgAssistsPanel.add(avgAssistsLabelValue); avgMinionsPanel.add(avgMinionKillsLabel); avgMinionsPanel.add(avgMinionKillsLabelValue); avgDoubleKillsPanel.add(avgDoubleKillsLabel); avgDoubleKillsPanel.add(avgDoubleKillsLabelValue); avgTripleKillsPanel.add(avgTripleKillsLabel); avgTripleKillsPanel.add(avgTripleKillsLabelValue); avgQuadKillsPanel.add(avgQuadKillsLabel); avgQuadKillsPanel.add(avgQuadKillsLabelValue); avgPentaKillsPanel.add(avgPentaKillsLabel); avgPentaKillsPanel.add(avgPentaKillsLabelValue); leftSideBody.add(avgKillsPanel); leftSideBody.add(avgDeathsPanel); leftSideBody.add(avgAssistsPanel); leftSideBody.add(avgMinionsPanel); leftSideBody.add(avgDoubleKillsPanel); leftSideBody.add(avgTripleKillsPanel); leftSideBody.add(avgQuadKillsPanel); leftSideBody.add(avgPentaKillsPanel); leftSide.add(leftSideHeader); leftSide.add(leftSideBody); JPanel rightSide = new JPanel(); /**/ rightSide.setOpaque(false); rightSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel rightSideHeader = new JPanel(); rightSideHeader.setOpaque(false); rightSideHeader.setLayout(new FlowLayout()); rightSideHeader.setPreferredSize(new Dimension(455, 35)); //rightSideHeader.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); totalJLabel(this.rightSideHeaderLabel, " Season Totals:", Color.WHITE); rightSideHeader.add(this.rightSideHeaderLabel); JPanel rightSideBody = new JPanel(); rightSideBody.setOpaque(false); rightSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); rightSideBody.setPreferredSize(new Dimension(270, 360)); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); JPanel totalKillsPanel = new JPanel(); totalKillsPanel.setOpaque(false); JPanel totalDeathsPanel = new JPanel(); totalDeathsPanel.setOpaque(false); JPanel totalAssistsPanel = new JPanel(); totalAssistsPanel.setOpaque(false); JPanel totalMinionsPanel = new JPanel(); totalMinionsPanel.setOpaque(false); JPanel totalDoubleKillsPanel = new JPanel(); totalDoubleKillsPanel.setOpaque(false); JPanel totalTripleKillsPanel = new JPanel(); totalTripleKillsPanel.setOpaque(false); JPanel totalQuadKillsPanel = new JPanel(); totalQuadKillsPanel.setOpaque(false); JPanel totalPentaKillsPanel = new JPanel(); totalPentaKillsPanel.setOpaque(false); totalJLabel(this.totalKillsLabel, " Total Kills: ", Color.WHITE); totalJLabel(this.totalKillsLabelValue, new DecimalFormat("#######").format(totalKills), valueOrange); totalJLabel(this.totalDeathsLabel, " Total Deaths: ", Color.WHITE); totalJLabel(this.totalDeathsLabelValue, new DecimalFormat("#######").format(totalDeaths), valueOrange); totalJLabel(this.totalAssistsLabel, " Total Assists: ", Color.WHITE); totalJLabel(this.totalAssistsLabelValue, new DecimalFormat("#######").format(totalAssists), valueOrange); totalJLabel(this.totalMinionsLabel, " Total Minion Kills: ", Color.WHITE); totalJLabel(this.totalMinionsLabelValue, new DecimalFormat("#######").format(totalMinions), valueOrange); totalJLabel(this.totalDoubleKillsLabel, " Total Double Kills: ", Color.WHITE); totalJLabel(this.totalDoubleKillsLabelValue, new DecimalFormat("#######").format(totalDoubleKills), valueOrange); totalJLabel(this.totalTripleKillsLabel, " Total Triple Kills: ", Color.WHITE); totalJLabel(this.totalTripleKillsLabelValue, new DecimalFormat("#######").format(totalTripleKills), valueOrange); totalJLabel(this.totalQuadKillsLabel, " Total Quadra Kills: ", Color.WHITE); totalJLabel(this.totalQuadKillsLabelValue, new DecimalFormat("#######").format(totalQuadraKills), valueOrange); totalJLabel(this.totalPentaKillsLabel, " Total Penta Kills: ", Color.WHITE); totalJLabel(this.totalPentaKillsLabelValue, new DecimalFormat("#######").format(totalPentaKills), valueOrange); totalKillsPanel.add(totalKillsLabel); totalKillsPanel.add(totalKillsLabelValue); totalDeathsPanel.add(totalDeathsLabel); totalDeathsPanel.add(totalDeathsLabelValue); totalAssistsPanel.add(totalAssistsLabel); totalAssistsPanel.add(totalAssistsLabelValue); totalMinionsPanel.add(totalMinionsLabel); totalMinionsPanel.add(totalMinionsLabelValue); totalDoubleKillsPanel.add(totalDoubleKillsLabel); totalDoubleKillsPanel.add(totalDoubleKillsLabelValue); totalTripleKillsPanel.add(totalTripleKillsLabel); totalTripleKillsPanel.add(totalTripleKillsLabelValue); totalQuadKillsPanel.add(totalQuadKillsLabel); totalQuadKillsPanel.add(totalQuadKillsLabelValue); totalPentaKillsPanel.add(totalPentaKillsLabel); totalPentaKillsPanel.add(totalPentaKillsLabelValue); rightSideBody.add(totalKillsPanel); rightSideBody.add(totalDeathsPanel); rightSideBody.add(totalAssistsPanel); rightSideBody.add(totalMinionsPanel); rightSideBody.add(totalDoubleKillsPanel); rightSideBody.add(totalTripleKillsPanel); rightSideBody.add(totalQuadKillsPanel); rightSideBody.add(totalPentaKillsPanel); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); rightSide.add(rightSideHeader); rightSide.add(rightSideBody); totalsAndAverages.add(rightSide); totalsAndAverages.add(leftSide); panel.add(statsPanelTotals); panel.add(totalsAndAverages); return panel; }
From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java
private JPanel buildLateral(final String topLabel, final Dimension dimension1, final Dimension dimensionFilterLateral, JScrollPane scrollList, JList list, boolean left) { JPanel leftPanel = new JPanel(new GridBagLayout()); leftPanel.setOpaque(false); leftPanel.setMinimumSize(dimension1); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0;// w ww .j a va2s . c o m JPanel left_filtro = buildPanelFilter(topLabel, textfieldSize - 21, dimensionFilterLateral, list, left); leftPanel.add(left_filtro, gbc); gbc.gridy++; leftPanel.add(scrollList, gbc); return leftPanel; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.links_redundantes.PanelLinkRedundante.java
private void criaInterfaceVisualEscalavel() { miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR); painel = new JPanel(); textAreaSourceCode = new G_TextAreaSourceCode(); //frameSilvinha.setJMenuBar(this.criaMenuBar()); textAreaSourceCode.setTipoHTML();/* w w w . j a va 2 s. co m*/ textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE)); //frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED); painel.setLayout(new GridLayout(2, 1)); setBackground(frameSilvinha.corDefault); Container contentPane = this; contentPane.setLayout(new GridLayout(1, 1)); painel.add(textAreaSourceCode); JPanel panelBtnTabela = new JPanel(); panelBtnTabela.setLayout(new BorderLayout()); /* * Barra de botes */ btnPanel = new JPanel(); btnPanel.setLayout(null); btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR); btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR); btn_salvar.setBounds(10, 0, 150, 25); btnPanel.add(btn_salvar); btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR); btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR); btn_abrir.setBounds(165, 0, 150, 25); btnPanel.add(btn_abrir); btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO); btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO); btn_salvarComo.setBounds(320, 0, 150, 25); btnPanel.add(btn_salvarComo); btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR); btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR); btn_cancelar.setBounds(480, 0, 150, 25); btnPanel.add(btn_cancelar); btnPanel.setPreferredSize(new Dimension(430, 30)); /* * Barra de correcao */ btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR); btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR); btnAplicar.setEnabled(false); texto = new JTextField(); texto.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JPanel borda = new JPanel(new BorderLayout()); JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO); lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO); borda.add(lbl_texto, BorderLayout.WEST); borda.add(texto, BorderLayout.CENTER); borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); borda.setOpaque(false); panelCorretor = new JPanel(new BorderLayout()); panelCorretor.add(borda, BorderLayout.CENTER); panelCorretor.add(btnAplicar, BorderLayout.EAST); //panelCorretor.add(btnPanel,BorderLayout.WEST); panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); panelCorretor.setOpaque(false); /* * Tabela de erros */ tabelaDeErros = new TabelaErros(); scrollPaneTabela = new JScrollPane(); scrollPaneTabela.setViewportView(tabelaDeErros); panelBtnTabela.add(panelCorretor, BorderLayout.NORTH); panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER); panelBtnTabela.add(btnPanel, BorderLayout.SOUTH); scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS)); painel.add(panelBtnTabela); btnPanel.setBackground(frameSilvinha.corDefault); if (!original) { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); frameSilvinha.showPainelFerramentaLinksRedundantes(); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(640, 0, 150, 25); btnPanel.add(reverter); } panelBtnTabela.setBackground(frameSilvinha.corDefault); painel.setBackground(frameSilvinha.corDefault); contentPane.setBackground(frameSilvinha.corDefault); scrollPaneTabela.setBackground(frameSilvinha.corDefault); textAreaSourceCode.setBackground(frameSilvinha.corDefault); miBtnSalvar.setEnabled(false); btn_salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha); String fil[] = { ".html", ".htm" }; salvaAlteracoes.setFiltro(fil); contentPane.add(painel); // pack(); this.setVisible(true); }
From source file:InternalFrameListenerDemo.java
public InternalFrameListenerDemo() { setTitle("Animated InternalFrameListener"); m_count = m_tencount = 0;//w w w. j a v a 2 s.com JPanel innerListenerPanel = new JPanel(new GridLayout(7, 1)); JPanel listenerPanel = new JPanel(new BorderLayout()); m_ifEventCanvas = new IFEventCanvas(); m_lOpened = new JLabel("internalFrameOpened"); m_lClosing = new JLabel("internalFrameClosing"); m_lClosed = new JLabel("internalFrameClosed"); m_lIconified = new JLabel("internalFrameIconified"); m_lDeiconified = new JLabel("internalFrameDeiconified"); m_lActivated = new JLabel("internalFrameActivated"); m_lDeactivated = new JLabel("internalFrameDeactivated"); innerListenerPanel.add(m_lOpened); innerListenerPanel.add(m_lClosing); innerListenerPanel.add(m_lClosed); innerListenerPanel.add(m_lIconified); innerListenerPanel.add(m_lDeiconified); innerListenerPanel.add(m_lActivated); innerListenerPanel.add(m_lDeactivated); listenerPanel.add("Center", m_ifEventCanvas); listenerPanel.add("West", innerListenerPanel); listenerPanel.setOpaque(true); listenerPanel.setBackground(Color.white); m_desktop = new JDesktopPane(); m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); m_newFrame = new JButton("New Frame"); m_newFrame.addActionListener(this); m_infos = UIManager.getInstalledLookAndFeels(); String[] LAFNames = new String[m_infos.length]; for (int i = 0; i < m_infos.length; i++) { LAFNames[i] = m_infos[i].getName(); } m_UIBox = new JComboBox(LAFNames); m_UIBox.addActionListener(this); JPanel topPanel = new JPanel(true); topPanel.setLayout(new FlowLayout()); topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED)))); getContentPane().setLayout(new BorderLayout()); getContentPane().add("North", topPanel); getContentPane().add("Center", m_desktop); getContentPane().add("South", listenerPanel); ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED)))); topPanel.add(m_newFrame); topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT)); topPanel.add(m_UIBox); setSize(645, 500); Dimension dim = getToolkit().getScreenSize(); setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2); setVisible(true); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); m_eventTimer = new Timer(1000, this); m_eventTimer.setRepeats(true); m_eventTimer.start(); }
From source file:com.digitalgeneralists.assurance.ui.components.ComparisonResultPanel.java
protected void initializeComponent(ComparisonResult result) { if (!this.initialized) { this.merging = false; this.numberOfLines = 0; this.setOpaque(true); GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); this.basePanelConstraints.anchor = GridBagConstraints.WEST; this.basePanelConstraints.fill = GridBagConstraints.BOTH; this.basePanelConstraints.gridx = 0; this.basePanelConstraints.gridy = 0; this.basePanelConstraints.weightx = 1.0; this.basePanelConstraints.weighty = 1.0; this.basePanelConstraints.gridheight = 1; this.basePanelConstraints.gridwidth = 1; this.basePanelConstraints.insets = new Insets(0, 0, 0, 0); this.standardPanel.setOpaque(false); GridBagLayout basePanelGridbag = new GridBagLayout(); this.standardPanel.setLayout(basePanelGridbag); this.add(this.standardPanel, this.basePanelConstraints); GridBagConstraints sourcePanelConstraints = new GridBagConstraints(); sourcePanelConstraints.anchor = GridBagConstraints.WEST; sourcePanelConstraints.fill = GridBagConstraints.BOTH; sourcePanelConstraints.gridx = 0; sourcePanelConstraints.gridy = 0; sourcePanelConstraints.weightx = 0.4; sourcePanelConstraints.weighty = 1.0; sourcePanelConstraints.gridheight = 1; sourcePanelConstraints.gridwidth = 1; sourcePanelConstraints.insets = new Insets(0, 0, 0, 0); JPanel sourcePanel = new JPanel(); sourcePanel.setOpaque(false); GridBagLayout sourcePanelGridbag = new GridBagLayout(); sourcePanel.setLayout(sourcePanelGridbag); this.standardPanel.add(sourcePanel, sourcePanelConstraints); GridBagConstraints sourceFileLabelConstraints = new GridBagConstraints(); sourceFileLabelConstraints.anchor = GridBagConstraints.WEST; sourceFileLabelConstraints.gridx = 0; sourceFileLabelConstraints.gridy = 0; sourceFileLabelConstraints.weightx = 1.0; sourceFileLabelConstraints.weighty = 1.0; sourceFileLabelConstraints.gridheight = 1; sourceFileLabelConstraints.gridwidth = 1; sourceFileLabelConstraints.insets = new Insets(5, 5, 5, 5); String sourcePath = "No File Specified"; if ((result != null) && (result.getSource() != null)) { File sourceFile = result.getSource().getFile(); if ((sourceFile == null) || (!sourceFile.exists())) { sourcePath = "File does not exist in source location."; } else { sourcePath = sourceFile.getPath(); }//from ww w . j a va 2 s.c o m sourceFile = null; } JLabel sourceFileLabel = new JLabel(sourcePath); sourcePath = null; sourcePanel.add(sourceFileLabel, sourceFileLabelConstraints); GridBagConstraints sourceAttributesPanelConstraints = new GridBagConstraints(); sourceAttributesPanelConstraints.anchor = GridBagConstraints.WEST; sourceAttributesPanelConstraints.fill = GridBagConstraints.BOTH; sourceAttributesPanelConstraints.gridx = 0; sourceAttributesPanelConstraints.gridy = 1; sourceAttributesPanelConstraints.weightx = 1.0; sourceAttributesPanelConstraints.weighty = 1.0; sourceAttributesPanelConstraints.gridheight = 1; sourceAttributesPanelConstraints.gridwidth = 1; sourceAttributesPanelConstraints.insets = new Insets(0, 0, 0, 0); FileReference sourceReference = null; if (result != null) { sourceReference = result.getSource(); } FileReference targetReference = null; if (result != null) { targetReference = result.getTarget(); } JPanel sourceAttributesPanel = this.createFileAttributesPanel(sourceReference, targetReference, GridBagConstraints.WEST); sourcePanel.add(sourceAttributesPanel, sourceAttributesPanelConstraints); this.moreSourceAttributesButton.setHorizontalAlignment(SwingConstants.LEFT); this.moreSourceAttributesButton.setBorderPainted(false); this.moreSourceAttributesButton.setOpaque(false); this.moreSourceAttributesButton.setForeground(Color.blue); if (this.editable) { this.moreSourceAttributesButton.setText("All attributes..."); this.moreSourceAttributesButton.addActionListener(this); this.moreSourceAttributesButton.setEnabled(true); } else { this.moreSourceAttributesButton.setText(" "); this.moreSourceAttributesButton.setEnabled(false); } this.moreSourceAttributesButton.setActionCommand(AssuranceActions.sourceAttributesAction); GridBagConstraints moreSourceAttributesButtonConstraints = new GridBagConstraints(); moreSourceAttributesButtonConstraints.anchor = GridBagConstraints.WEST; moreSourceAttributesButtonConstraints.fill = GridBagConstraints.BOTH; moreSourceAttributesButtonConstraints.gridx = 0; moreSourceAttributesButtonConstraints.gridy = 2; moreSourceAttributesButtonConstraints.weightx = 1.0; moreSourceAttributesButtonConstraints.weighty = 1.0; moreSourceAttributesButtonConstraints.gridheight = 1; moreSourceAttributesButtonConstraints.gridwidth = 1; moreSourceAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0); sourcePanel.add(this.moreSourceAttributesButton, moreSourceAttributesButtonConstraints); this.buildMergePanel(result); GridBagConstraints targetPanelConstraints = new GridBagConstraints(); targetPanelConstraints.anchor = GridBagConstraints.EAST; targetPanelConstraints.fill = GridBagConstraints.BOTH; targetPanelConstraints.gridx = 2; targetPanelConstraints.gridy = 0; targetPanelConstraints.weightx = 0.4; targetPanelConstraints.weighty = 1.0; targetPanelConstraints.gridheight = 1; targetPanelConstraints.gridwidth = 1; targetPanelConstraints.insets = new Insets(0, 0, 0, 0); JPanel targetPanel = new JPanel(); GridBagLayout targetPanelGridbag = new GridBagLayout(); targetPanel.setOpaque(false); targetPanel.setLayout(targetPanelGridbag); this.standardPanel.add(targetPanel, targetPanelConstraints); GridBagConstraints targetFileLabelConstraints = new GridBagConstraints(); targetFileLabelConstraints.anchor = GridBagConstraints.EAST; targetFileLabelConstraints.fill = GridBagConstraints.BOTH; targetFileLabelConstraints.gridx = 0; targetFileLabelConstraints.gridy = 0; targetFileLabelConstraints.weightx = 1.0; targetFileLabelConstraints.weighty = 1.0; targetFileLabelConstraints.gridheight = 1; targetFileLabelConstraints.gridwidth = 1; targetFileLabelConstraints.insets = new Insets(5, 5, 5, 5); // Create a label to put messages during an action event. String targetPath = "No File Specified"; if ((result != null) && (result.getTarget() != null)) { File targetFile = result.getTarget().getFile(); if ((targetFile == null) || (!targetFile.exists())) { targetPath = "File does not exist in target location."; } else { targetPath = targetFile.getPath(); } targetFile = null; } JLabel targetFileLabel = new JLabel(targetPath); targetPath = null; targetPanel.add(targetFileLabel, targetFileLabelConstraints); GridBagConstraints targetAttributesPanelConstraints = new GridBagConstraints(); targetAttributesPanelConstraints.anchor = GridBagConstraints.EAST; targetAttributesPanelConstraints.fill = GridBagConstraints.BOTH; targetAttributesPanelConstraints.gridx = 0; targetAttributesPanelConstraints.gridy = 1; targetAttributesPanelConstraints.weightx = 1.0; targetAttributesPanelConstraints.weighty = 1.0; targetAttributesPanelConstraints.gridheight = 1; targetAttributesPanelConstraints.gridwidth = 1; targetAttributesPanelConstraints.insets = new Insets(0, 0, 0, 0); JPanel targetAttributesPanel = this.createFileAttributesPanel(targetReference, sourceReference, GridBagConstraints.EAST); targetPanel.add(targetAttributesPanel, targetAttributesPanelConstraints); sourceReference = null; targetReference = null; this.moreTargetAttributesButton.setHorizontalAlignment(SwingConstants.RIGHT); this.moreTargetAttributesButton.setBorderPainted(false); this.moreTargetAttributesButton.setOpaque(false); this.moreTargetAttributesButton.setForeground(Color.blue); if (this.editable) { this.moreTargetAttributesButton.setText("All attributes..."); this.moreTargetAttributesButton.addActionListener(this); this.moreTargetAttributesButton.setEnabled(true); } else { this.moreTargetAttributesButton.setText(" "); this.moreTargetAttributesButton.setEnabled(false); } this.moreTargetAttributesButton.setActionCommand(AssuranceActions.targetAttributesAction); GridBagConstraints moreTargetAttributesButtonConstraints = new GridBagConstraints(); moreTargetAttributesButtonConstraints.anchor = GridBagConstraints.EAST; moreTargetAttributesButtonConstraints.fill = GridBagConstraints.BOTH; moreTargetAttributesButtonConstraints.gridx = 0; moreTargetAttributesButtonConstraints.gridy = 2; moreTargetAttributesButtonConstraints.weightx = 1.0; moreTargetAttributesButtonConstraints.weighty = 1.0; moreTargetAttributesButtonConstraints.gridheight = 1; moreTargetAttributesButtonConstraints.gridwidth = 1; moreTargetAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0); targetPanel.add(this.moreTargetAttributesButton, moreTargetAttributesButtonConstraints); GridBagLayout mergingPanelGridbag = new GridBagLayout(); this.mergingPanel.setLayout(mergingPanelGridbag); GridBagConstraints mergingLabelConstraints = new GridBagConstraints(); mergingLabelConstraints.anchor = GridBagConstraints.NORTH; mergingLabelConstraints.fill = GridBagConstraints.BOTH; mergingLabelConstraints.gridx = 0; mergingLabelConstraints.gridy = 0; mergingLabelConstraints.weightx = 1.0; mergingLabelConstraints.weighty = 1.0; mergingLabelConstraints.gridheight = 1; mergingLabelConstraints.gridwidth = 1; mergingLabelConstraints.insets = new Insets(10, 10, 10, 10); this.mergingLabel.setHorizontalAlignment(JLabel.CENTER); mergingPanel.add(this.mergingLabel, mergingLabelConstraints); GridBagConstraints mergingStatusIndicatorConstraints = new GridBagConstraints(); mergingStatusIndicatorConstraints.anchor = GridBagConstraints.SOUTH; mergingStatusIndicatorConstraints.fill = GridBagConstraints.BOTH; mergingStatusIndicatorConstraints.gridx = 0; mergingStatusIndicatorConstraints.gridy = 1; mergingStatusIndicatorConstraints.weightx = 1.0; mergingStatusIndicatorConstraints.weighty = 1.0; mergingStatusIndicatorConstraints.gridheight = 1; mergingStatusIndicatorConstraints.gridwidth = 1; mergingStatusIndicatorConstraints.insets = new Insets(10, 10, 10, 10); this.mergingProgressIndicator.setIndeterminate(true); mergingPanel.add(this.mergingProgressIndicator, mergingStatusIndicatorConstraints); this.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { if (applicationDelegate != null) { applicationDelegate.addEventObserver(ResultMergeStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ResultMergeProgressEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ResultMergeCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(DeletedItemRestoreStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(DeletedItemRestoreProgressEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(DeletedItemRestoreCompletedEvent.class, (IEventObserver) event.getSource()); } } public void ancestorRemoved(AncestorEvent event) { if (applicationDelegate != null) { applicationDelegate.removeEventObserver(ResultMergeStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ResultMergeProgressEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ResultMergeCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(DeletedItemRestoreStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(DeletedItemRestoreProgressEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(DeletedItemRestoreCompletedEvent.class, (IEventObserver) event.getSource()); } } public void ancestorMoved(AncestorEvent event) { } }); this.initialized = true; } }
From source file:edu.ku.brc.ui.CustomDialog.java
/** * Create the UI for the dialog./*from w w w . ja v a 2 s .c om*/ */ public void createUI() { isCreated = true; /*if (helpContext == null) { whichBtns &= ~HELP_BTN; // Clear Bit for Help button if there is no HelpContext }*/ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); mainPanel = createMainPanel(); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 5, 2)); if (titleBarLabel != null) { mainPanel.add(titleBarLabel, BorderLayout.NORTH); mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); } if (contentPanel != null) { mainPanel.add(contentPanel, BorderLayout.CENTER); } // Bottom Button UI createButtons(); getRootPane().setDefaultButton(findDefaultBtn()); JPanel bb = buildButtonBar(); if (extraBtn != null) { PanelBuilder builder = new PanelBuilder(new FormLayout("p,f:p:g", "p")); CellConstraints cc = new CellConstraints(); builder.add(extraBtn, cc.xy(1, 1)); builder.add(bb, cc.xy(2, 1)); builder.getPanel().setOpaque(false); bb = builder.getPanel(); } if (bb != null) { bb.setOpaque(false); Component bbComp = bb; if (UIHelper.getOSType() == UIHelper.OSTYPE.MacOSX) // adjust for intruding resizer on Mac OS X { PanelBuilder builder = new PanelBuilder(new FormLayout("p:g,15px", "p")); CellConstraints cc = new CellConstraints(); builder.add(bb, cc.xy(1, 1)); builder.getPanel().setOpaque(false); bbComp = builder.getPanel(); } mainPanel.add(bbComp, BorderLayout.SOUTH); } setContentPane(mainPanel); pack(); setLocationRelativeTo(this.getOwner()); }