List of usage examples for java.awt GridBagConstraints HORIZONTAL
int HORIZONTAL
To view the source code for java.awt GridBagConstraints HORIZONTAL.
Click Source Link
From source file:net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportConfigView.java
private void layoutPanel() { setPreferredSize(new Dimension(450, 400)); setLayout(new BorderLayout()); page1 = new JPanel(new GridBagLayout()); page2 = new JPanel(new GridBagLayout()); contentPanel = new JPanel(cardLayout); contentPanel.add(page1, "page1"); contentPanel.add(page2, "page2"); add(contentPanel, BorderLayout.CENTER); // title// www. ja v a 2 s . c o m titlePanel.setBorder(new CompoundBorder(titlePanel.getBorder(), new EmptyBorder(10, 10, 0, 10))); add(titlePanel, BorderLayout.NORTH); titlePanel.add(titleLabel, BorderLayout.NORTH); titlePanel.add(titleIcon, BorderLayout.WEST); titlePanel.add(titleMessage, BorderLayout.CENTER); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridwidth = GridBagConstraints.REMAINDER; // column range c.insets = new Insets(10, 10, 0, 10); page1.add(columnLabel, c); c.insets = new Insets(10, 25, 0, 0); c.gridwidth = 1; c.weightx = 0; page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c); c.insets = new Insets(10, 0, 0, 0); c.gridx = 1; page1.add(columnFromValue, c); c.gridx = 2; page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c); c.gridx = 3; page1.add(columnToValue, c); c.gridx = 0; c.weightx = 1; c.insets = new Insets(10, 10, 0, 10); c.gridwidth = GridBagConstraints.REMAINDER; // row range page1.add(rowLabel, c); c.insets = new Insets(10, 25, 0, 0); c.gridwidth = 1; c.gridx = 0; c.weightx = 0; page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c); c.insets = new Insets(10, 0, 0, 0); c.gridx = 1; page1.add(rowFromValue, c); c.gridx = 2; page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c); c.gridx = 3; page1.add(rowToValue, c); c.gridx = 4; page1.add(rowSelectAllOption, c); c.gridx = 5; c.gridwidth = GridBagConstraints.REMAINDER; c.insets = new Insets(10, 0, 0, 10); page1.add(rowExcludeFirstOption, c); c.insets = new Insets(10, 25, 0, 0); c.gridx = 0; page1.add(rowIgnoreBlankRows, c); c.gridx = 0; // empty cells c.insets = new Insets(10, 10, 10, 10); page1.add(emptyCellLabel, c); c.insets = new Insets(0, 25, 0, 10); page1.add(emptyCellEmptyStringOption, c); JPanel userDefinedPanel = new JPanel(new BorderLayout()); userDefinedPanel.add(emptyCellUserDefinedOption, BorderLayout.WEST); userDefinedPanel.add(emptyCellUserDefinedValue, BorderLayout.CENTER); page1.add(userDefinedPanel, c); c.weighty = 1; c.anchor = GridBagConstraints.NORTHWEST; page1.add(emptyCellErrorValueOption, c); // output format c.insets = new Insets(10, 10, 10, 10); c.weighty = 0; c.weightx = 1; page2.add(outputFormatLabel, c); c.insets = new Insets(0, 25, 0, 10); page2.add(outputFormatMultiplePort, c); page2.add(outputFormatSinglePort, c); c.insets = new Insets(0, 50, 0, 10); JPanel outputFormatDelimiterPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); outputFormatDelimiterPanel.add(outputFormatDelimiterLabel); outputFormatDelimiterPanel.add(outputFormatDelimiter); page2.add(outputFormatDelimiterPanel, c); // column mapping c.insets = new Insets(10, 10, 0, 10); page2.add(columnMappingLabel, c); c.insets = new Insets(10, 10, 10, 10); c.fill = GridBagConstraints.BOTH; c.weighty = 1; page2.add(new JScrollPane(columnMappingTable), c); buttonPanel.add(backButton); buttonPanel.add(nextButton); add(buttonPanel, BorderLayout.SOUTH); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Lays out the components using a <code>FlowLayout</code>. * /*w w w .j a v a2 s . c o m*/ * @param button The component to lay out. * @param component The component to lay out. * @param sizeRow The size of the row. * @return See above. */ private JPanel layoutEditablefield(Component button, JComponent component, int sizeRow) { JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridy = 0; c.gridx = 0; if (button != null) { JToolBar bar = new JToolBar(); bar.setBorder(null); bar.setFloatable(false); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.add(button); p.add(bar, c); c.gridx++; } if (sizeRow > 0) { c.ipady = sizeRow; c.gridheight = 2; } p.add(component, c); JPanel content = UIUtilities.buildComponentPanel(p, 0, 0); content.setBackground(UIUtilities.BACKGROUND_COLOR); return content; }
From source file:org.jab.docsearch.DocSearch.java
/** * Constructor// w w w . j a v a 2 s .c om */ public DocSearch() { super(I18n.getString("ds.windowtitle")); // get logger logger = Logger.getLogger(getClass().getName()); // File testCDFi = new File(cdRomDefaultHome); Properties sys = new Properties(System.getProperties()); if (testCDFi.exists()) { sys.setProperty("disableLuceneLocks", "true"); logger.info("DocSearch() Disabling Lucene Locks for CDROM indexes"); } else { sys.setProperty("disableLuceneLocks", "false"); } // checkCDROMDir(); defaultHndlr = getBrowserFile(); loadSettings(); // pPanel = new ProgressPanel("", 100L); pPanel.init(); phrase = new JRadioButton(I18n.getString("label.phrase")); searchField = new JComboBox(); searchIn = new JComboBox(searchOptsLabels); JLabel searchTypeLabel = new JLabel(I18n.getString("label.search_type")); JLabel searchInLabel = new JLabel(I18n.getString("label.search_in")); keywords = new JRadioButton(I18n.getString("label.keyword")); // searchLabel = new JLabel(I18n.getString("label.search_for")); searchButton = new JButton(I18n.getString("button.search")); searchButton.setActionCommand("ac_search"); searchButton.setMnemonic(KeyEvent.VK_A); // TODO alt text to resource htmlTag = "<img src=\"" + fEnv.getIconURL(FileType.HTML.getIcon()) + "\" border=\"0\" alt=\"Web Page Document\">"; wordTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_WORD.getIcon()) + "\" border=\"0\" alt=\"MS Word Document\">"; excelTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_EXCEL.getIcon()) + "\" border=\"0\" alt=\"MS Excel Document\">"; pdfTag = "<img src=\"" + fEnv.getIconURL(FileType.PDF.getIcon()) + "\" border=\"0\" alt=\"PDF Document\">"; textTag = "<img src=\"" + fEnv.getIconURL(FileType.TEXT.getIcon()) + "\" border=\"0\" alt=\"Text Document\">"; rtfTag = "<img src=\"" + fEnv.getIconURL(FileType.RTF.getIcon()) + "\" border=\"0\" alt=\"RTF Document\">"; ooImpressTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_IMPRESS.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Impress Document\">"; ooWriterTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_WRITER.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Writer Document\">"; ooCalcTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_CALC.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Calc Document\">"; ooDrawTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_DRAW.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Draw Document\">"; openDocumentTextTag = "<img src=\"" + fEnv.getIconURL(FileType.OPENDOCUMENT_TEXT.getIcon()) + "\" border=\"0\" alt=\"OpenDocument Text Document\">"; // idx = new Index(this); colors = new String[2]; colors[0] = "ffeffa"; colors[1] = "fdffda"; if (env.isWebStart()) { startPageString = getClass().getResource("/" + FileEnvironment.FILENAME_START_PAGE_WS).toString(); helpPageString = getClass().getResource("/" + FileEnvironment.FILENAME_HELP_PAGE_WS).toString(); if (startPageString != null) { logger.debug("DocSearch() Start Page is: " + startPageString); hasStartPage = true; } else { logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString); } } else { startPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_START_PAGE); helpPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_HELP_PAGE); File startPageFile = new File(startPageString); if (startPageFile.exists()) { logger.debug("DocSearch() Start Page is: " + startPageString); hasStartPage = true; } else { logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString); } } defaultSaveFolder = FileUtils.addFolder(fEnv.getWorkingDirectory(), "saved_searches"); searchField.setEditable(true); searchField.addItem(""); bg = new ButtonGroup(); bg.add(phrase); bg.add(keywords); keywords.setSelected(true); keywords.setToolTipText(I18n.getString("tooltip.keyword")); phrase.setToolTipText(I18n.getString("tooltip.phrase")); int iconInt = 2; searchField.setPreferredSize(new Dimension(370, 22)); // application icon Image iconImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/ds.gif")); this.setIconImage(iconImage); // menu bar JMenuBar menuBar = createMenuBar(); // add menu to frame setJMenuBar(menuBar); // tool bar JToolBar toolbar = createToolBar(); editorPane = new JEditorPane("text/html", lastSearch); editorPane.setEditable(false); editorPane.addHyperlinkListener(new Hyperactive()); if (hasStartPage) { try { editorPane.setContentType("text/html"); if (setPage("home")) { logger.info("DocSearch() loaded start page: " + startPageString); } } catch (Exception e) { editorPane.setText(lastSearch); } } else { logger.warn("DocSearch() no start page loaded"); } scrollPane = new JScrollPane(editorPane); scrollPane.setPreferredSize(new Dimension(1024, 720)); scrollPane.setMinimumSize(new Dimension(900, 670)); scrollPane.setMaximumSize(new Dimension(1980, 1980)); // create panels // add printing stuff vista = new JComponentVista(editorPane, new PageFormat()); JPanel topPanel = new JPanel(); topPanel.add(searchLabel); topPanel.add(searchField); topPanel.add(searchButton); JPanel bottomPanel = new JPanel(); bottomPanel.add(searchTypeLabel); bottomPanel.add(keywords); bottomPanel.add(phrase); bottomPanel.add(searchInLabel); bottomPanel.add(searchIn); // GUI items for advanced searching useDate = new JCheckBox(I18n.getString("label.use_date_property")); fromField = new JTextField(11); JLabel fromLabel = new JLabel(I18n.getString("label.from")); JLabel toLabel = new JLabel(I18n.getString("label.to")); toField = new JTextField(11); cbl = new CheckBoxListener(); authorPanel = new JPanel(); useAuthor = new JCheckBox(I18n.getString("label.use_auth_property")); authorField = new JTextField(31); JLabel authorLabel = new JLabel(I18n.getString("label.author")); authorPanel.add(useAuthor); authorPanel.add(authorLabel); authorPanel.add(authorField); // combine stuff JPanel datePanel = new JPanel(); datePanel.add(useDate); datePanel.add(fromLabel); datePanel.add(fromField); datePanel.add(toLabel); datePanel.add(toField); JPanel metaPanel = new JPanel(); metaPanel.setLayout(new BorderLayout()); metaPanel.setBorder(new TitledBorder(I18n.getString("label.date_and_author"))); metaPanel.add(datePanel, BorderLayout.NORTH); metaPanel.add(authorPanel, BorderLayout.SOUTH); useDate.addActionListener(cbl); useAuthor.addActionListener(cbl); fromField.setText(DateTimeUtils.getLastYear()); toField.setText(DateTimeUtils.getToday()); authorField.setText(System.getProperty("user.name")); JPanel[] panels = new JPanel[numPanels]; for (int i = 0; i < numPanels; i++) { panels[i] = new JPanel(); } // add giu to panels panels[0].setLayout(new BorderLayout()); panels[0].add(topPanel, BorderLayout.NORTH); panels[0].add(bottomPanel, BorderLayout.SOUTH); panels[0].setBorder(new TitledBorder(I18n.getString("label.search_critera"))); searchButton.addActionListener(this); JPanel fileTypePanel = new JPanel(); useType = new JCheckBox(I18n.getString("label.use_filetype_property")); useType.addActionListener(cbl); fileType = new JComboBox(fileTypesToFindLabel); JLabel fileTypeLabel = new JLabel(I18n.getString("label.find_only_these_filetypes")); fileTypePanel.add(useType); fileTypePanel.add(fileTypeLabel); fileTypePanel.add(fileType); JPanel sizePanel = new JPanel(); useSize = new JCheckBox(I18n.getString("label.use_filesize_property")); useSize.addActionListener(cbl); // TODO l18n kbytes JLabel sizeFromLabel = new JLabel(I18n.getString("label.from") + " KByte"); JLabel sizeToLabel = new JLabel(I18n.getString("label.to") + " KByte"); sizeFromField = new JTextField(10); sizeFromField.setText("0"); sizeToField = new JTextField(10); sizeToField.setText("100"); sizePanel.add(useSize); sizePanel.add(sizeFromLabel); sizePanel.add(sizeFromField); sizePanel.add(sizeToLabel); sizePanel.add(sizeToField); JPanel sizeAndTypePanel = new JPanel(); sizeAndTypePanel.setLayout(new BorderLayout()); sizeAndTypePanel.setBorder(new TitledBorder(I18n.getString("label.filetype_and_size"))); sizeAndTypePanel.add(fileTypePanel, BorderLayout.NORTH); sizeAndTypePanel.add(sizePanel, BorderLayout.SOUTH); // set up the tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(I18n.getString("label.general"), null, panels[0], I18n.getString("tooltip.general_search_criteria")); tabbedPane.addTab(I18n.getString("label.date_and_author"), null, metaPanel, I18n.getString("tooltip.date_auth_options")); tabbedPane.addTab(I18n.getString("label.filetype_and_size"), null, sizeAndTypePanel, I18n.getString("tooltip.filetype_and_size_options")); // gridbag getContentPane().setLayout(new GridLayout(1, numPanels + iconInt + 1)); GridBagLayout gridbaglayout = new GridBagLayout(); GridBagConstraints gridbagconstraints = new GridBagConstraints(); getContentPane().setLayout(gridbaglayout); gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = 0; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(toolbar, gridbagconstraints); getContentPane().add(toolbar); int start = 1; for (int i = 0; i < numPanels; i++) { if (i == 0) { gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = i + start; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(tabbedPane, gridbagconstraints); getContentPane().add(tabbedPane); } else { gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = i + start; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(panels[i], gridbagconstraints); getContentPane().add(panels[i]); } } // now add the results area gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = iconInt; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 1.0D; gridbaglayout.setConstraints(scrollPane, gridbagconstraints); getContentPane().add(scrollPane); JPanel statusP = new JPanel(); statusP.setLayout(new BorderLayout()); statusP.add(dirLabel, BorderLayout.WEST); statusP.add(pPanel, BorderLayout.EAST); // now add the status label gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = numPanels + iconInt; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(statusP, gridbagconstraints); getContentPane().add(statusP); // File testArchDir = new File(fEnv.getArchiveDirectory()); if (!testArchDir.exists()) { boolean madeDir = testArchDir.mkdir(); if (!madeDir) { logger.warn("DocSearch() Error creating directory: " + fEnv.getArchiveDirectory()); } else { logger.info("DocSearch() Directory created: " + fEnv.getArchiveDirectory()); } } loadIndexes(); // DocTypeHandler String handlersFiName; if (!isCDSearchTool) { handlersFiName = FileUtils.addFolder(fEnv.getWorkingDirectory(), DocTypeHandlerUtils.HANDLER_FILE); } else { handlersFiName = FileUtils.addFolder(cdRomDefaultHome, DocTypeHandlerUtils.HANDLER_FILE); } DocTypeHandlerUtils dthUtils = new DocTypeHandlerUtils(); if (!FileUtils.fileExists(handlersFiName)) { logger.warn("DocSearch() Handlers file not found at: " + handlersFiName); handlerList = dthUtils.getInitialHandler(env); } else { handlerList = dthUtils.loadHandler(handlersFiName); } }
From source file:com.vgi.mafscaling.LogView.java
private void createChartTab() { JPanel plotPanel = new JPanel(); add(plotPanel, "<html><div style='text-align: center;'>3<br>D<br><br>C<br>h<br>a<br>r<br>t</div></html>"); GridBagLayout gbl_plotPanel = new GridBagLayout(); gbl_plotPanel.columnWidths = new int[] { 0 }; gbl_plotPanel.rowHeights = new int[] { 0, 0 }; gbl_plotPanel.columnWeights = new double[] { 1.0 }; gbl_plotPanel.rowWeights = new double[] { 0.0, 1.0 }; plotPanel.setLayout(gbl_plotPanel);// ww w . j a v a2 s .c om JPanel cntlPanel = new JPanel(); GridBagConstraints gbc_ctrlPanel = new GridBagConstraints(); gbc_ctrlPanel.insets = insets3; gbc_ctrlPanel.anchor = GridBagConstraints.NORTH; gbc_ctrlPanel.weightx = 1.0; gbc_ctrlPanel.fill = GridBagConstraints.HORIZONTAL; gbc_ctrlPanel.gridx = 0; gbc_ctrlPanel.gridy = 0; plotPanel.add(cntlPanel, gbc_ctrlPanel); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_cntlPanel.rowHeights = new int[] { 0 }; gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }; gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.anchor = GridBagConstraints.EAST; gbc_label.insets = new Insets(3, 3, 3, 0); gbc_label.gridx = 0; gbc_label.gridy = 0; GridBagConstraints gbc_column = new GridBagConstraints(); gbc_column.anchor = GridBagConstraints.WEST; gbc_column.insets = insets3; gbc_column.gridx = 1; gbc_column.gridy = 0; cntlPanel.add(new JLabel("X-Axis"), gbc_label); xAxisColumn = new JComboBox<String>(); xAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX"); cntlPanel.add(xAxisColumn, gbc_column); gbc_label.gridx += 2; cntlPanel.add(new JLabel("Y-Axis"), gbc_label); gbc_column.gridx += 2; yAxisColumn = new JComboBox<String>(); yAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX"); cntlPanel.add(yAxisColumn, gbc_column); gbc_label.gridx += 2; cntlPanel.add(new JLabel("Plots"), gbc_label); gbc_column.gridx += 2; plotsColumn = new JMultiSelectionBox(); plotsColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX"); cntlPanel.add(plotsColumn, gbc_column); gbc_label.gridx = 7; JButton btnGoButton = new JButton("View"); btnGoButton.setActionCommand("view"); btnGoButton.addActionListener(this); cntlPanel.add(btnGoButton, gbc_label); plot3d = new Plot3DPanel("SOUTH") { private static final long serialVersionUID = 7914951068593204419L; public void addPlotToolBar(String location) { super.addPlotToolBar(location); super.plotToolBar.remove(7); super.plotToolBar.remove(5); super.plotToolBar.remove(4); } }; plot3d.setAutoBounds(); plot3d.setAutoscrolls(true); plot3d.setEditable(false); plot3d.setBorder(BorderFactory.createLineBorder(Color.BLACK)); plot3d.setForeground(Color.BLACK); plot3d.getAxis(0).setColor(Color.BLACK); plot3d.getAxis(1).setColor(Color.BLACK); plot3d.getAxis(2).setColor(Color.BLACK); GridBagConstraints gbc_chartPanel = new GridBagConstraints(); gbc_chartPanel.anchor = GridBagConstraints.CENTER; gbc_chartPanel.insets = insets3; gbc_chartPanel.weightx = 1.0; gbc_chartPanel.weighty = 1.0; gbc_chartPanel.fill = GridBagConstraints.BOTH; gbc_chartPanel.gridx = 0; gbc_chartPanel.gridy = 1; plotPanel.add(plot3d, gbc_chartPanel); }
From source file:edu.harvard.mcz.imagecapture.MainFrame.java
/** * This method initializes jPanel1 /*from ww w . j a v a 2 s . c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel1() { if (jPanel1 == null) { GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridy = 0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints1.weightx = 4.0; gridBagConstraints1.gridx = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.gridy = 0; jLabelStatus = new JLabel(); jLabelStatus.setText("Status:"); jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); jPanel1.add(jLabelStatus, gridBagConstraints1); jPanel1.add(getJProgressBar(), gridBagConstraints); } return jPanel1; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Builds and lays out the components displaying the naming options. * //from w w w .ja v a 2 s . c om * @return See above. */ private JComponent buildNamingComponent() { JPanel content = new JPanel(); content.setBorder(BorderFactory.createTitledBorder("File Naming")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(fullName); panel.add(partialName); JPanel pp = new JPanel(); pp.setLayout(new BoxLayout(pp, BoxLayout.Y_AXIS)); pp.add(UIUtilities.buildComponentPanel(panel)); pp.add(buildPathComponent()); GridBagConstraints c = new GridBagConstraints(); content.setLayout(new GridBagLayout()); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.0; c.gridwidth = 2; c.gridx = 0; c.gridy = 0; content.add(overrideName, c); c.gridwidth = 1; c.gridy++; content.add(Box.createHorizontalStrut(15), c); c.gridx++; content.add(pp, c); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(content); p.add(buildAnnotationComponent()); return UIUtilities.buildComponentPanel(p); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java
/** Builds and lays out the UI. */ void buildGUI() { removeAll();//from w w w . ja v a2 s .c o m initComponents(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.weightx = 1.0; add(buildContentPanel(), c); if (model.isUserOwner(model.getRefObject()) || MetadataViewerAgent.isAdministrator()) { c.gridy++; JPanel buttonPanel = UIUtilities.buildComponentPanel(saveButton); buttonPanel.setBackground(UIUtilities.BACKGROUND_COLOR); add(buttonPanel, c); c.gridy++; add(Box.createVerticalStrut(5), c); c.gridy++; add(buildPasswordPanel(), c); } ExperimenterData exp = (ExperimenterData) model.getRefObject(); BufferedImage photo = model.getUserPhoto(exp.getId()); if (photo == null) setUserPhoto(null); else setUserPhoto(photo); deletePhoto.setVisible(photo != null && canModifyPhoto()); }
From source file:de.codesourcery.jasm16.ide.ui.views.SourceEditorView.java
protected JPanel createPanel() { // button panel final JToolBar toolbar = new JToolBar(); toolbar.setLayout(new GridBagLayout()); setColors(toolbar);/* w w w.j a va 2 s . c o m*/ final JButton showASTButton = new JButton("Show AST"); setColors(showASTButton); showASTButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final boolean currentlyVisible = isASTInspectorVisible(); if (currentlyVisible) { showASTButton.setText("Show AST"); } else { showASTButton.setText("Hide AST"); } if (currentlyVisible) { astInspector.setVisible(false); } else { showASTInspector(); } } }); GridBagConstraints cnstrs = constraints(0, 0, false, true, GridBagConstraints.NONE); toolbar.add(showASTButton, cnstrs); // navigation history back button cnstrs = constraints(1, 0, false, true, GridBagConstraints.NONE); toolbar.add(navigationHistoryBack, cnstrs); navigationHistoryBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { navigationHistoryBack(); } }); navigationHistoryBack.setEnabled(false); // navigation history forward button cnstrs = constraints(2, 0, true, true, GridBagConstraints.NONE); toolbar.add(navigationHistoryForward, cnstrs); navigationHistoryForward.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { navigationHistoryForward(); } }); navigationHistoryForward.setEnabled(false); // create status area statusArea.setPreferredSize(new Dimension(400, 100)); statusArea.setModel(statusModel); setColors(statusArea); /** * TOOLBAR * SOURCE * cursor position * status area */ final JPanel topPanel = new JPanel(); topPanel.setLayout(new GridBagLayout()); cnstrs = constraints(0, 0, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 0; topPanel.add(toolbar, cnstrs); cnstrs = constraints(0, 1, GridBagConstraints.BOTH); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 1.0; topPanel.add(super.getPanel(), cnstrs); final JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new GridBagLayout()); statusArea.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); statusArea.addMouseListener(new MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { final int viewRow = statusArea.rowAtPoint(e.getPoint()); if (viewRow != -1) { final int modelRow = statusArea.convertRowIndexToModel(viewRow); StatusMessage message = statusModel.getMessage(modelRow); if (message.getLocation() != null) { moveCursorTo(message.getLocation(), true); } } } }; }); EditorContainer.addEditorCloseKeyListener(statusArea, this); statusArea.setFillsViewportHeight(true); statusArea.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final JScrollPane statusPane = new JScrollPane(statusArea); setColors(statusPane); statusPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); statusPane.setPreferredSize(new Dimension(400, 100)); statusPane.setMinimumSize(new Dimension(100, 20)); cnstrs = constraints(0, 0, GridBagConstraints.BOTH); cnstrs.weightx = 1; cnstrs.weighty = 1; cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = GridBagConstraints.REMAINDER; bottomPanel.add(statusPane, cnstrs); // setup result panel final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel); setColors(splitPane); final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); setColors(panel); cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH); panel.add(splitPane, cnstrs); final AncestorListener l = new AncestorListener() { @Override public void ancestorRemoved(AncestorEvent event) { } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorAdded(AncestorEvent event) { splitPane.setDividerLocation(0.8d); } }; panel.addAncestorListener(l); return panel; }
From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java
/** This method is called from within the constructor to * initialize the form./*from www . ja v a 2 s.com*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jMainStatPanel = new javax.swing.JPanel(); jChartPanel = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jAllyList = new javax.swing.JList(); jScrollPane2 = new javax.swing.JScrollPane(); jTribeList = new javax.swing.JList(); jShowPoints = new javax.swing.JCheckBox(); jShowRank = new javax.swing.JCheckBox(); jShowVillages = new javax.swing.JCheckBox(); jShowKillsOff = new javax.swing.JCheckBox(); jShowRankOff = new javax.swing.JCheckBox(); jShowKillsDef = new javax.swing.JCheckBox(); jShowRankDef = new javax.swing.JCheckBox(); jShowItemValues = new javax.swing.JCheckBox(); jShowLegend = new javax.swing.JCheckBox(); jShowLines = new javax.swing.JCheckBox(); jShowDataPoints = new javax.swing.JCheckBox(); jViewSelectionBox = new javax.swing.JComboBox(); jStatCreatePanel = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jScrollPane7 = new javax.swing.JScrollPane(); jPointsPane = new javax.swing.JEditorPane(); jScrollPane10 = new javax.swing.JScrollPane(); jBashOffPane = new javax.swing.JEditorPane(); jScrollPane11 = new javax.swing.JScrollPane(); jBashDefPane = new javax.swing.JEditorPane(); jScrollPane12 = new javax.swing.JScrollPane(); jWinnerLoserPane = new javax.swing.JEditorPane(); jButton8 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jStartDate = new de.tor.tribes.ui.components.DateTimeField(); jLabel5 = new javax.swing.JLabel(); jEndDate = new de.tor.tribes.ui.components.DateTimeField(); jPanel11 = new javax.swing.JPanel(); jWeeklyStats = new javax.swing.JButton(); jMonthlyStats = new javax.swing.JButton(); jUseTop10Box = new javax.swing.JCheckBox(); jAlwaysOnTopBox = new javax.swing.JCheckBox(); jStatsPanel = new org.jdesktop.swingx.JXPanel(); capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jMainStatPanel.setMinimumSize(new java.awt.Dimension(516, 300)); jMainStatPanel.setLayout(new java.awt.BorderLayout()); jChartPanel.setBackground(new java.awt.Color(239, 235, 223)); jChartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jChartPanel.setPreferredSize(new java.awt.Dimension(499, 300)); jChartPanel.setLayout(new java.awt.BorderLayout()); jMainStatPanel.add(jChartPanel, java.awt.BorderLayout.CENTER); jPanel7.setPreferredSize(new java.awt.Dimension(516, 150)); jPanel7.setLayout(new java.awt.GridBagLayout()); jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("berwachte Stmme")); jScrollPane1.setMinimumSize(new java.awt.Dimension(258, 100)); jScrollPane1.setPreferredSize(new java.awt.Dimension(258, 150)); jScrollPane1.setViewportView(jAllyList); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel7.add(jScrollPane1, gridBagConstraints); jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("berwachte Spieler")); jScrollPane2.setMinimumSize(new java.awt.Dimension(258, 100)); jScrollPane2.setPreferredSize(new java.awt.Dimension(258, 150)); jScrollPane2.setViewportView(jTribeList); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel7.add(jScrollPane2, gridBagConstraints); jMainStatPanel.add(jPanel7, java.awt.BorderLayout.NORTH); jShowPoints.setSelected(true); jShowPoints.setText("Punkte anzeigen"); jShowPoints.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowRank.setText("Rang anzeigen"); jShowRank.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowVillages.setText("Drfer anzeigen"); jShowVillages.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowKillsOff.setText("Kills (Off) anzeigen"); jShowKillsOff.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowRankOff.setText("Rang (Off) anzeigen"); jShowRankOff.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowKillsDef.setText("Kills (Deff) anzeigen"); jShowKillsDef.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowRankDef.setText("Rang (Deff) anzeigen"); jShowRankDef.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowItemValues.setText("Werte anzeigen"); jShowItemValues.setToolTipText("Zeigt die Werte der Datenpunkte im Diagramm an"); jShowItemValues.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowLegend.setSelected(true); jShowLegend.setText("Legende anzeigen"); jShowLegend.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowLines.setSelected(true); jShowLines.setText("Linien anzeigen"); jShowLines.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jShowDataPoints.setSelected(true); jShowDataPoints.setText("Datenpunkte anzeigen"); jShowDataPoints.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireUpdateChartEvent(evt); } }); jViewSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Punkte", "Rang (Punkte)", "Drfer", "Kills (Off)", "Rang (Off)", "Kills (Def)", "Rang (Def)" })); jViewSelectionBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireViewChangedEvent(evt); } }); jStatCreatePanel.setBackground(new java.awt.Color(239, 235, 223)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Auswertung")); jPointsPane.setContentType("text/html"); // NOI18N jPointsPane.setEditable(false); jScrollPane7.setViewportView(jPointsPane); jTabbedPane1.addTab("Punkte", new javax.swing.ImageIcon(getClass().getResource("/res/goblet_gold.png")), jScrollPane7); // NOI18N jBashOffPane.setContentType("text/html"); // NOI18N jBashOffPane.setEditable(false); jScrollPane10.setViewportView(jBashOffPane); jTabbedPane1.addTab("Bash (Off)", new javax.swing.ImageIcon(getClass().getResource("/res/barracks.png")), jScrollPane10); // NOI18N jBashDefPane.setContentType("text/html"); // NOI18N jBashDefPane.setEditable(false); jScrollPane11.setViewportView(jBashDefPane); jTabbedPane1.addTab("Bash (Deff)", new javax.swing.ImageIcon(getClass().getResource("/res/ally.png")), jScrollPane11); // NOI18N jWinnerLoserPane.setContentType("text/html"); // NOI18N jWinnerLoserPane.setEditable(false); jScrollPane12.setViewportView(jWinnerLoserPane); jTabbedPane1.addTab("Gewinner/Verlierer", new javax.swing.ImageIcon(getClass().getResource("/res/up_plus.png")), jScrollPane12); // NOI18N javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE) .addContainerGap())); jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/select.png"))); // NOI18N jButton8.setText("Auswertung erstellen"); jButton8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { fireGenerateStatsEvent(evt); } }); jPanel1.setOpaque(false); jPanel1.setLayout(new java.awt.GridBagLayout()); jLabel4.setText("Zeitraum (Start)"); jPanel1.add(jLabel4, new java.awt.GridBagConstraints()); jStartDate.setTimeEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); jPanel1.add(jStartDate, gridBagConstraints); jLabel5.setText("Zeitraum (Ende)"); jPanel1.add(jLabel5, new java.awt.GridBagConstraints()); jEndDate.setTimeEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); jPanel1.add(jEndDate, gridBagConstraints); jPanel11.setOpaque(false); jPanel11.setPreferredSize(new java.awt.Dimension(520, 100)); jPanel11.setLayout(new java.awt.GridBagLayout()); jWeeklyStats.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/calendar_7.png"))); // NOI18N jWeeklyStats.setText("Statistik fr eine Woche (Heute - 7 Tage)"); jWeeklyStats.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); jWeeklyStats.setMaximumSize(new java.awt.Dimension(40, 25)); jWeeklyStats.setMinimumSize(new java.awt.Dimension(40, 25)); jWeeklyStats.setPreferredSize(new java.awt.Dimension(260, 25)); jWeeklyStats.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { fireChangeStatTimeEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5); jPanel11.add(jWeeklyStats, gridBagConstraints); jMonthlyStats.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/calendar_31.png"))); // NOI18N jMonthlyStats.setText("Statistik fr einen Monat (Heute - 31 Tage)"); jMonthlyStats.setMaximumSize(new java.awt.Dimension(40, 25)); jMonthlyStats.setMinimumSize(new java.awt.Dimension(40, 25)); jMonthlyStats.setPreferredSize(new java.awt.Dimension(260, 25)); jMonthlyStats.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { fireChangeStatTimeEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0); jPanel11.add(jMonthlyStats, gridBagConstraints); jUseTop10Box.setText("Nur Top-10 anzeigen"); javax.swing.GroupLayout jStatCreatePanelLayout = new javax.swing.GroupLayout(jStatCreatePanel); jStatCreatePanel.setLayout(jStatCreatePanelLayout); jStatCreatePanelLayout.setHorizontalGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jStatCreatePanelLayout.createSequentialGroup().addContainerGap() .addGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jStatCreatePanelLayout.createSequentialGroup() .addGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 589, Short.MAX_VALUE) .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, 589, Short.MAX_VALUE)) .addContainerGap()) .addGroup(jStatCreatePanelLayout.createSequentialGroup() .addGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jStatCreatePanelLayout.createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 287, Short.MAX_VALUE) .addComponent(jUseTop10Box).addGap(18, 18, 18) .addComponent(jButton8))) .addGap(14, 14, 14))))); jStatCreatePanelLayout.setVerticalGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jStatCreatePanelLayout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jStatCreatePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jUseTop10Box, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); setTitle("Statistiken"); getContentPane().setLayout(new java.awt.GridBagLayout()); jAlwaysOnTopBox.setText("Immer im Vordergrund"); jAlwaysOnTopBox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { fireAlwaysOnTopEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jAlwaysOnTopBox, gridBagConstraints); jStatsPanel.setBackground(new java.awt.Color(239, 235, 223)); jStatsPanel.setMinimumSize(new java.awt.Dimension(700, 500)); jStatsPanel.setPreferredSize(new java.awt.Dimension(700, 500)); jStatsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(jStatsPanel, gridBagConstraints); capabilityInfoPanel1.setCopyable(false); capabilityInfoPanel1.setPastable(false); 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:org.bigwiv.blastgraph.gui.BlastGraphFrame.java
private void initComponents() { URL icon;/*from ww w . ja v a 2s.co m*/ icon = getClass().getResource("/org/bigwiv/blastgraph/icons/icon.png"); this.setIconImage(Toolkit.getDefaultToolkit().createImage(icon)); JComponent pane; pane = (JComponent) getContentPane(); // ====================Menu Setting======================= newItem = new JMenuItem("New From Blast"); newItem.setMnemonic('n'); newItem.addActionListener(commandActionListener); openItem = new JMenuItem("Open"); openItem.setMnemonic('o'); openItem.addActionListener(commandActionListener); appendGraphItem = new JMenuItem("Append Graph"); appendGraphItem.setMnemonic('a'); appendGraphItem.addActionListener(commandActionListener); saveItem = new JMenuItem("Save"); saveItem.setMnemonic('s'); saveItem.addActionListener(commandActionListener); saveAsGraphItem = new JMenuItem("Save As"); saveAsGraphItem.addActionListener(commandActionListener); exportGraphItem = new JMenuItem("Export"); exportGraphItem.addActionListener(commandActionListener); saveCurGraphItem = new JMenuItem("Save Current Graph"); saveCurGraphItem.addActionListener(commandActionListener); saveCurImgItem = new JMenuItem("Save Image"); saveCurImgItem.addActionListener(commandActionListener); saveAllVertexAttrItem = new JMenuItem("Save Vertex Attribute"); saveAllVertexAttrItem.addActionListener(commandActionListener); saveCurVertexAttrItem = new JMenuItem("Save Vertex Attribute"); saveCurVertexAttrItem.addActionListener(commandActionListener); saveAsMenu = new JMenu("Save As"); saveAsMenu.add(saveAsGraphItem); saveAsMenu.add(saveAllVertexAttrItem); saveCurGraphMenu = new JMenu("Save Current Graph"); saveCurGraphMenu.add(saveCurGraphItem); saveCurGraphMenu.add(saveCurImgItem); saveCurGraphMenu.add(saveCurVertexAttrItem); printItem = new JMenuItem("Print..."); printItem.setMnemonic('p'); printItem.addActionListener(commandActionListener); importVertexAttrItem = new JMenuItem("Import Vertex Attribute"); importVertexAttrItem.addActionListener(commandActionListener); closeItem = new JMenuItem("Close"); closeItem.setMnemonic('c'); closeItem.addActionListener(commandActionListener); exitItem = new JMenuItem("Exit"); exitItem.setMnemonic('x'); exitItem.addActionListener(commandActionListener); fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newItem); fileMenu.add(openItem); fileMenu.add(appendGraphItem); fileMenu.add(new JSeparator()); fileMenu.add(closeItem); fileMenu.add(new JSeparator()); fileMenu.add(saveItem); fileMenu.add(saveAsMenu); fileMenu.add(saveCurGraphMenu); fileMenu.add(new JSeparator()); fileMenu.add(printItem); fileMenu.add(new JSeparator()); fileMenu.add(importVertexAttrItem); fileMenu.add(exportGraphItem); fileMenu.add(new JSeparator()); fileMenu.add(exitItem); // edit menu undoItem = new JMenuItem("Undo"); redoItem = new JMenuItem("Redo"); Global.COMMAND_MANAGER.registerUndoRedoItem(undoItem, redoItem); removeSingleItem = new JMenuItem("Remove Single Vertices"); removeSingleItem.addActionListener(commandActionListener); filterItem = new JMenuItem("Filt Graph"); filterItem.addActionListener(commandActionListener); settingItem = new JMenuItem("Setting"); settingItem.addActionListener(commandActionListener); markovClusterItem = new JMenuItem("Markov Cluster"); markovClusterItem.addActionListener(commandActionListener); // genomeNumFiltItem = new JMenuItem("GenomeNum Filt"); // genomeNumFiltItem.addActionListener(commandActionListener); // removeSingleLinkageItem = new JMenuItem("Remove Single Linkage"); // removeSingleLinkageItem.addActionListener(commandActionListener); editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoItem); editMenu.add(redoItem); editMenu.add(filterItem); editMenu.add(markovClusterItem); editMenu.add(removeSingleItem); // editMenu.add(genomeNumFiltItem); // editMenu.add(removeSingleLinkageItem); editMenu.add(settingItem); // Tools Item geneContentItem = new JMenuItem("Gene Content Table"); geneContentItem.addActionListener(commandActionListener); batchSaveItem = new JMenuItem("Batch Save"); batchSaveItem.addActionListener(commandActionListener); mstItem = new JMenuItem("Minimum Spanning Tree"); mstItem.addActionListener(commandActionListener); viewNeighborItem = new JMenuItem("View Neighbor of..."); viewNeighborItem.addActionListener(commandActionListener); // // tempWorkItem = new JMenuItem("Temp Work"); // tempWorkItem.addActionListener(commandActionListener); toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(geneContentItem); toolsMenu.add(viewNeighborItem); toolsMenu.add(mstItem); toolsMenu.add(batchSaveItem); // toolsMenu.add(tempWorkItem); // graph Menu graphMenu = new JMenu("Graph"); previousItem = new JMenuItem("Previous"); previousItem.addActionListener(commandActionListener); nextItem = new JMenuItem("Next"); nextItem.addActionListener(commandActionListener); resortItem = new JMenuItem("Resort graphs"); resortItem.addActionListener(commandActionListener); graphMenu.add(nextItem); graphMenu.add(previousItem); graphMenu.add(resortItem); // help Menu helpContentItem = new JMenuItem("Online Manual"); helpContentItem.addActionListener(commandActionListener); aboutItem = new JMenuItem("About BlastGraph"); aboutItem.addActionListener(commandActionListener); helpMenu = new JMenu("Help"); helpMenu.add(helpContentItem); helpMenu.add(aboutItem); // menu bar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(graphMenu); menuBar.add(toolsMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); // ===================mainPanel Setting=================== GridBagManager.reset(); GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.GRID_BAG.anchor = GridBagConstraints.FIRST_LINE_START; GridBagManager.GRID_BAG.weightx = 0; GridBagManager.GRID_BAG.weighty = 0; GridBagManager.GRID_BAG.insets = new Insets(2, 2, 1, 1); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); pane.add(mainPanel); hsplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); hsplitPane.setContinuousLayout(true); hsplitPane.setOneTouchExpandable(true); hsplitPane.setResizeWeight(0.9); // ===================toolBarPanel Setting=================== // graph file toolbar fileToolBar = new JToolBar(); fileToolBar.setRollover(true); newButton = new JButton(); newButton.setBorderPainted(false); newButton.setMnemonic('n'); newButton.setToolTipText("New From Blast"); newButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filenew.png"); // System.out.println(icon); newButton.setIcon(new ImageIcon(icon)); openButton = new JButton(); openButton.setBorderPainted(false); openButton.setMnemonic('o'); openButton.setToolTipText("Open"); openButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/fileopen.png"); openButton.setIcon(new ImageIcon(icon)); saveButton = new JButton(); saveButton.setBorderPainted(false); saveButton.setMnemonic('s'); saveButton.setToolTipText("Save"); saveButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filesave.png"); saveButton.setIcon(new ImageIcon(icon)); saveCurImgButton = new JButton(); saveCurImgButton.setBorderPainted(false); saveCurImgButton.setToolTipText("Save current image"); saveCurImgButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/saveimage.png"); saveCurImgButton.setIcon(new ImageIcon(icon)); printButton = new JButton(); printButton.setBorderPainted(false); printButton.setToolTipText("Print..."); printButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/fileprint.png"); printButton.setIcon(new ImageIcon(icon)); fileToolBar.add(newButton); fileToolBar.add(openButton); fileToolBar.add(saveButton); fileToolBar.add(saveCurImgButton); fileToolBar.add(printButton); // graph control toolbar graphToolBar = new JToolBar(); graphToolBar.setRollover(true); previousButton = new JButton(); previousButton.setBorderPainted(false); previousButton.setToolTipText("Previous graph"); previousButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/previous.png"); previousButton.setIcon(new ImageIcon(icon)); indexField = new JTextField(); indexField.setSize(new Dimension(25, 16)); indexField.setMinimumSize(new Dimension(25, 16)); indexField.setPreferredSize(new Dimension(25, 16)); indexField.addKeyListener(keyListener); nextButton = new JButton(); nextButton.setBorderPainted(false); nextButton.setToolTipText("Next graph"); nextButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/next.png"); nextButton.setIcon(new ImageIcon(icon)); filterButton = new JButton(); filterButton.setBorderPainted(false); filterButton.setToolTipText("Filt graph"); filterButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filter.png"); filterButton.setIcon(new ImageIcon(icon)); resortButton = new JButton(); resortButton.setBorderPainted(false); resortButton.setToolTipText("Resort graph"); resortButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/resort.png"); resortButton.setIcon(new ImageIcon(icon)); searchField = new JTextField(); searchField.setSize(new Dimension(60, 16)); searchField.setMinimumSize(new Dimension(60, 16)); searchField.setPreferredSize(new Dimension(60, 16)); searchField.addKeyListener(keyListener); searchButton = new JButton(); searchButton.setBorderPainted(false); searchButton.setToolTipText("Search"); searchButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/search.png"); searchButton.setIcon(new ImageIcon(icon)); graphToolBar.add(filterButton); graphToolBar.add(resortButton); // graphToolBar.add(new JToolBar.Separator()); graphToolBar.add(previousButton); graphToolBar.add(indexField); graphToolBar.add(nextButton); graphToolBar.add(searchField); graphToolBar.add(searchButton); // view toolbar (modebox & layoutbox) viewToolBar = new JToolBar(); viewToolBar.setRollover(true); modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { int index = modeBox.getSelectedIndex(); if (index == 2) { int annotCount = annotationToolBar.getComponentCount(); for (int i = 0; i < annotCount; i++) { annotationToolBar.getComponent(i).setEnabled(true); } } else { int annotCount = annotationToolBar.getComponentCount(); for (int i = 0; i < annotCount; i++) { annotationToolBar.getComponent(i).setEnabled(false); } } } }); layoutBox = this.getLayoutComboBox(); viewToolBar.add(modeBox); viewToolBar.add(layoutBox); colorComboBox = new JComboBox(new String[] { "vertex color", "index", "strand", "genomeAcc", "organism" }); viewToolBar.add(colorComboBox); // add additional menu to graphMenu modeMenu = graphMouse.getModeMenu(); modeMenu.setText("Mode"); layoutMenu = getLayoutMenu(); layoutMenu.setText("Layout"); graphMenu.add(modeMenu); graphMenu.add(layoutMenu); // annotation toolbar AnnotationControls<HitVertex, ValueEdge> annotationControls = new AnnotationControls<HitVertex, ValueEdge>( annotatingPlugin); annotationToolBar = annotationControls.getAnnotationsToolBar(); ((JButton) annotationToolBar.getComponent(1)).setBorderPainted(false); ((JToggleButton) annotationToolBar.getComponent(2)).setBorderPainted(false); // add toolbars to toolBarPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new ModifiedFlowLayout(ModifiedFlowLayout.LEFT, 0, 0)); toolBarPanel.setBorder(new EtchedBorder()); toolBarPanel.add(fileToolBar); toolBarPanel.add(graphToolBar); toolBarPanel.add(viewToolBar); toolBarPanel.add(annotationToolBar); mainPanel.add(toolBarPanel, BorderLayout.NORTH); mainPanel.add(hsplitPane, BorderLayout.CENTER); // GridBagManager.add(mainPanel, toolBarPanel, 0, 0, 1, 1); // GridBagManager.add(mainPanel, hsplitPane, 0, 1, 1, 1); // mainPanel.add(toolBarPanel, BorderLayout.NORTH); // ===================vsplitPane Setting================= vsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); vsplitPane.setContinuousLayout(true); vsplitPane.setOneTouchExpandable(true); vsplitPane.setResizeWeight(0.9); hsplitPane.setLeftComponent(vsplitPane); // GridBagManager.GRID_BAG.weightx = 0.9; // GridBagManager.GRID_BAG.weighty = 1; // GridBagManager.add(mainPanel, vsplitPane, 0, 1, 1, 2); // mainPanel.add(vsplitPane, BorderLayout.CENTER); // ===================vvPanel Setting=================== vvPanel = new GraphZoomScrollPane(vv); vsplitPane.setTopComponent(vvPanel); // ===================Tab Panel Setting======================= // progressPanel = new ProgressPanel(); verticesTable = new VerticesTable(); verticesTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = verticesTable.rowAtPoint(e.getPoint()); int col = verticesTable.columnAtPoint(e.getPoint()); // System.out.println(row + " " + col); String value = verticesTable.getValueAt(row, col).toString(); // System.out.println(value); if (Global.graph.containsVertex(new HitVertex(value))) { for (int i = 0; i < subSetList.size(); i++) { if (subSetList.get(i).contains(new HitVertex(value))) { curGraph = FilterUtils.createInducedSubgraph(subSetList.get(i), Global.graph); PickedState<HitVertex> pickedVertexState = vv.getPickedVertexState(); // picked is a reference to picked vertices // use a temp set to avoid concurrent modification Set<HitVertex> picked = pickedVertexState.getPicked(); Set<HitVertex> temp = new HashSet<HitVertex>(); for (HitVertex hitVertex : picked) { temp.add(hitVertex); } for (HitVertex hv : temp) { pickedVertexState.pick(hv, false); } pickedVertexState.pick(new HitVertex(value), true); // refreshSubGraphView(); return; } } } } }); verticesTable.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { int row = verticesTable.rowAtPoint(e.getPoint()); int col = verticesTable.columnAtPoint(e.getPoint()); String value = verticesTable.getValueAt(row, col).toString(); // System.out.println(value); if (Global.graph.containsVertex(value)) { Cursor normalCursor = new Cursor(Cursor.HAND_CURSOR); setCursor(normalCursor); } else { Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR); setCursor(normalCursor); } } }); verticesPanel = new JPanel(); verticesPanel.setLayout(new GridLayout()); verticesPanel.add(new JScrollPane(verticesTable)); edgesTable = new EdgesTable(); edgesPanel = new JPanel(); edgesPanel.setLayout(new GridLayout()); edgesPanel.add(new JScrollPane(edgesTable)); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Vertices", verticesPanel); tabbedPane.addTab("Edges", edgesPanel); vsplitPane.setBottomComponent(tabbedPane); graphMouse.addPichedChangeListener(verticesTable, edgesTable); // ===================Info Panel Setting=================== infoPanel = new JPanel(new GridBagLayout()); GridBagManager.GRID_BAG.weightx = 0.1; GridBagManager.GRID_BAG.weighty = 1; hsplitPane.setRightComponent(infoPanel); JPanel mainInfoPanel = new JPanel(new GridBagLayout()); mainInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Main Info")); JPanel currentInfoPanel = new JPanel(new GridBagLayout()); currentInfoPanel.setBorder( BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Current Graph")); JPanel selectedInfoPanel = new JPanel(new GridBagLayout()); selectedInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Selected")); JPanel statisticsInfoPanel = new JPanel(new GridBagLayout()); statisticsInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Statistics")); JPanel progressInfoPanel = new JPanel(new GridBagLayout()); progressInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Progress")); GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.HORIZONTAL; GridBagManager.GRID_BAG.weighty = 0; GridBagManager.add(infoPanel, mainInfoPanel, 0, 1, 1, 1); GridBagManager.add(infoPanel, currentInfoPanel, 0, 2, 1, 1); GridBagManager.add(infoPanel, selectedInfoPanel, 0, 3, 1, 1); GridBagManager.GRID_BAG.weighty = 0.5; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(infoPanel, statisticsInfoPanel, 0, 4, 1, 1); GridBagManager.add(infoPanel, progressInfoPanel, 0, 5, 1, 1); // mainInfoPanel { JLabel vertices = new JLabel("Vertices:"); vertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); edgeCountLabel = new JLabel("0"); JLabel subGraphs = new JLabel("SubGraphs:"); subGraphCountLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(mainInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(mainInfoPanel, edges, 0, 1, 1, 1); GridBagManager.add(mainInfoPanel, subGraphs, 0, 2, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(mainInfoPanel, vertexCountLabel, 1, 0, 1, 1); GridBagManager.add(mainInfoPanel, edgeCountLabel, 1, 1, 1, 1); GridBagManager.add(mainInfoPanel, subGraphCountLabel, 1, 2, 1, 1); } // end of mainInfoPanel // currentInfoPanel { JLabel vertices = new JLabel("Vertices:"); currentVertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); currentEdgeCountLabel = new JLabel("0"); JLabel acc = new JLabel("ACC:"); currentAccLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(currentInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(currentInfoPanel, edges, 0, 1, 1, 1); GridBagManager.add(currentInfoPanel, acc, 0, 2, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(currentInfoPanel, currentVertexCountLabel, 1, 0, 1, 1); GridBagManager.add(currentInfoPanel, currentEdgeCountLabel, 1, 1, 1, 1); GridBagManager.add(currentInfoPanel, currentAccLabel, 1, 2, 1, 1); } // end of currentInfoPanel // selectedInfoPanel { JLabel vertices = new JLabel("Vertices:"); selectedVertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); selectedEdgeCountLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(selectedInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(selectedInfoPanel, edges, 0, 1, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(selectedInfoPanel, selectedVertexCountLabel, 1, 0, 1, 1); GridBagManager.add(selectedInfoPanel, selectedEdgeCountLabel, 1, 1, 1, 1); CollectionChangeListener<HitVertex> svListener = new CollectionChangeListener<HitVertex>() { @Override public void onCollectionChange(Set<HitVertex> set) { selectedVertexCountLabel.setText("" + set.size()); } }; CollectionChangeListener<ValueEdge> veListener = new CollectionChangeListener<ValueEdge>() { @Override public void onCollectionChange(Set<ValueEdge> set) { selectedEdgeCountLabel.setText("" + set.size()); } }; graphMouse.addPichedChangeListener(svListener, veListener); } // end of selectedInfoPanel {// statistics Panel GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(statisticsInfoPanel, graphStatisticsPanel, 0, 0, 1, 1); } // statistics Panel {// progressInfoPanel GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(progressInfoPanel, progressPanel, 0, 0, 1, 1); } // progressInfoPanel // set frame size Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); setSize((screen.width * 3) / 4, (screen.height * 9) / 10); setLocation(screen.width / 6, screen.height / 16); refreshUI(false); }