List of usage examples for javax.swing JSplitPane HORIZONTAL_SPLIT
int HORIZONTAL_SPLIT
To view the source code for javax.swing JSplitPane HORIZONTAL_SPLIT.
Click Source Link
Component
s are split along the x axis. From source file:op.tools.SYSTools.java
public static Integer getDividerInAbsolutePosition(JSplitPane mysplit, double pos) { int max;// w w w .ja va 2 s .com if (mysplit.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { max = mysplit.getWidth(); } else { max = mysplit.getHeight(); } return new Double(max * pos).intValue(); }
From source file:op.tools.SYSTools.java
public static Integer getDividerInAbsolutePosition(JideSplitPane mysplit, double pos) { int max;// w ww . j av a 2s . c om if (mysplit.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { max = mysplit.getWidth(); } else { max = mysplit.getHeight(); } return new Double(max * pos).intValue(); }
From source file:op.tools.SYSTools.java
public static Double getDividerInRelativePosition(JideSplitPane mysplit) { int max;/*from w ww.j a v a 2s .com*/ int pos = mysplit.getDividerLocation(0); if (mysplit.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { max = mysplit.getWidth(); } else { max = mysplit.getHeight(); } OPDE.debug("DIVIDER IN ABSOLUTE POSITION: " + pos); OPDE.debug("DIVIDER MAX POSITION: " + max); OPDE.debug("DIVIDER IN RELATIVE POSITION: " + new Double(pos) / new Double(max)); return new Double(pos) / new Double(max); }
From source file:org.apache.cayenne.modeler.editor.EditorView.java
private void initView() { // init widgets JButton collapseButton = getAction(CollapseTreeAction.class).buildButton(); collapseButton.setPreferredSize(new Dimension(30, 20)); JButton filterButton = getAction(FilterAction.class).buildButton(); filterButton.setPreferredSize(new Dimension(30, 20)); actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true); actionManager.getAction(FilterAction.class).setAlwaysOn(true); JToolBar barPanel = new JToolBar(); barPanel.setMinimumSize(new Dimension(75, 25)); barPanel.setBorder(BorderFactory.createEtchedBorder()); barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); barPanel.add(Box.createHorizontalStrut(3)); barPanel.add(filterButton);// w w w. ja va 2 s . c om barPanel.addSeparator(); barPanel.add(collapseButton); treePanel = new ProjectTreeView(eventController); treePanel.setMinimumSize(new Dimension(75, 180)); JPanel treeNavigatePanel = new JPanel(); treeNavigatePanel.setMinimumSize(new Dimension(75, 220)); treeNavigatePanel.setLayout(new BorderLayout()); treeNavigatePanel.add(treePanel, BorderLayout.CENTER); this.detailPanel = new JPanel(); this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); this.leftPanel = new JPanel(new BorderLayout()); // assemble... this.detailLayout = new CardLayout(); detailPanel.setLayout(detailLayout); // some but not all panels must be wrapped in a scroll pane // those that are not wrapped usually have there own scrollers // in subpanels... detailPanel.add(new JPanel(), EMPTY_VIEW); dataDomainView = new DataDomainTabbedView(eventController); detailPanel.add(dataDomainView, DOMAIN_VIEW); DataNodeEditor nodeController = new DataNodeEditor(eventController); detailPanel.add(nodeController.getView(), NODE_VIEW); dataNodeView = nodeController.getTabComponent(); dataMapView = new DataMapTabbedView(eventController); detailPanel.add(dataMapView, DATA_MAP_VIEW); procedureView = new ProcedureTabbedView(eventController); detailPanel.add(procedureView, PROCEDURE_VIEW); selectQueryView = new SelectQueryTabbedView(eventController); detailPanel.add(selectQueryView, SELECT_QUERY_VIEW); sqlTemplateView = new SQLTemplateTabbedView(eventController); detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW); Component procedureQueryView = new ProcedureQueryView(eventController); detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW); ejbqlQueryView = new EjbqlTabbedView(eventController); detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW); embeddableView = new EmbeddableTabbedView(eventController); detailPanel.add(embeddableView, EMBEDDABLE_VIEW); objDetailView = new ObjEntityTabbedView(eventController); detailPanel.add(objDetailView, OBJ_VIEW); dbDetailView = new DbEntityTabbedView(eventController); detailPanel.add(dbDetailView, DB_VIEW); leftPanel.add(barPanel, BorderLayout.NORTH); leftPanel.add(new JScrollPane(treeNavigatePanel), BorderLayout.CENTER); splitPane.setLeftComponent(leftPanel); splitPane.setRightComponent(detailPanel); setLayout(new BorderLayout()); add(splitPane, BorderLayout.CENTER); }
From source file:org.apache.jackrabbit.oak.explorer.Explorer.java
private void createAndShowGUI(final File path, boolean skipSizeCheck) throws IOException { JTextArea log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setLineWrap(true);/*from w w w . j a v a 2 s .c om*/ log.setEditable(false); final NodeStoreTree treePanel = new NodeStoreTree(backend, log, skipSizeCheck); final JFrame frame = new JFrame("Explore " + path + " @head"); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { IOUtils.closeQuietly(treePanel); System.exit(0); } }); JPanel content = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(treePanel), new JScrollPane(log)); splitPane.setDividerLocation(0.3); content.add(new JScrollPane(splitPane), c); frame.getContentPane().add(content); JMenuBar menuBar = new JMenuBar(); menuBar.setMargin(new Insets(2, 2, 2, 2)); JMenuItem menuReopen = new JMenuItem("Reopen"); menuReopen.setMnemonic(KeyEvent.VK_R); menuReopen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { treePanel.reopen(); } catch (IOException e) { throw new RuntimeException(e); } } }); JMenuItem menuCompaction = new JMenuItem("Time Machine"); menuCompaction.setMnemonic(KeyEvent.VK_T); menuCompaction.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> revs = backend.readRevisions(); String s = (String) JOptionPane.showInputDialog(frame, "Revert to a specified revision", "Time Machine", JOptionPane.PLAIN_MESSAGE, null, revs.toArray(), revs.get(0)); if (s != null && treePanel.revert(s)) { frame.setTitle("Explore " + path + " @" + s); } } }); JMenuItem menuRefs = new JMenuItem("Tar File Info"); menuRefs.setMnemonic(KeyEvent.VK_I); menuRefs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> tarFiles = new ArrayList<String>(); for (File f : path.listFiles()) { if (f.getName().endsWith(".tar")) { tarFiles.add(f.getName()); } } String s = (String) JOptionPane.showInputDialog(frame, "Choose a tar file", "Tar File Info", JOptionPane.PLAIN_MESSAGE, null, tarFiles.toArray(), tarFiles.get(0)); if (s != null) { treePanel.printTarInfo(s); } } }); JMenuItem menuSCR = new JMenuItem("Segment Refs"); menuSCR.setMnemonic(KeyEvent.VK_R); menuSCR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "Segment References\nUsage: <segmentId>", "Segment References", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printSegmentReferences(s); } } }); JMenuItem menuDiff = new JMenuItem("SegmentNodeState diff"); menuDiff.setMnemonic(KeyEvent.VK_D); menuDiff.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "SegmentNodeState diff\nUsage: <recordId> <recordId> [<path>]", "SegmentNodeState diff", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printDiff(s); } } }); JMenuItem menuPCM = new JMenuItem("Persisted Compaction Maps"); menuPCM.setMnemonic(KeyEvent.VK_P); menuPCM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { treePanel.printPCMInfo(); } }); menuBar.add(menuReopen); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuCompaction); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuRefs); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuSCR); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuDiff); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuPCM); menuBar.add(new JSeparator(JSeparator.VERTICAL)); frame.setJMenuBar(menuBar); frame.pack(); frame.setSize(960, 720); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:org.apache.jmeter.gui.MainFrame.java
/** * Create the GUI components and layout. *///from w w w .j ava2 s . c o m private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) menuBar = new JMeterMenuBar(); setJMenuBar(menuBar); JPanel all = new JPanel(new BorderLayout()); all.add(createToolBar(), BorderLayout.NORTH); JSplitPane treeAndMain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); treePanel = createTreePanel(); treeAndMain.setLeftComponent(treePanel); JSplitPane topAndDown = new JSplitPane(JSplitPane.VERTICAL_SPLIT); topAndDown.setOneTouchExpandable(true); topAndDown.setDividerLocation(0.8); topAndDown.setResizeWeight(.8); topAndDown.setContinuousLayout(true); topAndDown.setBorder(null); // see bug jdk 4131528 if (!DISPLAY_LOGGER_PANEL) { topAndDown.setDividerSize(0); } mainPanel = createMainPanel(); logPanel = createLoggerPanel(); errorsAndFatalsCounterLogTarget = new ErrorsAndFatalsCounterLogTarget(); LoggingManager.addLogTargetToRootLogger(new LogTarget[] { logPanel, errorsAndFatalsCounterLogTarget }); topAndDown.setTopComponent(mainPanel); topAndDown.setBottomComponent(logPanel); treeAndMain.setRightComponent(topAndDown); treeAndMain.setResizeWeight(.2); treeAndMain.setContinuousLayout(true); all.add(treeAndMain, BorderLayout.CENTER); getContentPane().add(all); tree.setSelectionRow(1); addWindowListener(new WindowHappenings()); // Building is complete, register as listener GuiPackage.getInstance().registerAsListener(); setTitle(DEFAULT_TITLE); setIconImage(JMeterUtils.getImage("icon-apache.png").getImage());// $NON-NLS-1$ setWindowTitle(); // define AWT WM_CLASS string }
From source file:org.apache.jmeter.visualizers.ViewResultsFullVisualizer.java
/** * Initialize this visualizer//from ww w . j a v a2 s . c o m */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) log.debug("init() - pass"); setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); leftSide = createLeftPanel(); // Prepare the common tab rightSide = new JTabbedPane(); // Create the split pane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSide, rightSide); mainSplit.setOneTouchExpandable(true); JSplitPane searchAndMainSP = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new SearchTreePanel(root), mainSplit); searchAndMainSP.setOneTouchExpandable(true); add(searchAndMainSP, BorderLayout.CENTER); // init right side with first render resultsRender.setRightSide(rightSide); resultsRender.init(); }
From source file:org.apache.log4j.chainsaw.LogUI.java
/** * Activates itself as a viewer by configuring Size, and location of itself, * and configures the default Tabbed Pane elements with the correct layout, * table columns, and sets itself viewable. *///from w w w . j a v a2 s. c o m public void activateViewer() { LoggerRepository repo = LogManager.getLoggerRepository(); if (repo instanceof LoggerRepositoryEx) { this.pluginRegistry = ((LoggerRepositoryEx) repo).getPluginRegistry(); } initGUI(); initPrefModelListeners(); /** * We add a simple appender to the MessageCenter logger * so that each message is displayed in the Status bar */ MessageCenter.getInstance().getLogger().addAppender(new AppenderSkeleton() { protected void append(LoggingEvent event) { getStatusBar().setMessage(event.getMessage().toString()); } public void close() { } public boolean requiresLayout() { return false; } }); initSocketConnectionListener(); if (pluginRegistry.getPlugins(Receiver.class).size() == 0) { noReceiversDefined = true; } getFilterableColumns().add(ChainsawConstants.LEVEL_COL_NAME); getFilterableColumns().add(ChainsawConstants.LOGGER_COL_NAME); getFilterableColumns().add(ChainsawConstants.THREAD_COL_NAME); getFilterableColumns().add(ChainsawConstants.NDC_COL_NAME); getFilterableColumns().add(ChainsawConstants.PROPERTIES_COL_NAME); getFilterableColumns().add(ChainsawConstants.CLASS_COL_NAME); getFilterableColumns().add(ChainsawConstants.METHOD_COL_NAME); getFilterableColumns().add(ChainsawConstants.FILE_COL_NAME); getFilterableColumns().add(ChainsawConstants.NONE_COL_NAME); JPanel panePanel = new JPanel(); panePanel.setLayout(new BorderLayout(2, 2)); getContentPane().setLayout(new BorderLayout()); getTabbedPane().addChangeListener(getToolBarAndMenus()); getTabbedPane().addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { LogPanel thisLogPanel = getCurrentLogPanel(); if (thisLogPanel != null) { thisLogPanel.updateStatusBar(); } } }); KeyStroke ksRight = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); KeyStroke ksLeft = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); KeyStroke ksGotoLine = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()); getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ksRight, "MoveRight"); getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ksLeft, "MoveLeft"); getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ksGotoLine, "GotoLine"); Action moveRight = new AbstractAction() { public void actionPerformed(ActionEvent e) { int temp = getTabbedPane().getSelectedIndex(); ++temp; if (temp != getTabbedPane().getTabCount()) { getTabbedPane().setSelectedTab(temp); } } }; Action moveLeft = new AbstractAction() { public void actionPerformed(ActionEvent e) { int temp = getTabbedPane().getSelectedIndex(); --temp; if (temp > -1) { getTabbedPane().setSelectedTab(temp); } } }; Action gotoLine = new AbstractAction() { public void actionPerformed(ActionEvent e) { String inputLine = JOptionPane.showInputDialog(LogUI.this, "Enter the line number to go:", "Goto Line", -1); try { int lineNumber = Integer.parseInt(inputLine); int row = getCurrentLogPanel().setSelectedEvent(lineNumber); if (row == -1) { JOptionPane.showMessageDialog(LogUI.this, "You have entered an invalid line number", "Error", 0); } } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog(LogUI.this, "You have entered an invalid line number", "Error", 0); } } }; getTabbedPane().getActionMap().put("MoveRight", moveRight); getTabbedPane().getActionMap().put("MoveLeft", moveLeft); getTabbedPane().getActionMap().put("GotoLine", gotoLine); /** * We listen for double clicks, and auto-undock currently selected Tab if * the mouse event location matches the currently selected tab */ getTabbedPane().addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if ((e.getClickCount() > 1) && ((e.getModifiers() & InputEvent.BUTTON1_MASK) > 0)) { int tabIndex = getTabbedPane().getSelectedIndex(); if ((tabIndex != -1) && (tabIndex == getTabbedPane().getSelectedIndex())) { LogPanel logPanel = getCurrentLogPanel(); if (logPanel != null) { logPanel.undock(); } } } } }); panePanel.add(getTabbedPane()); addWelcomePanel(); getContentPane().add(toolbar, BorderLayout.NORTH); getContentPane().add(statusBar, BorderLayout.SOUTH); mainReceiverSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panePanel, receiversPanel); dividerSize = mainReceiverSplitPane.getDividerSize(); mainReceiverSplitPane.setDividerLocation(-1); getContentPane().add(mainReceiverSplitPane, BorderLayout.CENTER); /** * We need to make sure that all the internal GUI components have been added to the * JFrame so that any plugns that get activated during initPlugins(...) method * have access to inject menus */ initPlugins(pluginRegistry); mainReceiverSplitPane.setResizeWeight(1.0); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { exit(); } }); preferencesFrame.setTitle("'Application-wide Preferences"); preferencesFrame.setIconImage(((ImageIcon) ChainsawIcons.ICON_PREFERENCES).getImage()); preferencesFrame.getContentPane().add(applicationPreferenceModelPanel); preferencesFrame.setSize(750, 520); Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); preferencesFrame.setLocation(new Point((screenDimension.width / 2) - (preferencesFrame.getSize().width / 2), (screenDimension.height / 2) - (preferencesFrame.getSize().height / 2))); pack(); final JPopupMenu tabPopup = new JPopupMenu(); final Action hideCurrentTabAction = new AbstractAction("Hide") { public void actionPerformed(ActionEvent e) { Component selectedComp = getTabbedPane().getSelectedComponent(); if (selectedComp instanceof LogPanel) { displayPanel(getCurrentLogPanel().getIdentifier(), false); tbms.stateChange(); } else { getTabbedPane().remove(selectedComp); } } }; final Action hideOtherTabsAction = new AbstractAction("Hide Others") { public void actionPerformed(ActionEvent e) { Component selectedComp = getTabbedPane().getSelectedComponent(); String currentName; if (selectedComp instanceof LogPanel) { currentName = getCurrentLogPanel().getIdentifier(); } else if (selectedComp instanceof WelcomePanel) { currentName = ChainsawTabbedPane.WELCOME_TAB; } else { currentName = ChainsawTabbedPane.ZEROCONF; } int count = getTabbedPane().getTabCount(); int index = 0; for (int i = 0; i < count; i++) { String name = getTabbedPane().getTitleAt(index); if (getPanelMap().keySet().contains(name) && !name.equals(currentName)) { displayPanel(name, false); tbms.stateChange(); } else { index++; } } } }; Action showHiddenTabsAction = new AbstractAction("Show All Hidden") { public void actionPerformed(ActionEvent e) { for (Iterator iter = getPanels().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Boolean docked = (Boolean) entry.getValue(); if (docked.booleanValue()) { String identifier = (String) entry.getKey(); int count = getTabbedPane().getTabCount(); boolean found = false; for (int i = 0; i < count; i++) { String name = getTabbedPane().getTitleAt(i); if (name.equals(identifier)) { found = true; break; } } if (!found) { displayPanel(identifier, true); tbms.stateChange(); } } } } }; tabPopup.add(hideCurrentTabAction); tabPopup.add(hideOtherTabsAction); tabPopup.addSeparator(); tabPopup.add(showHiddenTabsAction); final PopupListener tabPopupListener = new PopupListener(tabPopup); getTabbedPane().addMouseListener(tabPopupListener); this.handler.addPropertyChangeListener("dataRate", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { double dataRate = ((Double) evt.getNewValue()).doubleValue(); statusBar.setDataRate(dataRate); } }); getSettingsManager().addSettingsListener(this); getSettingsManager().addSettingsListener(MRUFileListPreferenceSaver.getInstance()); getSettingsManager().addSettingsListener(receiversPanel); try { //if an uncaught exception is thrown, allow the UI to continue to load getSettingsManager().loadSettings(); } catch (Exception e) { e.printStackTrace(); } //app preferences have already been loaded (and configuration url possibly set to blank if being overridden) //but we need a listener so the settings will be saved on exit (added after loadsettings was called) getSettingsManager().addSettingsListener(new ApplicationPreferenceModelSaver(applicationPreferenceModel)); setVisible(true); if (applicationPreferenceModel.isReceivers()) { showReceiverPanel(); } else { hideReceiverPanel(); } removeSplash(); synchronized (initializationLock) { isGUIFullyInitialized = true; initializationLock.notifyAll(); } if (noReceiversDefined && applicationPreferenceModel.isShowNoReceiverWarning()) { SwingHelper.invokeOnEDT(new Runnable() { public void run() { showReceiverConfigurationPanel(); } }); } Container container = tutorialFrame.getContentPane(); final JEditorPane tutorialArea = new JEditorPane(); tutorialArea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); tutorialArea.setEditable(false); container.setLayout(new BorderLayout()); try { tutorialArea.setPage(ChainsawConstants.TUTORIAL_URL); JTextComponentFormatter.applySystemFontAndSize(tutorialArea); container.add(new JScrollPane(tutorialArea), BorderLayout.CENTER); } catch (Exception e) { MessageCenter.getInstance().getLogger().error("Error occurred loading the Tutorial", e); } tutorialFrame.setIconImage(new ImageIcon(ChainsawIcons.HELP).getImage()); tutorialFrame.setSize(new Dimension(640, 480)); final Action startTutorial = new AbstractAction("Start Tutorial", new ImageIcon(ChainsawIcons.ICON_RESUME_RECEIVER)) { public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(null, "This will start 3 \"Generator\" receivers for use in the Tutorial. Is that ok?", "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { new Thread(new Tutorial()).start(); putValue("TutorialStarted", Boolean.TRUE); } else { putValue("TutorialStarted", Boolean.FALSE); } } }; final Action stopTutorial = new AbstractAction("Stop Tutorial", new ImageIcon(ChainsawIcons.ICON_STOP_RECEIVER)) { public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(null, "This will stop all of the \"Generator\" receivers used in the Tutorial, but leave any other Receiver untouched. Is that ok?", "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { new Thread(new Runnable() { public void run() { LoggerRepository repo = LogManager.getLoggerRepository(); if (repo instanceof LoggerRepositoryEx) { PluginRegistry pluginRegistry = ((LoggerRepositoryEx) repo).getPluginRegistry(); List list = pluginRegistry.getPlugins(Generator.class); for (Iterator iter = list.iterator(); iter.hasNext();) { Plugin plugin = (Plugin) iter.next(); pluginRegistry.stopPlugin(plugin.getName()); } } } }).start(); setEnabled(false); startTutorial.putValue("TutorialStarted", Boolean.FALSE); } } }; stopTutorial.putValue(Action.SHORT_DESCRIPTION, "Removes all of the Tutorials Generator Receivers, leaving all other Receivers untouched"); startTutorial.putValue(Action.SHORT_DESCRIPTION, "Begins the Tutorial, starting up some Generator Receivers so you can see Chainsaw in action"); stopTutorial.setEnabled(false); final SmallToggleButton startButton = new SmallToggleButton(startTutorial); PropertyChangeListener pcl = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { stopTutorial.setEnabled(((Boolean) startTutorial.getValue("TutorialStarted")).equals(Boolean.TRUE)); startButton.setSelected(stopTutorial.isEnabled()); } }; startTutorial.addPropertyChangeListener(pcl); stopTutorial.addPropertyChangeListener(pcl); pluginRegistry.addPluginListener(new PluginListener() { public void pluginStarted(PluginEvent e) { } public void pluginStopped(PluginEvent e) { List list = pluginRegistry.getPlugins(Generator.class); if (list.size() == 0) { startTutorial.putValue("TutorialStarted", Boolean.FALSE); } } }); final SmallButton stopButton = new SmallButton(stopTutorial); final JToolBar tutorialToolbar = new JToolBar(); tutorialToolbar.setFloatable(false); tutorialToolbar.add(startButton); tutorialToolbar.add(stopButton); container.add(tutorialToolbar, BorderLayout.NORTH); tutorialArea.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e.getDescription().equals("StartTutorial")) { startTutorial.actionPerformed(null); } else if (e.getDescription().equals("StopTutorial")) { stopTutorial.actionPerformed(null); } else { try { tutorialArea.setPage(e.getURL()); } catch (IOException e1) { MessageCenter.getInstance().getLogger() .error("Failed to change the URL for the Tutorial", e1); } } } } }); /** * loads the saved tab settings and if there are hidden tabs, * hide those tabs out of currently loaded tabs.. */ if (!getTabbedPane().tabSetting.isWelcome()) { displayPanel(ChainsawTabbedPane.WELCOME_TAB, false); } if (!getTabbedPane().tabSetting.isZeroconf()) { displayPanel(ChainsawTabbedPane.ZEROCONF, false); } tbms.stateChange(); }
From source file:org.ayound.js.debug.ui.DebugMainFrame.java
private void initMainLayout() { final JSplitPane bottomSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createMainPane(), createDebugPane());//from ww w . j av a 2 s . co m bottomSplit.setDividerLocation(0.7); final JSplitPane totalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, createDebugContextPane(), bottomSplit); totalSplit.setDividerLocation(0.25); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { bottomSplit.setDividerLocation(0.7); totalSplit.setDividerLocation(0.25); } }); add(totalSplit); }
From source file:org.bigwiv.blastgraph.gui.BlastGraphFrame.java
private void initComponents() { URL icon;/*from ww w .ja va2s . c om*/ 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); }