List of usage examples for java.awt BorderLayout PAGE_END
String PAGE_END
To view the source code for java.awt BorderLayout PAGE_END.
Click Source Link
From source file:DialogDemo.java
/** Creates the panel shown by the second tab. */ private JPanel createFeatureDialogBox() { final int numButtons = 5; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); JButton showItButton = null;//from w w w.j a va2 s . co m final String pickOneCommand = "pickone"; final String textEnteredCommand = "textfield"; final String nonAutoCommand = "nonautooption"; final String customOptionCommand = "customoption"; final String nonModalCommand = "nonmodal"; radioButtons[0] = new JRadioButton("Pick one of several choices"); radioButtons[0].setActionCommand(pickOneCommand); radioButtons[1] = new JRadioButton("Enter some text"); radioButtons[1].setActionCommand(textEnteredCommand); radioButtons[2] = new JRadioButton("Non-auto-closing dialog"); radioButtons[2].setActionCommand(nonAutoCommand); radioButtons[3] = new JRadioButton("Input-validating dialog " + "(with custom message area)"); radioButtons[3].setActionCommand(customOptionCommand); radioButtons[4] = new JRadioButton("Non-modal dialog"); radioButtons[4].setActionCommand(nonModalCommand); for (int i = 0; i < numButtons; i++) { group.add(radioButtons[i]); } radioButtons[0].setSelected(true); showItButton = new JButton("Show it!"); showItButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String command = group.getSelection().getActionCommand(); // pick one of many if (command == pickOneCommand) { Object[] possibilities = { "ham", "spam", "yam" }; String s = (String) JOptionPane.showInputDialog(frame, "Complete the sentence:\n" + "\"Green eggs and...\"", "Customized Dialog", JOptionPane.PLAIN_MESSAGE, icon, possibilities, "ham"); // If a string was returned, say so. if ((s != null) && (s.length() > 0)) { setLabel("Green eggs and... " + s + "!"); return; } // If you're here, the return value was null/empty. setLabel("Come on, finish the sentence!"); // text input } else if (command == textEnteredCommand) { String s = (String) JOptionPane.showInputDialog(frame, "Complete the sentence:\n" + "\"Green eggs and...\"", "Customized Dialog", JOptionPane.PLAIN_MESSAGE, icon, null, "ham"); // If a string was returned, say so. if ((s != null) && (s.length() > 0)) { setLabel("Green eggs and... " + s + "!"); return; } // If you're here, the return value was null/empty. setLabel("Come on, finish the sentence!"); // non-auto-closing dialog } else if (command == nonAutoCommand) { final JOptionPane optionPane = new JOptionPane( "The only way to close this dialog is by\n" + "pressing one of the following buttons.\n" + "Do you understand?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); // You can't use pane.createDialog() because that // method sets up the JDialog with a property change // listener that automatically closes the window // when a button is clicked. final JDialog dialog = new JDialog(frame, "Click a button", true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { setLabel("Thwarted user attempt to close window."); } }); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop))) { // If you were going to check something // before closing the window, you'd do // it here. dialog.setVisible(false); } } }); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); int value = ((Integer) optionPane.getValue()).intValue(); if (value == JOptionPane.YES_OPTION) { setLabel("Good."); } else if (value == JOptionPane.NO_OPTION) { setLabel("Try using the window decorations " + "to close the non-auto-closing dialog. " + "You can't!"); } else { setLabel("Window unavoidably closed (ESC?)."); } // non-auto-closing dialog with custom message area // NOTE: if you don't intend to check the input, // then just use showInputDialog instead. } else if (command == customOptionCommand) { customDialog.setLocationRelativeTo(frame); customDialog.setVisible(true); String s = customDialog.getValidatedText(); if (s != null) { // The text is valid. setLabel("Congratulations! " + "You entered \"" + s + "\"."); } // non-modal dialog } else if (command == nonModalCommand) { // Create the dialog. final JDialog dialog = new JDialog(frame, "A Non-Modal Dialog"); // Add contents to it. It must have a close button, // since some L&Fs (notably Java/Metal) don't provide one // in the window decorations for dialogs. JLabel label = new JLabel("<html><p align=center>" + "This is a non-modal dialog.<br>" + "You can have one or more of these up<br>" + "and still use the main window."); label.setHorizontalAlignment(JLabel.CENTER); Font font = label.getFont(); label.setFont(label.getFont().deriveFont(font.PLAIN, 14.0f)); JButton closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); } }); JPanel closePanel = new JPanel(); closePanel.setLayout(new BoxLayout(closePanel, BoxLayout.LINE_AXIS)); closePanel.add(Box.createHorizontalGlue()); closePanel.add(closeButton); closePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(label, BorderLayout.CENTER); contentPane.add(closePanel, BorderLayout.PAGE_END); contentPane.setOpaque(true); dialog.setContentPane(contentPane); // Show it. dialog.setSize(new Dimension(300, 150)); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); } } }); return createPane(moreDialogDesc + ":", radioButtons, showItButton); }
From source file:com.polivoto.vistas.Charts.java
private JPanel hacerTabla(Pregunta pregunta, List<Opcion> opciones, String perfil) { Tabla panel = new Tabla(); //Panel completo //scrollPanel.setBackground(Color.blue); //Ttulo pregunta JLabel tituloPregunta = new JLabel("\t" + pregunta.getTitulo() + " (" + perfil + ")"); tituloPregunta.setFont(new Font("Roboto", 1, 24)); tituloPregunta.setForeground(Color.black); tituloPregunta.setVerticalAlignment(JLabel.CENTER); JPanel panelHeader = panel.getjPanelHead(); panelHeader.add(tituloPregunta);/* w ww .j a v a 2s . c om*/ panelHeader.setOpaque(false); panelHeader.setPreferredSize(panelGrafica.getSize()); //Panel de la tabla JPanel tabla = new JPanel(new GridLayout(pregunta.obtenerCantidadDeOpciones() + 2, 3, 5, 5)); tabla.setBackground(Color.white); //Poner el titulo de cada columna for (int i = 0; i < 3; i++) { JPanel tilt = new JPanel(); tilt.setBackground(new Color(137, 36, 31)); JLabel label = new JLabel(i == 0 ? "Opcion" : i == 2 ? "Porcentaje" : "Cantidad"); label.setFont(new Font("Roboto", 1, 18)); label.setForeground(Color.white); tilt.add(label); tilt.setSize(new Dimension(0, 35)); tilt.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); tabla.add(tilt); } int sum = 0; for (Opcion opcion : opciones) { sum += opcion.getCantidad(); } for (Opcion opc : opciones) { JPanel p1 = new JPanel(new GridLayout(0, 1)); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JTextArea l1 = new JTextArea(opc.getNombre()); l1.setWrapStyleWord(true); l1.setLineWrap(true); l1.setFont(new Font("Roboto", 0, 18)); l1.setEditable(false); l1.setBorder(null); p1.setPreferredSize(l1.getSize()); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + opc.getCantidad()); l2.setFont(new Font("Roboto", 0, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); double porcentaje = (opc.getCantidad() * 100.0) / sum; JLabel l3 = new JLabel(String.format("%.2f", porcentaje) + "%"); l3.setFont(new Font("Roboto", 0, 18)); p3.add(l3); tabla.add(p3); } JPanel p1 = new JPanel(); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l1 = new JLabel("Total"); l1.setHorizontalTextPosition(JLabel.LEFT); l1.setFont(new Font("Roboto", 1, 18)); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + sum); l2.setFont(new Font("Roboto", 1, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l3 = new JLabel("100.00%"); l3.setFont(new Font("Roboto", 1, 18)); p3.add(l3); tabla.add(p3); panel.getjPanelContent().add(tabla, BorderLayout.CENTER); //Relleno JPanel x = new JPanel(new GridLayout()); x.setPreferredSize(new Dimension(100, 0)); x.setBackground(Color.white); panel.getjPanelContent().add(x, BorderLayout.LINE_START); JPanel y = new JPanel(new GridLayout()); y.setPreferredSize(new Dimension(100, 0)); y.setBackground(Color.white); panel.getjPanelContent().add(y, BorderLayout.LINE_END); JPanel z = new JPanel(new GridLayout()); z.setBackground(Color.white); z.setPreferredSize(new Dimension(0, 40)); panel.getjPanelContent().add(z, BorderLayout.PAGE_END); return panel; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w w w .jav a2 s .c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { panelMainArea = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); labelCellUnderMouse = new javax.swing.JLabel(); labelZoomStatus = new javax.swing.JLabel(); menuMain = new javax.swing.JMenuBar(); menuFile = new javax.swing.JMenu(); menuFileNew = new javax.swing.JMenuItem(); menuItemFileOpen = new javax.swing.JMenuItem(); menuFileSave = new javax.swing.JMenuItem(); menuFileSaveAs = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); menuFileExportAs = new javax.swing.JMenu(); menuFileExportAsImage = new javax.swing.JMenuItem(); menuFileExportAsSVG = new javax.swing.JMenuItem(); menuFileExportAsXML = new javax.swing.JMenuItem(); menuFileExportAsJavaConstants = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JPopupMenu.Separator(); menuFileDocumentOptions = new javax.swing.JMenuItem(); jSeparator4 = new javax.swing.JPopupMenu.Separator(); menuFileExit = new javax.swing.JMenuItem(); menuEdit = new javax.swing.JMenu(); menuEditUndo = new javax.swing.JMenuItem(); menuEditRedo = new javax.swing.JMenuItem(); menuView = new javax.swing.JMenu(); menuViewZoomIn = new javax.swing.JMenuItem(); menuViewZoomOut = new javax.swing.JMenuItem(); menuViewZoomReset = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JPopupMenu.Separator(); menuViewBackImage = new javax.swing.JCheckBoxMenuItem(); menuShowHexBorders = new javax.swing.JCheckBoxMenuItem(); menuPlugins = new javax.swing.JMenu(); menuWindow = new javax.swing.JMenu(); menuWindowLayers = new javax.swing.JCheckBoxMenuItem(); menuWindowTools = new javax.swing.JCheckBoxMenuItem(); menuWindowOptions = new javax.swing.JCheckBoxMenuItem(); menuLANDF = new javax.swing.JMenu(); menuHelp = new javax.swing.JMenu(); menuHelpAbout = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("JHexed Map editor"); setLocationByPlatform(true); setMinimumSize(new java.awt.Dimension(300, 300)); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); panelMainArea.setLayout(new java.awt.BorderLayout()); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); labelCellUnderMouse.setText(" "); labelZoomStatus.setText(" "); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(labelCellUnderMouse) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 705, Short.MAX_VALUE) .addComponent(labelZoomStatus).addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelCellUnderMouse).addComponent(labelZoomStatus)))); panelMainArea.add(jPanel1, java.awt.BorderLayout.PAGE_END); getContentPane().add(panelMainArea, java.awt.BorderLayout.CENTER); menuFile.setText("File"); menuFile.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileActionPerformed(evt); } }); menuFileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); menuFileNew.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/new.png"))); // NOI18N menuFileNew.setText("New"); menuFileNew.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileNewActionPerformed(evt); } }); menuFile.add(menuFileNew); menuItemFileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); menuItemFileOpen.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/folder-open-image.png"))); // NOI18N menuItemFileOpen.setText("Open"); menuItemFileOpen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemFileOpenActionPerformed(evt); } }); menuFile.add(menuItemFileOpen); menuFileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); menuFileSave.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/drive-download.png"))); // NOI18N menuFileSave.setText("Save"); menuFileSave.setEnabled(false); menuFileSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileSaveActionPerformed(evt); } }); menuFile.add(menuFileSave); menuFileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); menuFileSaveAs.setText("Save As..."); menuFileSaveAs.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileSaveAsActionPerformed(evt); } }); menuFile.add(menuFileSaveAs); menuFile.add(jSeparator1); menuFileExportAs.setText("Export as..."); menuFileExportAsImage.setText("PNG Image"); menuFileExportAsImage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExportAsImageActionPerformed(evt); } }); menuFileExportAs.add(menuFileExportAsImage); menuFileExportAsSVG.setText("SVG Image"); menuFileExportAsSVG.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExportAsSVGActionPerformed(evt); } }); menuFileExportAs.add(menuFileExportAsSVG); menuFileExportAsXML.setText("Xml file"); menuFileExportAsXML.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExportAsXMLActionPerformed(evt); } }); menuFileExportAs.add(menuFileExportAsXML); menuFileExportAsJavaConstants.setText("Java constants"); menuFileExportAsJavaConstants.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExportAsJavaConstantsActionPerformed(evt); } }); menuFileExportAs.add(menuFileExportAsJavaConstants); menuFile.add(menuFileExportAs); menuFile.add(jSeparator3); menuFileDocumentOptions.setText("Document options"); menuFileDocumentOptions.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileDocumentOptionsActionPerformed(evt); } }); menuFile.add(menuFileDocumentOptions); menuFile.add(jSeparator4); menuFileExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK)); menuFileExit.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/door-open-out.png"))); // NOI18N menuFileExit.setText("Exit"); menuFileExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExitActionPerformed(evt); } }); menuFile.add(menuFileExit); menuMain.add(menuFile); menuEdit.setText("Edit"); menuEditUndo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK)); menuEditUndo.setText("Undo"); menuEditUndo.setEnabled(false); menuEditUndo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuEditUndoActionPerformed(evt); } }); menuEdit.add(menuEditUndo); menuEditRedo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK)); menuEditRedo.setText("Redo"); menuEditRedo.setEnabled(false); menuEditRedo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuEditRedoActionPerformed(evt); } }); menuEdit.add(menuEditRedo); menuMain.add(menuEdit); menuView.setText("View"); menuViewZoomIn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK)); menuViewZoomIn.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-in.png"))); // NOI18N menuViewZoomIn.setText("Zoom In"); menuViewZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuViewZoomInActionPerformed(evt); } }); menuView.add(menuViewZoomIn); menuViewZoomOut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); menuViewZoomOut.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-out.png"))); // NOI18N menuViewZoomOut.setText("Zoom Out"); menuViewZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuViewZoomOutActionPerformed(evt); } }); menuView.add(menuViewZoomOut); menuViewZoomReset.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK)); menuViewZoomReset.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-actual.png"))); // NOI18N menuViewZoomReset.setText("Zoom Reset"); menuViewZoomReset.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuViewZoomResetActionPerformed(evt); } }); menuView.add(menuViewZoomReset); menuView.add(jSeparator2); menuViewBackImage.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK)); menuViewBackImage.setSelected(true); menuViewBackImage.setText("Show back image"); menuViewBackImage.setToolTipText("Show/Hide the background image"); menuViewBackImage.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { menuViewBackImageStateChanged(evt); } }); menuView.add(menuViewBackImage); menuShowHexBorders.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); menuShowHexBorders.setSelected(true); menuShowHexBorders.setText("Show hex borders"); menuShowHexBorders.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { menuShowHexBordersStateChanged(evt); } }); menuView.add(menuShowHexBorders); menuMain.add(menuView); menuPlugins.setText("Plugins"); menuMain.add(menuPlugins); menuWindow.setText("Window"); menuWindowLayers.setSelected(true); menuWindowLayers.setText("Layers"); menuWindowLayers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuWindowLayersActionPerformed(evt); } }); menuWindow.add(menuWindowLayers); menuWindowTools.setSelected(true); menuWindowTools.setText("Tools"); menuWindowTools.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuWindowToolsActionPerformed(evt); } }); menuWindow.add(menuWindowTools); menuWindowOptions.setSelected(true); menuWindowOptions.setText("Options"); menuWindowOptions.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuWindowOptionsActionPerformed(evt); } }); menuWindow.add(menuWindowOptions); menuMain.add(menuWindow); menuLANDF.setText("Look&Feel"); menuMain.add(menuLANDF); menuHelp.setText("Help"); menuHelpAbout.setText("About"); menuHelpAbout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuHelpAboutActionPerformed(evt); } }); menuHelp.add(menuHelpAbout); menuMain.add(menuHelp); setJMenuBar(menuMain); pack(); }
From source file:modnlp.capte.AlignmentInterfaceWS.java
public void actionPerformed(ActionEvent e) { //Handle open button action. if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(AlignmentInterfaceWS.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); //This is where a real application would open the file. sourceFile = file.getAbsolutePath(); log.append("Source File: " + sourceFile + "." + newline); } else {// w w w . j a va 2 s .c o m log.append("Open command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); } //deleteSegment else if (e.getSource() == deleteSegment) { Object[] o; String ivalue; int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 1) { System.out.println("Please select at least one row"); JOptionPane.showMessageDialog(edit, "Please select at least one row"); } else { System.out.println("Deleting rows..."); for (int i = selected.length - 1; i > -1; i--) { em.removeRow(selected[i]); //update numbers System.out.println("Removed row " + selected[i]); } } //Table should update itself automatically } else if (e.getSource() == moveUp) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length > 1) { System.out.println("You can only move one segment at a time!"); JOptionPane.showMessageDialog(edit, "You can only move one segment at a time!"); } else if (selected[0] == 0) { System.out.println("Can't move up anymore!"); JOptionPane.showMessageDialog(edit, "Can't move up anymore!"); } else { System.out.println("Moving " + selected[0]); em.moveSegmentUp(selected[0]); //Table should repaint } } else if (e.getSource() == moveDown) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length > 1) { System.out.println("You can only move one segment at a time!"); JOptionPane.showMessageDialog(edit, "You can only move one segment at a time!"); } else if (selected[0] == em.getRowCount() - 1) { System.out.println("Can't move down anymore!"); JOptionPane.showMessageDialog(edit, "Can't move down anymore"); } else { System.out.println("Moving " + selected[0]); em.moveSegmentDown(selected[0]); //Table should repaint } } else if (e.getSource() == mergeSource) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 2 || selected.length > 2) { System.out.println("Please select two rows to merge "); JOptionPane.showMessageDialog(edit, "Please select two rows to merge"); } else if (selected[0] - selected[1] > 1 || selected[0] - selected[1] < -1) { System.out.println("Can only merge adjacent rows"); JOptionPane.showMessageDialog(edit, "Can only merge adjacent rows"); } else { System.out.println("Merging source in rows " + selected[0] + " " + selected[1]); em.mergeSource(selected[0], selected[1]); } } else if (e.getSource() == mergeTarget) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 2 || selected.length > 2) { System.out.println("Please select two rows to merge "); JOptionPane.showMessageDialog(edit, "Please select two rows to merge"); } else if (selected[0] - selected[1] > 1 || selected[0] - selected[1] < -1) { System.out.println("Can only merge adjacent rows"); JOptionPane.showMessageDialog(edit, "Can only merge adjacent rows"); } else { System.out.println("Merging target in " + selected[0] + " " + selected[1]); em.mergeTarget(selected[0], selected[1]); } } else if (e.getSource() == newSegment) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 1) { System.out.println("Please select a position to insert at:"); JOptionPane.showMessageDialog(edit, "Please select a position to insert at"); } else { System.out.println("Inserting new segment at " + (selected[0] + 1)); //insert empty string array Object[] sa = new Object[6]; sa[0] = ""; sa[1] = ""; sa[2] = "0.0"; sa[3] = new Boolean(false); sa[4] = "0"; sa[5] = em.getValueAt((selected[0]), 5) + "(+)"; em.insertRow(sa, (selected[0] + 1)); } } else if (e.getSource() == lockSelected) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 1) { System.out.println("Please select some rows to lock:"); JOptionPane.showMessageDialog(edit, "Please select some rows to lock:"); } else { //lock selected rows for (int i = 0; i < selected.length; i++) { em.lockRow(selected[i]); System.out.println("Locking row " + selected[i]); } } } else if (e.getSource() == unlockSelected) { int[] selected = table.getSelectedRows(); ExampleTableModel em = (ExampleTableModel) table.getModel(); if (selected.length < 1) { System.out.println("Please select some rows to unlock:"); JOptionPane.showMessageDialog(edit, "Please select some rows to unlock:"); } else { //lock selected rows for (int i = 0; i < selected.length; i++) { em.unlockRow(selected[i]); System.out.println("Unlocking row " + selected[i]); } } } else if (e.getSource() == reAlign) { // if(true){ // JOptionPane.showMessageDialog(edit,"This feature is currently disabled"); // }else{ reNumber++; ExampleTableModel em = (ExampleTableModel) table.getModel(); // Get list of locked segments // Find lowest locked segment // Realign from lowest locked segment // Join the realigned bit back up with the locked bit // refresh the table int lowestlock = 0; Vector<Object[]> slice = new Vector<Object[]>(); Vector<Object[]> result = new Vector<Object[]>(); Vector<Object[]> locked = new Vector<Object[]>(); Boolean b = new Boolean(true); for (int i = 0; i < em.getRowCount(); i++) { b = (Boolean) em.getValueAt(i, 3); if (b.booleanValue() == true) { lowestlock = i; } } //get slice of table for realignment System.out.println("The lowest lock point is " + (lowestlock)); System.out.println("Realigning from row:" + (lowestlock + 1) + " to : " + em.getRowCount()); System.out.println("Total size of realign array =:" + (em.getRowCount() - (lowestlock))); //Get locked bits for (int h = 0; h < lowestlock + 1; h++) { locked.add(em.getRow(h)); } //Get bits to realign for (int j = lowestlock + 1; j < em.getRowCount(); j++) { slice.add(em.getRow(j)); } //flush em.flush(); for (int z = 0; z < locked.size(); z++) { em.insertRow(locked.get(z), z); } // System.out.println("Total size of array after bits removed = " + (em.getRowCount())); //get the directory where the source files came from File parent = new File(sourceFile).getParentFile(); String dir = parent.getAbsolutePath(); //create files File sf = null; File tf = null; try { sf = File.createTempFile("source", "tmp"); tf = File.createTempFile("target", "tmp"); } catch (IOException ef) { ef.printStackTrace(); } System.out.println("Writing temp file:" + sf.getName()); System.out.println("Writing temp file:" + tf.getName()); // File mf = new File("merged.tmp"); //get absolute paths String sourceF = sf.getAbsolutePath(); String targetF = tf.getAbsolutePath(); //String alignF = mf.getAbsolutePath(); //write out source and target to files //NEW write files to server and return string String alignment = ""; AlignerUtils.reWriteAlignment(targetF, sourceF, slice); try { alignment = AlignerUtils.MultiPartFileUpload(targetF, sourceF); } catch (IOException es) { es.printStackTrace(); } //convert the String to a Vector form result = AlignerUtils.StringToData(alignment, true, reNumber); // append the resultant file to the table //System.out.println("Total size of array before bits inserted = " + (em.getRowCount())); for (int y = 0, z = em.getRowCount(); y < result.size(); y++, z++) { em.insertRow(result.get(y), z); System.out.println("Inserting at position: " + z); System.out.println("Inserting from position: " + y); } // System.out.println("Total size of array after bits inserted = " + (em.getRowCount())); // } } else if (e.getSource() == saveButton) { int returnVal = fc.showSaveDialog(AlignmentInterfaceWS.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); //This is where a real application would save the file. targetFile = file.getAbsolutePath(); log.append("Target File " + targetFile + "." + newline); } else { log.append("Save command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); } else if (e.getSource() == export) { int returnVal = fc.showSaveDialog(AlignmentInterfaceWS.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); outputFile = file.getAbsolutePath(); //aserver.writeAlignment(targetFile,data); AlignerUtils.writeAlignment(outputFile, data); log.append(newline + "Saving " + outputFile + "." + newline); } else { log.append("Save command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); } else if (e.getSource() == alignButton) { if (sl.getText().length() >= 2 && tl.getText().length() >= 2) { log.append("Attempting to align texts"); sourcel = sl.getText(); targetl = tl.getText(); String aligned = ""; try { aligned = AlignerUtils.MultiPartFileUpload(sourceFile, targetFile); } catch (IOException ed) { ed.printStackTrace(); } //Convert string to alignment format data = AlignerUtils.StringToData(aligned, false, 0); int i = 0; // // AlreadyRun = true; if (i == 0) { //log.setCaretPosition(log.getDocument().getLength()); log.append("\nAutomatic alignment successful!"); log.append("\nOpening display window......"); //Set up the editor window JFrame edit = new JFrame("Alignment Editor"); cols = new Vector<String>(); cols.add("Source"); cols.add("Target"); cols.add("Score"); cols.add("Lock"); cols.add("Index"); cols.add("Orig"); System.out.println("Size of data array " + data.size()); System.out.println(data.get(0)[0]); ex = new ExampleTableModel(cols, data); //ex.addTableModelListener(this); table = new JTable(ex); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); TableColumnModel cmodel = table.getColumnModel(); cmodel.getColumn(0).setCellRenderer(new TextAreaRenderer()); cmodel.getColumn(1).setCellRenderer(new TextAreaRenderer()); cmodel.getColumn(2).setCellRenderer(new TextAreaRenderer()); cmodel.getColumn(4).setCellRenderer(new TextAreaRenderer()); cmodel.getColumn(5).setCellRenderer(new TextAreaRenderer()); TextAreaEditor textEditor = new TextAreaEditor(); textEditor.addCellEditorListener(this); cmodel.getColumn(0).setCellEditor(textEditor); cmodel.getColumn(1).setCellEditor(textEditor); cmodel.getColumn(2).setCellEditor(textEditor); cmodel.getColumn(4).setCellEditor(textEditor); cmodel.getColumn(5).setCellEditor(textEditor); mergeTarget = new JButton("Merge target"); mergeSource = new JButton("Merge source"); export = new JButton("Export to File"); newSegment = new JButton("Create New Segment"); deleteSegment = new JButton("Delete Selected"); moveUp = new JButton("Move Segment Up"); moveDown = new JButton("Move Segment Down"); lockSelected = new JButton("Lock Selected"); unlockSelected = new JButton("Unlock Selected"); reAlign = new JButton("Realign"); reAlign.addActionListener(this); lockSelected.addActionListener(this); unlockSelected.addActionListener(this); mergeSource.addActionListener(this); mergeTarget.addActionListener(this); export.addActionListener(this); newSegment.addActionListener(this); deleteSegment.addActionListener(this); moveUp.addActionListener(this); moveDown.addActionListener(this); JPanel control = new JPanel(); JPanel manipulate = new JPanel(); control.add(moveUp); control.add(moveDown); control.add(mergeTarget); control.add(mergeSource); //control.add(export); control.add(newSegment); control.add(deleteSegment); manipulate.add(reAlign); manipulate.add(lockSelected); manipulate.add(unlockSelected); manipulate.add(export); edit.add(control, BorderLayout.PAGE_START); edit.add(manipulate, BorderLayout.PAGE_END); JScrollPane scr = new JScrollPane(table); // JTable rowTable = new FirstRowNumberTable(table); //scr.add(table); //scr.setRowHeaderView(rowTable); //scr.setCorner(JScrollPane.UPPER_LEFT_CORNER, rowTable.getTableHeader()); scr.repaint(); edit.add(scr, BorderLayout.CENTER); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); edit.setSize(screenSize.width - 4, screenSize.height - 50); int totwidth = screenSize.width - 50; table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); cmodel.getColumn(0).setPreferredWidth((totwidth / 36) * 15); cmodel.getColumn(1).setPreferredWidth((totwidth / 36) * 15); cmodel.getColumn(2).setPreferredWidth(totwidth / 36 * 2); cmodel.getColumn(3).setPreferredWidth(totwidth / 36 * 2); cmodel.getColumn(4).setPreferredWidth(totwidth / 36 * 2); cmodel.getColumn(4).setPreferredWidth(totwidth / 36 * 2); edit.validate(); // Make sure layout is ok //edit.setSize(1024,700); edit.setVisible(true); } else { //log.setCaretPosition(log.getDocument().getLength()); log.append("\nAutomatic alignment unsuccessful..check error logs"); } } else { log.append("Please enter valid two letter language codes"); } log.setCaretPosition(log.getDocument().getLength()); } }
From source file:net.technicpack.launcher.ui.LauncherFrame.java
private void initComponents() { BorderLayout layout = new BorderLayout(); setLayout(layout);//w ww . ja v a2 s.c o m ///////////////////////////////////////////////////////////// //HEADER ///////////////////////////////////////////////////////////// JPanel header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS)); header.setBackground(COLOR_BLUE); header.setForeground(COLOR_WHITE_TEXT); header.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); this.add(header, BorderLayout.PAGE_START); ImageIcon headerIcon = resources.getIcon("platform_icon_title.png"); JButton headerLabel = new JButton(headerIcon); headerLabel.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0)); headerLabel.setContentAreaFilled(false); headerLabel.setFocusPainted(false); headerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); headerLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DesktopUtils.browseUrl("http://beta.technicpack.net/"); } }); header.add(headerLabel); header.add(Box.createRigidArea(new Dimension(6, 0))); ActionListener tabListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectTab(e.getActionCommand()); } }; discoverTab = new HeaderTab(resources.getString("launcher.title.discover"), resources); header.add(discoverTab); discoverTab.setActionCommand(TAB_DISCOVER); discoverTab.addActionListener(tabListener); modpacksTab = new HeaderTab(resources.getString("launcher.title.modpacks"), resources); modpacksTab.setIsActive(true); modpacksTab.setHorizontalTextPosition(SwingConstants.LEADING); modpacksTab.addActionListener(tabListener); modpacksTab.setActionCommand(TAB_MODPACKS); header.add(modpacksTab); newsTab = new HeaderTab(resources.getString("launcher.title.news"), resources); newsTab.setLayout(null); newsTab.addActionListener(tabListener); newsTab.setActionCommand(TAB_NEWS); header.add(newsTab); CountCircle newsCircle = new CountCircle(); newsCircle.setBackground(COLOR_RED); newsCircle.setForeground(COLOR_WHITE_TEXT); newsCircle.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS_BOLD, 14)); newsTab.add(newsCircle); newsCircle.setBounds(10, 17, 25, 25); header.add(Box.createHorizontalGlue()); JPanel rightHeaderPanel = new JPanel(); rightHeaderPanel.setOpaque(false); rightHeaderPanel.setLayout(new BoxLayout(rightHeaderPanel, BoxLayout.PAGE_AXIS)); rightHeaderPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel windowGadgetPanel = new JPanel(); windowGadgetPanel.setOpaque(false); windowGadgetPanel.setLayout(new BoxLayout(windowGadgetPanel, BoxLayout.LINE_AXIS)); windowGadgetPanel.setAlignmentX(RIGHT_ALIGNMENT); ImageIcon minimizeIcon = resources.getIcon("minimize.png"); JButton minimizeButton = new JButton(minimizeIcon); minimizeButton.setBorder(BorderFactory.createEmptyBorder()); minimizeButton.setContentAreaFilled(false); minimizeButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); minimizeButton.setFocusable(false); minimizeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { minimizeWindow(); } }); windowGadgetPanel.add(minimizeButton); ImageIcon closeIcon = resources.getIcon("close.png"); JButton closeButton = new JButton(closeIcon); closeButton.setBorder(BorderFactory.createEmptyBorder()); closeButton.setContentAreaFilled(false); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeWindow(); } }); closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); closeButton.setFocusable(false); windowGadgetPanel.add(closeButton); rightHeaderPanel.add(windowGadgetPanel); rightHeaderPanel.add(Box.createVerticalGlue()); JButton launcherOptionsLabel = new JButton(resources.getString("launcher.title.options")); launcherOptionsLabel.setIcon(resources.getIcon("options_cog.png")); launcherOptionsLabel.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 14)); launcherOptionsLabel.setForeground(COLOR_WHITE_TEXT); launcherOptionsLabel.setHorizontalAlignment(SwingConstants.RIGHT); launcherOptionsLabel.setHorizontalTextPosition(SwingConstants.LEADING); launcherOptionsLabel.setAlignmentX(RIGHT_ALIGNMENT); launcherOptionsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); launcherOptionsLabel.setBorder(BorderFactory.createEmptyBorder()); launcherOptionsLabel.setContentAreaFilled(false); launcherOptionsLabel.setFocusPainted(false); launcherOptionsLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openLauncherOptions(); } }); rightHeaderPanel.add(launcherOptionsLabel); header.add(rightHeaderPanel); ///////////////////////////////////////////////////////////// // CENTRAL AREA ///////////////////////////////////////////////////////////// centralPanel = new TintablePanel(); centralPanel.setBackground(COLOR_CHARCOAL); centralPanel.setForeground(COLOR_WHITE_TEXT); centralPanel.setTintColor(COLOR_CENTRAL_BACK); this.add(centralPanel, BorderLayout.CENTER); centralPanel.setLayout(new BorderLayout()); modpackPanel = new ModpackInfoPanel(resources, iconRepo, logoRepo, backgroundRepo, avatarRepo, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openModpackOptions((ModpackModel) e.getSource()); } }, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { refreshModpackOptions((ModpackModel) e.getSource()); } }); modpackSelector.setInfoPanel(modpackPanel); playButton = modpackPanel.getPlayButton(); playButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof ModpackModel) { setupPlayButtonText((ModpackModel) e.getSource(), userModel.getCurrentUser()); } else if (installer.isCurrentlyRunning()) { installer.cancel(); setupPlayButtonText(modpackSelector.getSelectedPack(), userModel.getCurrentUser()); } else { launchModpack(); } } }); modpackPanel.getDeleteButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(LauncherFrame.this, resources.getString("modpackoptions.delete.confirmtext"), resources.getString("modpackoptions.delete.confirmtitle"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { modpackSelector.getSelectedPack().delete(); modpackSelector.forceRefresh(); } } }); infoSwap = new JPanel(); infoLayout = new CardLayout(); infoSwap.setLayout(infoLayout); infoSwap.setOpaque(false); newsInfoPanel = new NewsInfoPanel(resources, avatarRepo); infoSwap.add(discoverInfoPanel, "discover"); JPanel newsHost = new JPanel(); infoSwap.add(newsHost, "news"); JPanel modpackHost = new JPanel(); infoSwap.add(modpackHost, "modpacks"); centralPanel.add(infoSwap, BorderLayout.CENTER); newsSelector = new NewsSelector(resources, newsInfoPanel, platformApi, avatarRepo, newsCircle, settings); newsHost.setLayout(new BorderLayout()); newsHost.add(newsInfoPanel, BorderLayout.CENTER); newsHost.add(newsSelector, BorderLayout.WEST); modpackHost.setLayout(new BorderLayout()); modpackHost.add(modpackPanel, BorderLayout.CENTER); modpackHost.add(modpackSelector, BorderLayout.WEST); footer = new TintablePanel(); footer.setTintColor(COLOR_CENTRAL_BACK); footer.setBackground(COLOR_FOOTER); footer.setLayout(new BoxLayout(footer, BoxLayout.LINE_AXIS)); footer.setForeground(COLOR_WHITE_TEXT); footer.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 12)); userWidget = new UserWidget(resources, skinRepository); userWidget.setMaximumSize(userWidget.getPreferredSize()); footer.add(userWidget); JLabel dashText = new JLabel("| "); dashText.setForeground(LauncherFrame.COLOR_WHITE_TEXT); dashText.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15)); footer.add(dashText); JButton logout = new JButton(resources.getString("launcher.user.logout")); logout.setBorder(BorderFactory.createEmptyBorder()); logout.setContentAreaFilled(false); logout.setFocusable(false); logout.setForeground(LauncherFrame.COLOR_WHITE_TEXT); logout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); logout.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15)); logout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logout(); } }); footer.add(logout); installProgress = new ProgressBar(); installProgress.setForeground(Color.white); installProgress.setBackground(LauncherFrame.COLOR_GREEN); installProgress.setBorder(BorderFactory.createEmptyBorder(5, 45, 4, 45)); installProgress.setIcon(resources.getIcon("download_icon.png")); installProgress.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 12)); installProgress.setVisible(false); footer.add(installProgress); installProgressPlaceholder = Box.createHorizontalGlue(); footer.add(installProgressPlaceholder); JLabel buildCtrl = new JLabel(resources.getString("launcher.build.text", resources.getLauncherBuild(), resources.getString("launcher.build." + settings.getBuildStream()))); buildCtrl.setForeground(COLOR_WHITE_TEXT); buildCtrl.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14)); buildCtrl.setHorizontalTextPosition(SwingConstants.RIGHT); buildCtrl.setHorizontalAlignment(SwingConstants.RIGHT); footer.add(buildCtrl); this.add(footer, BorderLayout.PAGE_END); }
From source file:com.xilinx.virtex7.MainScreen.java
private Container createContentPane() { JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.setOpaque(true);//ww w . jav a2 s.c om mainPanel = new JPanel(new BorderLayout()); mainPanel.setBounds(0, 0, minWidth, minHeight); testPanel = new JPanel(new BorderLayout()); ttabs = new JTabbedPane(); ttabs.add("DATAPATH 0&1", testAndStats()); if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV || mode == LandingPage.APPLICATION_MODE || mode == LandingPage.APPLICATION_MODE_P2P) // condition for placing dynamic tabs. a kcah ttabs.add("DATAPATH 2&3", testAndStatsSecondTab()); else testAndStatsSecondTab(); testPanel.add(ttabs, BorderLayout.CENTER); testPanel.add(messageBox(), BorderLayout.PAGE_END); mainPanel.add(testPanel, BorderLayout.LINE_START); //Make the center component big, since that's the //typical usage of BorderLayout. tabs = new JTabbedPane(); mainPanel.add(tabs, BorderLayout.CENTER); tabs.add("System Monitor", pciInfo()); tabs.add("Performance Plots", plotPanel()); mainPanel.setOpaque(true); try { imagePanel = new ImageBackgroundPanel(blockDiagram, false); } catch (Exception e) { } /*imagePanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Design Block Diagram"), BorderFactory.createEmptyBorder(5,5,5,5)));*/ imagePanel.setBackground(Color.WHITE); imagePanel.setSize(minWidth, minHeight); imagePanel.setLocation(0, 0); imagePanel.setOpaque(true); final JLayeredPane layeredPane = new JLayeredPane(); layeredPane.setPreferredSize(new Dimension(minWidth, minHeight)); layeredPane.add(mainPanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.add(imagePanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent ce) { mainPanel.setBounds(0, 0, Math.max(minWidth, layeredPane.getWidth()), Math.max(minHeight, layeredPane.getHeight())); if (layeredPane.getWidth() > 1024) { tplotPanel.setPreferredSize(new Dimension(300, 100)); } else { tplotPanel.setPreferredSize(new Dimension(200, 100)); } imagePanel.setSize(mainPanel.getWidth(), mainPanel.getHeight()); imagePanel.setLocation(0, 0); mainPanel.repaint(); } @Override public void componentMoved(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentShown(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentHidden(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } }); // on top, but invisible initially imagePanel.setVisible(false); JPanel bpanel = new JPanel(new BorderLayout()); final JButton button = new JButton( "<html><b>B<br>L<br>O<br>C<br>K<br> <br>D<br>I<br>A<br>G<br>R<br>A<br>M<br></b></html>"); button.setToolTipText("Click here to see the block diagram"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { adjustSelectionPanel(); } }); bpanel.add(button, BorderLayout.CENTER); contentPane.add(layeredPane, BorderLayout.CENTER); contentPane.add(button, BorderLayout.EAST); JPanel panel = new JPanel(new BorderLayout()); JLabel mLabel = new JLabel(modeText, JLabel.CENTER); mLabel.setFont(new Font(modeText, Font.BOLD, 15)); panel.add(mLabel, BorderLayout.PAGE_START); JPanel ledPanel = new JPanel(new BorderLayout()); JPanel iledPanel = new JPanel(); iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS)); led_ddr3_1 = new JLabel("DDR3 0", new ImageIcon(led1), JLabel.CENTER); led_ddr3_2 = new JLabel("DDR3 1", new ImageIcon(led1), JLabel.CENTER); led_phy0 = new JLabel("PHY 0", new ImageIcon(led1), JLabel.CENTER); led_phy1 = new JLabel("PHY 1", new ImageIcon(led1), JLabel.CENTER); led_phy2 = new JLabel("PHY 2", new ImageIcon(led1), JLabel.CENTER); led_phy3 = new JLabel("PHY 3", new ImageIcon(led1), JLabel.CENTER); JPanel le1 = new JPanel(new BorderLayout()); le1.add(led_ddr3_1, BorderLayout.CENTER); JPanel le2 = new JPanel(new BorderLayout()); le2.add(led_ddr3_2, BorderLayout.CENTER); JPanel le3 = new JPanel(new BorderLayout()); le3.add(led_phy0, BorderLayout.CENTER); JPanel le4 = new JPanel(new BorderLayout()); le4.add(led_phy1, BorderLayout.CENTER); JPanel le5 = new JPanel(new BorderLayout()); le5.add(led_phy2, BorderLayout.CENTER); JPanel le6 = new JPanel(new BorderLayout()); le6.add(led_phy3, BorderLayout.CENTER); iledPanel.add(le1); iledPanel.add(le2); iledPanel.add(le3); iledPanel.add(le4); iledPanel.add(le5); iledPanel.add(le6); if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) { startAll_tooltip = "This will start tests on all data paths"; startAlltests = new JButton("Start All"); startAlltests.setToolTipText(startAll_tooltip); startAlltests.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (startAlltests.getText().equals("Start All")) { startAll_tooltip = "This will stop tests on all data paths"; startAlltests.setToolTipText(startAll_tooltip); // check whether any tests are already started String message = ""; if (testStarted || testStarted1) message = "Test(s) on Path 0&1 are running. Cannot do Start All"; if (testStarted2 || testStarted3) { if (message.length() > 0) // test 1 and 0 are also running message = "Test(s) on Path 0&1 and 2&3 are running. Cannot do Start All"; else message = "Test(s) on Path 2&3 are running. Cannot do Start All"; } if (message.length() > 0) { JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); } else { String ledsMsg = checkLedsState(); // condition to check the ddr and py leds are enable or not if (ledsMsg.length() == 0) { startAlltests.setEnabled(false); startAlltests.setText("Stop All"); startTest.doClick(); stest.doClick(); s3test.doClick(); s4test.doClick(); // disable all buttons startTest.setEnabled(false); stest.setEnabled(false); s3test.setEnabled(false); s4test.setEnabled(false); startAlltests.setEnabled(true); } else {// shows alert when leds are disabled JOptionPane.showMessageDialog(null, ledsMsg, "Error", JOptionPane.ERROR_MESSAGE); } } } else { startAlltests.setEnabled(false); startAll_tooltip = "This will start tests on all data paths"; startAlltests.setToolTipText(startAll_tooltip); /* startTest.setEnabled(true); stest.setEnabled(true); s3test.setEnabled(true); s4test.setEnabled(true); s3test.doClick(); s4test.doClick(); startTest.doClick(); stest.doClick(); */ SwingWorker worker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { try { stopTest4(); s4test.setEnabled(false); stopTest3(); s3test.setEnabled(false); stopTest2(); stest.setEnabled(false); stopTest1(); startTest.setEnabled(false); startAlltests.setText("Start All"); startAlltests.setEnabled(true); startTest.setEnabled(true); stest.setEnabled(true); s3test.setEnabled(true); s4test.setEnabled(true); } catch (Exception e) { e.printStackTrace(); } return null; } }; worker.execute(); } } }); iledPanel.add(startAlltests); } ledPanel.add(iledPanel, BorderLayout.CENTER); //tstats.add(ledPanel); panel.add(ledPanel, BorderLayout.CENTER); contentPane.add(panel, BorderLayout.PAGE_START); return contentPane; }
From source file:org.broad.igv.hic.MainWindow.java
private void initComponents() { JPanel mainPanel = new JPanel(); JPanel toolbarPanel = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); toolbarPanel.setBorder(null);//w w w . j ava 2s . c om toolbarPanel.setLayout(new GridLayout()); JPanel chrSelectionPanel = new JPanel(); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setMinimumSize(new Dimension(130, 57)); chrSelectionPanel.setPreferredSize(new Dimension(130, 57)); chrSelectionPanel.setLayout(new BorderLayout()); JPanel panel10 = new JPanel(); panel10.setBackground(new Color(204, 204, 204)); panel10.setLayout(new BorderLayout()); JLabel label3 = new JLabel(); label3.setText("Chromosomes"); label3.setHorizontalAlignment(SwingConstants.CENTER); panel10.add(label3, BorderLayout.CENTER); chrSelectionPanel.add(panel10, BorderLayout.PAGE_START); JPanel panel9 = new JPanel(); panel9.setBackground(new Color(238, 238, 238)); panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS)); //---- chrBox1 ---- chrBox1 = new JComboBox(); chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); panel9.add(chrBox1); //---- chrBox2 ---- chrBox2 = new JComboBox(); chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); panel9.add(chrBox2); //---- refreshButton ---- JideButton refreshButton = new JideButton(); refreshButton .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshButtonActionPerformed(e); } }); panel9.add(refreshButton); chrSelectionPanel.add(panel9, BorderLayout.CENTER); toolbarPanel.add(chrSelectionPanel); //======== displayOptionPanel ======== JPanel displayOptionPanel = new JPanel(); JPanel panel1 = new JPanel(); displayOptionComboBox = new JComboBox(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); //======== panel14 ======== JPanel panel14 = new JPanel(); panel14.setBackground(new Color(204, 204, 204)); panel14.setLayout(new BorderLayout()); //---- label4 ---- JLabel label4 = new JLabel(); label4.setText("Show"); label4.setHorizontalAlignment(SwingConstants.CENTER); panel14.add(label4, BorderLayout.CENTER); displayOptionPanel.add(panel14, BorderLayout.PAGE_START); //======== panel1 ======== panel1.setBorder(new EmptyBorder(0, 10, 0, 10)); panel1.setLayout(new GridLayout(1, 0, 20, 0)); //---- comboBox1 ---- displayOptionComboBox .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() })); displayOptionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayOptionComboBoxActionPerformed(e); } }); panel1.add(displayOptionComboBox); displayOptionPanel.add(panel1, BorderLayout.CENTER); toolbarPanel.add(displayOptionPanel); //======== colorRangePanel ======== JPanel colorRangePanel = new JPanel(); JLabel colorRangeLabel = new JLabel(); colorRangeSlider = new RangeSlider(); colorRangePanel.setBorder(LineBorder.createGrayLineBorder()); colorRangePanel.setMinimumSize(new Dimension(96, 70)); colorRangePanel.setPreferredSize(new Dimension(202, 70)); colorRangePanel.setMaximumSize(new Dimension(32769, 70)); colorRangePanel.setLayout(new BorderLayout()); //======== panel11 ======== JPanel colorLabelPanel = new JPanel(); colorLabelPanel.setBackground(new Color(204, 204, 204)); colorLabelPanel.setLayout(new BorderLayout()); //---- colorRangeLabel ---- colorRangeLabel.setText("Color Range"); colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER); colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared."); colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER); colorRangeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } } @Override public void mouseClicked(MouseEvent e) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } }); colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER); colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START); //---- colorRangeSlider ---- colorRangeSlider.setPaintTicks(true); colorRangeSlider.setPaintLabels(true); colorRangeSlider.setLowerValue(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setMaximumSize(new Dimension(32767, 52)); colorRangeSlider.setPreferredSize(new Dimension(200, 52)); colorRangeSlider.setMinimumSize(new Dimension(36, 52)); colorRangeSlider.setMaximum(2000); colorRangeSlider.setUpperValue(500); colorRangeSlider.setMinorTickSpacing(100); colorRangeSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorRangeSliderStateChanged(e); } }); colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END); // JPanel colorRangeTextPanel = new JPanel(); // colorRangeTextPanel.setLayout(new FlowLayout()); // JTextField minField = new JTextField(); // minField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(minField); // colorRangeTextPanel.add(new JLabel(" - ")); // JTextField maxField = new JTextField(); // maxField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(maxField); // colorRangeTextPanel.setPreferredSize(new Dimension(200, 52)); // colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END); toolbarPanel.add(colorRangePanel); //======== resolutionPanel ======== JLabel resolutionLabel = new JLabel(); JPanel resolutionPanel = new JPanel(); resolutionPanel.setBorder(LineBorder.createGrayLineBorder()); resolutionPanel.setLayout(new BorderLayout()); //======== panel12 ======== JPanel panel12 = new JPanel(); panel12.setBackground(new Color(204, 204, 204)); panel12.setLayout(new BorderLayout()); //---- resolutionLabel ---- resolutionLabel.setText("Resolution"); resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER); resolutionLabel.setBackground(new Color(204, 204, 204)); panel12.add(resolutionLabel, BorderLayout.CENTER); resolutionPanel.add(panel12, BorderLayout.PAGE_START); //======== panel2 ======== JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- resolutionSlider ---- resolutionSlider = new JSlider(); resolutionSlider.setMaximum(8); resolutionSlider.setMajorTickSpacing(1); resolutionSlider.setPaintTicks(true); resolutionSlider.setSnapToTicks(true); resolutionSlider.setPaintLabels(true); resolutionSlider.setMinorTickSpacing(1); Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>(); Font f = FontManager.getFont(8); for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) { if ((i + 1) % 2 == 0) { final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]); tickLabel.setFont(f); resolutionLabels.put(i, tickLabel); } } resolutionSlider.setLabelTable(resolutionLabels); // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice. resolutionSlider.addChangeListener(new ChangeListener() { // Change zoom level while staying centered on current location. // Centering is relative to the bounds of the data, which might not be the bounds of the window public void stateChanged(ChangeEvent e) { if (!resolutionSlider.getValueIsAdjusting()) { int idx = resolutionSlider.getValue(); idx = Math.max(0, Math.min(idx, MAX_ZOOM)); if (hic.zd != null && idx == hic.zd.getZoom()) { // Nothing to do return; } if (hic.xContext != null) { int centerLocationX = (int) hic.xContext .getChromosomePosition(getHeatmapPanel().getWidth() / 2); int centerLocationY = (int) hic.yContext .getChromosomePosition(getHeatmapPanel().getHeight() / 2); hic.setZoom(idx, centerLocationX, centerLocationY, false); } //zoomInButton.setEnabled(newZoom < MAX_ZOOM); //zoomOutButton.setEnabled(newZoom > 0); } } }); panel2.add(resolutionSlider); resolutionPanel.add(panel2, BorderLayout.CENTER); toolbarPanel.add(resolutionPanel); mainPanel.add(toolbarPanel, BorderLayout.NORTH); //======== hiCPanel ======== final JPanel hiCPanel = new JPanel(); hiCPanel.setLayout(new HiCLayout()); //---- rulerPanel2 ---- rulerPanel2 = new HiCRulerPanel(hic); rulerPanel2.setMaximumSize(new Dimension(4000, 50)); rulerPanel2.setMinimumSize(new Dimension(1, 50)); rulerPanel2.setPreferredSize(new Dimension(1, 50)); rulerPanel2.setBorder(null); JPanel panel2_5 = new JPanel(); panel2_5.setLayout(new BorderLayout()); panel2_5.add(rulerPanel2, BorderLayout.SOUTH); trackPanel = new TrackPanel(hic); trackPanel.setMaximumSize(new Dimension(4000, 50)); trackPanel.setPreferredSize(new Dimension(1, 50)); trackPanel.setMinimumSize(new Dimension(1, 50)); trackPanel.setBorder(null); // trackPanelScrollpane = new JScrollPane(); // trackPanelScrollpane.getViewport().add(trackPanel); // trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); // trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237)); // trackPanelScrollpane.setVisible(false); // panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH); // trackPanel.setVisible(false); panel2_5.add(trackPanel, BorderLayout.NORTH); hiCPanel.add(panel2_5, BorderLayout.NORTH); //---- rulerPanel1 ---- rulerPanel1 = new HiCRulerPanel(hic); rulerPanel1.setMaximumSize(new Dimension(50, 4000)); rulerPanel1.setPreferredSize(new Dimension(50, 500)); rulerPanel1.setBorder(null); rulerPanel1.setMinimumSize(new Dimension(50, 1)); hiCPanel.add(rulerPanel1, BorderLayout.WEST); //---- heatmapPanel ---- heatmapPanel = new HeatmapPanel(this, hic); heatmapPanel.setBorder(LineBorder.createBlackLineBorder()); heatmapPanel.setMaximumSize(new Dimension(500, 500)); heatmapPanel.setMinimumSize(new Dimension(500, 500)); heatmapPanel.setPreferredSize(new Dimension(500, 500)); heatmapPanel.setBackground(new Color(238, 238, 238)); hiCPanel.add(heatmapPanel, BorderLayout.CENTER); //======== panel8 ======== JPanel rightSidePanel = new JPanel(); rightSidePanel.setMaximumSize(new Dimension(120, 100)); rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0)); rightSidePanel.setLayout(null); //---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(this, hic); thumbnailPanel.setMaximumSize(new Dimension(100, 100)); thumbnailPanel.setMinimumSize(new Dimension(100, 100)); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBorder(LineBorder.createBlackLineBorder()); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize())); rightSidePanel.add(thumbnailPanel); //======== xPlotPanel ======== xPlotPanel = new JPanel(); xPlotPanel.setPreferredSize(new Dimension(250, 100)); xPlotPanel.setLayout(null); rightSidePanel.add(xPlotPanel); xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228); //======== yPlotPanel ======== yPlotPanel = new JPanel(); yPlotPanel.setPreferredSize(new Dimension(250, 100)); yPlotPanel.setLayout(null); rightSidePanel.add(yPlotPanel); yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); hiCPanel.add(rightSidePanel, BorderLayout.EAST); mainPanel.add(hiCPanel, BorderLayout.CENTER); contentPane.add(mainPanel, BorderLayout.CENTER); JMenuBar menuBar = createMenuBar(hiCPanel); contentPane.add(menuBar, BorderLayout.NORTH); // setup the glass pane to display a wait cursor when visible, and to grab all mouse events rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rootPane.getGlassPane().addMouseListener(new MouseAdapter() { }); }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this * method is always regenerated by the Form Editor. *//* ww w . j a v a 2 s .co m*/ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jSelectionTreePanel = new org.jdesktop.swingx.JXPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jSelectionTree = new org.jdesktop.swingx.JXTree(); infoPanel = new org.jdesktop.swingx.JXCollapsiblePane(); jXInfoLabel = new org.jdesktop.swingx.JXLabel(); jRegionSelectDialog = new javax.swing.JDialog(); jLabel1 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jPerformSelection = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jStartX = new javax.swing.JSpinner(); jStartY = new javax.swing.JSpinner(); jLabel8 = new javax.swing.JLabel(); jEndX = new javax.swing.JSpinner(); jLabel9 = new javax.swing.JLabel(); jEndY = new javax.swing.JSpinner(); jCustomPointsPanel = new javax.swing.JPanel(); jCustomPointsField = new org.jdesktop.swingx.JXTextField(); jApplyCustomFilter = new javax.swing.JButton(); jAlwaysOnTopBox = new javax.swing.JCheckBox(); jSelectionPanel = new javax.swing.JPanel(); capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jSelectionTreePanel.setPreferredSize(new java.awt.Dimension(600, 400)); jSelectionTreePanel.setLayout(new java.awt.BorderLayout()); jScrollPane1.setViewportView(jSelectionTree); jSelectionTreePanel.add(jScrollPane1, java.awt.BorderLayout.CENTER); infoPanel.setCollapsed(true); infoPanel.setInheritAlpha(false); jXInfoLabel.setText("Keine Meldung"); jXInfoLabel.setOpaque(true); jXInfoLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { jXInfoLabelfireHideInfoEvent(evt); } }); infoPanel.add(jXInfoLabel, java.awt.BorderLayout.CENTER); jSelectionTreePanel.add(infoPanel, java.awt.BorderLayout.SOUTH); jLabel1.setText("Start"); jLabel7.setText("Ende"); jPerformSelection.setText("Auswhlen"); jPerformSelection.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { firePerformRegionSelectionEvent(evt); } }); jButton3.setText("Abbrechen"); jButton3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { firePerformRegionSelectionEvent(evt); } }); jStartX.setModel(new javax.swing.SpinnerNumberModel(0, 0, 999, 1)); jStartX.setMinimumSize(new java.awt.Dimension(80, 25)); jStartX.setPreferredSize(new java.awt.Dimension(80, 25)); jStartY.setModel(new javax.swing.SpinnerNumberModel(0, 0, 999, 1)); jStartY.setMinimumSize(new java.awt.Dimension(80, 25)); jStartY.setPreferredSize(new java.awt.Dimension(80, 25)); jLabel8.setText("|"); jEndX.setModel(new javax.swing.SpinnerNumberModel(0, 0, 999, 1)); jEndX.setMinimumSize(new java.awt.Dimension(80, 25)); jEndX.setPreferredSize(new java.awt.Dimension(80, 25)); jLabel9.setText("|"); jEndY.setModel(new javax.swing.SpinnerNumberModel(0, 0, 999, 1)); jEndY.setMinimumSize(new java.awt.Dimension(80, 25)); jEndY.setPreferredSize(new java.awt.Dimension(80, 25)); javax.swing.GroupLayout jRegionSelectDialogLayout = new javax.swing.GroupLayout( jRegionSelectDialog.getContentPane()); jRegionSelectDialog.getContentPane().setLayout(jRegionSelectDialogLayout); jRegionSelectDialogLayout.setHorizontalGroup(jRegionSelectDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jRegionSelectDialogLayout.createSequentialGroup().addContainerGap() .addGroup(jRegionSelectDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jRegionSelectDialogLayout.createSequentialGroup().addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jStartX, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jStartY, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jRegionSelectDialogLayout.createSequentialGroup().addComponent(jButton3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPerformSelection)) .addGroup(jRegionSelectDialogLayout.createSequentialGroup().addComponent(jLabel7) .addGap(18, 18, 18) .addComponent(jEndX, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jEndY, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE))) .addContainerGap())); jRegionSelectDialogLayout.setVerticalGroup( jRegionSelectDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jRegionSelectDialogLayout.createSequentialGroup().addContainerGap() .addGroup(jRegionSelectDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jStartX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jStartY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jRegionSelectDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jEndX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jEndY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jRegionSelectDialogLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jPerformSelection).addComponent(jButton3)) .addContainerGap())); jCustomPointsPanel.setMaximumSize(new java.awt.Dimension(100, 50)); jCustomPointsPanel.setMinimumSize(new java.awt.Dimension(100, 50)); jCustomPointsPanel.setPreferredSize(new java.awt.Dimension(100, 50)); jCustomPointsPanel.setLayout(new java.awt.BorderLayout()); jCustomPointsField.setToolTipText("Punktezahl manuell angeben"); jCustomPointsField.setMaximumSize(new java.awt.Dimension(30, 30)); jCustomPointsField.setMinimumSize(new java.awt.Dimension(30, 30)); jCustomPointsField.setPreferredSize(new java.awt.Dimension(30, 30)); jCustomPointsField.setPrompt("Punkte"); jCustomPointsPanel.add(jCustomPointsField, java.awt.BorderLayout.CENTER); jApplyCustomFilter.setText("Auswhlen"); jApplyCustomFilter.setToolTipText("Drfer mit weniger als den angegebenen Punkte whlen"); jApplyCustomFilter.setMaximumSize(new java.awt.Dimension(30, 20)); jApplyCustomFilter.setMinimumSize(new java.awt.Dimension(30, 20)); jApplyCustomFilter.setPreferredSize(new java.awt.Dimension(30, 20)); jCustomPointsPanel.add(jApplyCustomFilter, java.awt.BorderLayout.PAGE_END); setTitle("Auswahl"); setMinimumSize(new java.awt.Dimension(500, 400)); getContentPane().setLayout(new java.awt.GridBagLayout()); jAlwaysOnTopBox.setText("Immer im Vordergrund"); jAlwaysOnTopBox.setOpaque(false); jAlwaysOnTopBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireAlwaysOnTopChangedEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jAlwaysOnTopBox, gridBagConstraints); jSelectionPanel.setBackground(new java.awt.Color(239, 235, 223)); jSelectionPanel.setMinimumSize(new java.awt.Dimension(300, 100)); jSelectionPanel.setPreferredSize(new java.awt.Dimension(600, 400)); jSelectionPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(jSelectionPanel, gridBagConstraints); capabilityInfoPanel1.setSearchable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(capabilityInfoPanel1, gridBagConstraints); pack(); }
From source file:game.Clue.ClueGameUI.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w ww . j a va 2 s . com */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup2 = new javax.swing.ButtonGroup(); jPanel3 = new javax.swing.JPanel(); LoginPanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jToggleButton3 = new javax.swing.JToggleButton(); jLabel12 = new javax.swing.JLabel(); jProgressBar1 = new javax.swing.JProgressBar(); CharacterSelectionPanel = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jToggleButton4 = new javax.swing.JToggleButton(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jRadioButton3 = new javax.swing.JRadioButton(); jRadioButton4 = new javax.swing.JRadioButton(); jRadioButton5 = new javax.swing.JRadioButton(); jRadioButton6 = new javax.swing.JRadioButton(); jPanel2 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jScrollPane3 = new javax.swing.JScrollPane(); jTable3 = new javax.swing.JTable(); jLabel10 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jPanel5 = new javax.swing.JPanel(); jLayeredPane5 = new javax.swing.JLayeredPane(); jButton2 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jToggleButton2 = new javax.swing.JToggleButton(); jButton6 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jToggleButton1 = new javax.swing.JToggleButton(); jLabel11 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jScrollPane4 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Clueless"); setBackground(new java.awt.Color(0, 0, 0)); setMaximumSize(new java.awt.Dimension(2147483647, 400)); setResizable(false); jPanel3.setMaximumSize(new java.awt.Dimension(2147483647, 400)); jPanel3.setLayout(new java.awt.CardLayout()); LoginPanel.setBackground(new java.awt.Color(51, 51, 51)); LoginPanel.setForeground(new java.awt.Color(255, 153, 153)); LoginPanel.setMaximumSize(new java.awt.Dimension(32767, 400)); LoginPanel.setPreferredSize(new java.awt.Dimension(729, 670)); LoginPanel.setLayout(null); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Name:"); LoginPanel.add(jLabel1); jLabel1.setBounds(20, 580, 35, 14); jTextField2.setMaximumSize(new java.awt.Dimension(6, 20)); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); LoginPanel.add(jTextField2); jTextField2.setBounds(90, 570, 110, 30); jToggleButton3.setText("Start/Join a game"); jToggleButton3.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton3ItemStateChanged(evt); } }); jToggleButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton3ActionPerformed(evt); } }); LoginPanel.add(jToggleButton3); jToggleButton3.setBounds(40, 610, 130, 23); jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/logo-login3.jpg"))); // NOI18N jLabel12.setText("jLabel12"); jLabel12.setMaximumSize(new java.awt.Dimension(729, 670)); jLabel12.setMinimumSize(new java.awt.Dimension(729, 670)); jLabel12.setPreferredSize(new java.awt.Dimension(729, 670)); LoginPanel.add(jLabel12); jLabel12.setBounds(0, 0, 729, 670); LoginPanel.add(jProgressBar1); jProgressBar1.setBounds(40, 640, 146, 14); jPanel3.add(LoginPanel, "card4"); CharacterSelectionPanel.setBackground(new java.awt.Color(102, 153, 255)); CharacterSelectionPanel.setMaximumSize(new java.awt.Dimension(32767, 400)); CharacterSelectionPanel.setPreferredSize(new java.awt.Dimension(729, 670)); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N jLabel3.setPreferredSize(new java.awt.Dimension(175, 233)); buttonGroup2.add(jToggleButton4); jToggleButton4.setText("Next"); jToggleButton4.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton4ItemStateChanged(evt); } }); jToggleButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton4ActionPerformed(evt); } }); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("Character Selection"); jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MissScarlett.png"))); // NOI18N jLabel5.setToolTipText(""); jLabel5.setPreferredSize(new java.awt.Dimension(175, 233)); jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel6.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrGreen.png"))); // NOI18N jLabel6.setPreferredSize(new java.awt.Dimension(175, 233)); jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel7.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsPeacock.png"))); // NOI18N jLabel7.setPreferredSize(new java.awt.Dimension(175, 233)); jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel8.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsWhite.png"))); // NOI18N jLabel8.setPreferredSize(new java.awt.Dimension(175, 233)); jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel9.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ProfessorPlum.png"))); // NOI18N jLabel9.setPreferredSize(new java.awt.Dimension(175, 233)); buttonGroup2.add(jRadioButton1); buttonGroup2.add(jRadioButton2); buttonGroup2.add(jRadioButton3); jRadioButton3.setToolTipText(""); buttonGroup2.add(jRadioButton4); buttonGroup2.add(jRadioButton5); buttonGroup2.add(jRadioButton6); javax.swing.GroupLayout CharacterSelectionPanelLayout = new javax.swing.GroupLayout( CharacterSelectionPanel); CharacterSelectionPanel.setLayout(CharacterSelectionPanelLayout); CharacterSelectionPanelLayout.setHorizontalGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout .createSequentialGroup().addGap(47, 47, 47) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31).addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(85, 85, 85)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup().addGap(131, 131, 131) .addComponent(jRadioButton1).addGap(170, 170, 170).addComponent(jRadioButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jRadioButton3).addGap(162, 162, 162)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout .createSequentialGroup().addGap(131, 131, 131).addComponent(jRadioButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jRadioButton5).addGap(169, 169, 169).addComponent(jRadioButton6) .addGap(171, 171, 171)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addGap(158, 158, 158).addComponent(jLabel4)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addGap(329, 329, 329).addComponent(jToggleButton4))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); CharacterSelectionPanelLayout.setVerticalGroup( CharacterSelectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addGap(5, 5, 5).addComponent(jRadioButton1)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addGap(7, 7, 7).addComponent(jRadioButton2)) .addGroup(CharacterSelectionPanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jRadioButton3))) .addGap(18, 18, 18) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(CharacterSelectionPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jRadioButton6).addComponent(jRadioButton5) .addComponent(jRadioButton4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jToggleButton4).addContainerGap(25, Short.MAX_VALUE))); jPanel3.add(CharacterSelectionPanel, "card5"); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setMaximumSize(new java.awt.Dimension(720, 400)); jPanel2.setPreferredSize(new java.awt.Dimension(729, 670)); jPanel4.setBackground(new java.awt.Color(204, 102, 0)); jTable1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { "Mrs.White", null }, { "Mr. Plum", null }, { "Miss Scarlet", null }, { "Mr. Green", null }, { "Mrs.Peacock", null }, { "Col. Mustard", null } }, new String[] { "SUSPECTS", "" }) { boolean[] canEdit = new boolean[] { false, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jScrollPane1.setViewportView(jTable1); jTable3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jTable3.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { { "Hall", null }, { "Lounge", null }, { "Library", null }, { "Kitchen", null }, { "Dining Room", null }, { "Billiard Room", null }, { "Study", null }, { "Ballroom", null }, { "Conservatory", null } }, new String[] { "ROOMS", "P1" })); jScrollPane3.setViewportView(jTable3); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel10.setText("Scorecard"); jTable2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { "CandleStick", null }, { "Knife", null }, { "LeadPipe", null }, { "Revolver", null }, { "Rope", null }, { "Wrench", null } }, new String[] { "WEAPONS", "" }) { boolean[] canEdit = new boolean[] { false, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jScrollPane2.setViewportView(jTable2); jPanel5.setBackground(new java.awt.Color(51, 51, 51)); javax.swing.GroupLayout jLayeredPane5Layout = new javax.swing.GroupLayout(jLayeredPane5); jLayeredPane5.setLayout(jLayeredPane5Layout); jLayeredPane5Layout.setHorizontalGroup(jLayeredPane5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 701, Short.MAX_VALUE)); jLayeredPane5Layout.setVerticalGroup(jLayeredPane5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap() .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel5Layout .createSequentialGroup().addGap(22, 22, 22).addComponent(jLayeredPane5).addContainerGap())); jLayeredPane5.addMouseListener(this); jLayeredPane5.addMouseMotionListener(this); jLayeredPane5.add(player, JLayeredPane.DRAG_LAYER); jButton2.setText("Make Accusation"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton4.setText("(unused) jButton4"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton5.setText("Make A Suggestion"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Ballroom.PNG"))); // NOI18N jLabel2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel2MouseClicked(evt); } }); jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Candlestick.PNG"))); // NOI18N jLabel15.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel15MouseClicked(evt); } }); jLabel16.setIcon( new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N jLabel16.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel16MouseClicked(evt); } }); jToggleButton2.setText("jToggleButton2"); jToggleButton2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton2ItemStateChanged(evt); } }); jToggleButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton2ActionPerformed(evt); } }); jButton6.setText("Move"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout .createSequentialGroup().addGap(25, 25, 25) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton2) .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jToggleButton2).addComponent(jButton4) .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel4Layout.createSequentialGroup().addGap(21, 21, 21).addComponent(jLabel10))) .addGap(11, 11, 11) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel15).addComponent(jLabel2).addComponent(jLabel16)) .addContainerGap(3138, Short.MAX_VALUE))); jPanel4Layout .setVerticalGroup(jPanel4Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(23, 23, 23).addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(37, 37, 37).addComponent(jToggleButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton6).addGap(3, 3, 3)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addGap(59, 59, 59).addComponent(jLabel2) .addGap(58, 58, 58).addComponent(jLabel15).addGap(18, 18, 18) .addComponent(jLabel16) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); jPanel2Layout .setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jPanel3.add(jPanel2, "card3"); jPanel1.setMaximumSize(new java.awt.Dimension(32767, 400)); jPanel1.setPreferredSize(new java.awt.Dimension(729, 670)); jButton1.setText("Connect to Server"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton3.setText("Send Message to Server"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jToggleButton1.setText("Go To Gameboard"); jToggleButton1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton1ItemStateChanged(evt); } }); jToggleButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton1ActionPerformed(evt); } }); jLabel11.setText("Technical Page for Server Communication..Wont be used in Game"); jTextField3.setText("192.168.1.8"); jLabel13.setText("IP address:"); jLabel14.setText("Port:"); jTextField4.setText("8888"); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane4.setViewportView(jTextArea1); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(180, 180, 180).addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jToggleButton1).addComponent(jLabel11) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jButton1) .addGap(42, 42, 42) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel13).addComponent(jLabel14)) .addGap(18, 18, 18) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup().addGap(50, 50, 50).addComponent( jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel1Layout.createSequentialGroup().addGap(247, 247, 247) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton3).addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(211, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(25, 25, 25).addComponent(jLabel11) .addGap(101, 101, 101) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel14) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(8, 8, 8).addComponent(jToggleButton1).addGap(41, 41, 41) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton3).addContainerGap(190, Short.MAX_VALUE))); jPanel3.add(jPanel1, "card2"); getContentPane().add(jPanel3, java.awt.BorderLayout.PAGE_END); pack(); }
From source file:de.bwravencl.controllerbuddy.gui.Main.java
private void initOverlay() { if (!preferences.getBoolean(PREFERENCES_SHOW_OVERLAY, Toolkit.getDefaultToolkit().isAlwaysOnTopSupported())) return;// ww w .ja v a2 s. c o m var longestDescription = ""; for (final var mode : input.getProfile().getModes()) { final var description = mode.getDescription(); if (description.length() > longestDescription.length()) longestDescription = description; } final var fontMetrics = labelCurrentMode.getFontMetrics(labelCurrentMode.getFont()); labelCurrentMode.setPreferredSize( new Dimension(fontMetrics.stringWidth(longestDescription), fontMetrics.getHeight())); labelCurrentMode.setForeground(Color.RED); labelCurrentMode.setText(input.getProfile().getActiveMode().getDescription()); overlayFrame = new JFrame("Overlay"); overlayFrame.setType(JFrame.Type.UTILITY); overlayFrame.setLayout(new BorderLayout()); overlayFrame.setFocusableWindowState(false); overlayFrame.setUndecorated(true); overlayFrame.setBackground(TRANSPARENT); overlayFrame.add(labelCurrentMode, BorderLayout.PAGE_END); overlayFrame.setAlwaysOnTop(true); indicatorPanelFlowLayout = new FlowLayout(); indicatorPanel = new JPanel(indicatorPanelFlowLayout); indicatorPanel.setBackground(TRANSPARENT); final var virtualAxisToOverlayAxisMap = input.getProfile().getVirtualAxisToOverlayAxisMap(); for (final var virtualAxis : Input.VirtualAxis.values()) { final var overlayAxis = virtualAxisToOverlayAxisMap.get(virtualAxis); if (overlayAxis != null) { final var progressBar = new JProgressBar(SwingConstants.VERTICAL) { private static final long serialVersionUID = 8167193907929992395L; @Override public void setMaximum(final int n) { if (overlayAxis.inverted) super.setMinimum(-n); else super.setMaximum(n); } @Override public void setMinimum(final int n) { if (overlayAxis.inverted) super.setMaximum(-n); else super.setMinimum(n); } @Override public void setValue(final int n) { super.setValue(overlayAxis.inverted ? -n : n); } }; progressBar.setPreferredSize(new Dimension(21, 149)); progressBar.setBorder(BorderFactory.createDashedBorder(Color.BLACK, (float) progressBar.getPreferredSize().getWidth(), (float) progressBar.getPreferredSize().getWidth())); progressBar.setBackground(Color.LIGHT_GRAY); progressBar.setForeground(overlayAxis.color); progressBar.setValue(1); indicatorPanel.add(progressBar); virtualAxisToProgressBarMap.put(virtualAxis, progressBar); } } overlayFrame.add(indicatorPanel); overlayFrameDragListener = new FrameDragListener(this, overlayFrame) { @Override public void mouseDragged(final MouseEvent e) { super.mouseDragged(e); final var maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment() .getMaximumWindowBounds(); updateOverlayAlignment(maxWindowBounds); } }; overlayFrame.addMouseListener(overlayFrameDragListener); overlayFrame.addMouseMotionListener(overlayFrameDragListener); prevMaxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); updateOverlayLocation(prevMaxWindowBounds); overlayFrame.setVisible(true); }