List of usage examples for javax.swing JSplitPane setDividerLocation
@BeanProperty(description = "The location of the divider.") public void setDividerLocation(int location)
From source file:com.diversityarrays.dal.server.SqlDialog.java
SqlDialog(JFrame owner, SqlDalDatabase db) { super(owner, "SQL", ModalityType.MODELESS); setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.database = db; runner = new DefaultBackgroundRunner("SQL Command", this); setGlassPane(runner.getBlockingPane()); sqlCommands.setFont(GuiUtil.createMonospacedFont(12)); includeHeadingsInCopy.addItemListener(new ItemListener() { @Override/*w w w .j a v a 2 s . co m*/ public void itemStateChanged(ItemEvent e) { boolean b = includeHeadingsInCopy.isSelected(); for (int n = tabbedPane.getTabCount(); --n >= 0;) { Component c = tabbedPane.getComponentAt(n); if (c instanceof SqlResultsPanel) { ((SqlResultsPanel) c).setIncludeHeadings(b); } } } }); tabbedPane.addContainerListener(new ContainerListener() { @Override public void componentRemoved(ContainerEvent e) { updateClosePanelAction(); } @Override public void componentAdded(ContainerEvent e) { updateClosePanelAction(); } }); updateClosePanelAction(); Box buttons = Box.createHorizontalBox(); buttons.add(Box.createHorizontalStrut(10)); buttons.add(new JButton(runAction)); buttons.add(Box.createHorizontalStrut(20)); buttons.add(new JButton(closePanelAction)); buttons.add(Box.createHorizontalGlue()); buttons.add(includeHeadingsInCopy); buttons.add(Box.createHorizontalStrut(10)); buttons.add(new JButton(helpAction)); buttons.add(Box.createHorizontalStrut(10)); JPanel top = new JPanel(new BorderLayout()); top.add(BorderLayout.CENTER, new JScrollPane(sqlCommands)); top.add(BorderLayout.SOUTH, buttons); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, tabbedPane); splitPane.setResizeWeight(0.25); setContentPane(splitPane); pack(); setSize(800, 600); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { splitPane.setDividerLocation(0.25); removeWindowListener(this); } }); }
From source file:cl.almejo.vsim.gui.SimWindow.java
public SimWindow(Circuit circuit) { _circuit = circuit;// w w w . jav a 2 s . c om _circuit.addCircuitEventListener(this); _canvas = new CircuitCanvas(_circuit); setBounds(100, 100, 800, 800); _displaysPane = new JTabbedPane(); CanvasScrollPane scrollPane = new CanvasScrollPane(_canvas); CenterCanvasButton panel = new CenterCanvasButton(); panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { SimWindow.this.getCanvas().center(); } }); scrollPane.addCorner(panel); JSplitPane rightSplitpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, _displaysPane); rightSplitpane.setOneTouchExpandable(true); rightSplitpane.setDividerLocation(600); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JSplitPane(JSplitPane.VERTICAL_SPLIT, getToolsPane(), new JPanel()), rightSplitpane); getContentPane().add(splitPane, BorderLayout.CENTER); JPanel statusBar = getStatusBar(); statusBar.add(new ZoomChanger(_canvas)); getContentPane().add(statusBar, BorderLayout.SOUTH); setVisible(true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addComponentListener(this); addWindowListener(this); _canvas.addMouseListener(this); _canvas.setZoom(1.0); _canvas.addMouseMotionListener(this); _canvas.resizeViewport(); addMenu(); addMainToolbar(); updateActionStates(); updateTitle(); }
From source file:ec.util.chart.swing.JTimeSeriesRendererSupportDemo.java
private Component createMissionControl() { ListSelectionModel seriesSelectionModel = new DefaultListSelectionModel(); JSplitPane result = ModernUI.withEmptyBorders(new JSplitPane(JSplitPane.VERTICAL_SPLIT, createSeriesTable(seriesSelectionModel), createObsTable(seriesSelectionModel))); result.getTopComponent().setMinimumSize(new Dimension(100, 100)); result.setDividerLocation(.5); return result; }
From source file:com.qspin.qtaste.ui.MainPanel.java
public void genUI() { try {/* w w w .j a v a2 s . c om*/ getContentPane().setLayout(new BorderLayout()); // prepare the top panel that contains the following panes: // - logo // - ConfigInfopanel // - Current Date/time JPanel topanel = new JPanel(new BorderLayout()); JPanel center = new JPanel(new GridBagLayout()); ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin"); JLabel iconlabel = new JLabel(topLeftLogo); mHeaderPanel = new ConfigInfoPanel(this); mTestCasePanel = new TestCasePane(this); mTestCampaignPanel = new TestCampaignMainPanel(this); mHeaderPanel.init(); GridBagLineAdder centeradder = new GridBagLineAdder(center); JLabel sep = new JLabel(" "); sep.setFont(ResourceManager.getInstance().getSmallFont()); sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor())); centeradder.setWeight(1.0f, 0.0f); centeradder.add(mHeaderPanel); // prepare the right panels containg the main information: // the right pane is selected through the tabbed pane: // - Test cases: management of test cases and test suites // - Test campaign: management of test campaigns // - Interactive: ability to invoke QTaste verbs one by one mRightPanels = new JPanel(new CardLayout()); mRightPanels.add(mTestCasePanel, "Test Cases"); mRightPanels.add(mTestCampaignPanel, "Test Campaign"); final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel(); mRightPanels.add(testInterractivePanel, "Interactive"); mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM); mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT)); TestCaseTree tct = new TestCaseTree(mTestCasePanel); JScrollPane sp2 = new JScrollPane(tct); mTreeTabsPanel.addTab("Test Cases", sp2); // add tree view for test campaign definition com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree( mTestCampaignPanel.getTreeTable()); JScrollPane sp3 = new JScrollPane(mtct); mTreeTabsPanel.addTab("Test Campaign", sp3); genMenu(tct); // add another tab contain used for Interactive mode TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel); JScrollPane spInter = new JScrollPane(jInteractive); mTreeTabsPanel.addTab("Interactive", spInter); // init will do the link between the tree view and the pane testInterractivePanel.init(); // Define the listener to display the pane depending on the selected tab mTreeTabsPanel.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex()); CardLayout rcl = (CardLayout) mRightPanels.getLayout(); rcl.show(mRightPanels, componentName); } }); mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getID() == TestCampaignMainPanel.RUN_ID) { if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) { // open the tab test cases SwingUtilities.invokeLater(new Runnable() { public void run() { mTreeTabsPanel.setSelectedIndex(0); mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX); } }); // update the buttons mTestCasePanel.setExecutingTestCampaign(true, ((TestCampaignMainPanel) e.getSource()).getExecutionThread()); mTestCasePanel.updateButtons(true); } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) { mTestCasePanel.setExecutingTestCampaign(false, null); mTestCasePanel.updateButtons(); } } } }); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels); splitPane.setDividerSize(4); GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); int mainHorizontalSplitDividerLocation = guiConfiguration .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285); splitPane.setDividerLocation(mainHorizontalSplitDividerLocation); splitPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("dividerLocation")) { GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); if (evt.getSource() instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) evt.getSource(); guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, splitPane.getDividerLocation()); try { guiConfiguration.save(); } catch (ConfigurationException ex) { logger.error("Error while saving GUI configuration: " + ex.getMessage()); } } } } }); topanel.add(iconlabel, BorderLayout.WEST); topanel.add(center); getContentPane().add(topanel, BorderLayout.NORTH); getContentPane().add(splitPane); this.pack(); this.setExtendedState(Frame.MAXIMIZED_BOTH); if (mTestSuiteDir != null) { DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir); if (testSuite != null) { testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour); setTestSuite(testSuite.getName()); mTestCasePanel.runTestSuite(testSuite, false); } } setVisible(true); //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT)); } catch (Exception e) { logger.fatal(e); e.printStackTrace(); TestEngine.shutdown(); System.exit(1); } }
From source file:org.angnysa.yaba.swing.BudgetFrame.java
private void layoutComponents() { setLayout(new BorderLayout()); JSplitPane subSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, new JScrollPane(transactionTable), new JScrollPane(reconciliationTable)); subSplitPane.setPreferredSize(new Dimension(400, 600)); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, subSplitPane, simulationPanel); splitPane.setPreferredSize(new Dimension(1000, 600)); add(splitPane, BorderLayout.CENTER); pack();/*from ww w. j a v a2 s. c om*/ subSplitPane.setDividerLocation(0.5); splitPane.setDividerLocation(0.4); }
From source file:edu.brown.gui.CatalogViewer.java
/** * //from w w w . j a va2s . co m */ protected void viewerInit() { // ---------------------------------------------- // MENU // ---------------------------------------------- JMenu menu; JMenuItem menuItem; // // File Menu // menu = new JMenu("File"); menu.getPopupMenu().setLightWeightPopupEnabled(false); menu.setMnemonic(KeyEvent.VK_F); menu.getAccessibleContext().setAccessibleDescription("File Menu"); menuBar.add(menu); menuItem = new JMenuItem("Open Catalog From File"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From File"); menuItem.addActionListener(this.menuHandler); menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_FILE); menu.add(menuItem); menuItem = new JMenuItem("Open Catalog From Jar"); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From Project Jar"); menuItem.addActionListener(this.menuHandler); menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_JAR); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem("Quit", KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Quit Program"); menuItem.addActionListener(this.menuHandler); menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.QUIT); menu.add(menuItem); // ---------------------------------------------- // CATALOG TREE PANEL // ---------------------------------------------- this.catalogTree = new JTree(); this.catalogTree.setEditable(false); this.catalogTree.setCellRenderer(new CatalogViewer.CatalogTreeRenderer()); this.catalogTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); this.catalogTree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) CatalogViewer.this.catalogTree .getLastSelectedPathComponent(); if (node == null) return; Object user_obj = node.getUserObject(); String new_text = ""; // <html>"; boolean text_mode = true; if (user_obj instanceof WrapperNode) { CatalogType catalog_obj = ((WrapperNode) user_obj).getCatalogType(); new_text += CatalogViewer.this.getAttributesText(catalog_obj); } else if (user_obj instanceof AttributesNode) { AttributesNode wrapper = (AttributesNode) user_obj; new_text += wrapper.getAttributes(); } else if (user_obj instanceof PlanTreeCatalogNode) { final PlanTreeCatalogNode wrapper = (PlanTreeCatalogNode) user_obj; text_mode = false; CatalogViewer.this.mainPanel.remove(0); CatalogViewer.this.mainPanel.add(wrapper.getPanel(), BorderLayout.CENTER); CatalogViewer.this.mainPanel.validate(); CatalogViewer.this.mainPanel.repaint(); if (SwingUtilities.isEventDispatchThread() == false) { SwingUtilities.invokeLater(new Runnable() { public void run() { wrapper.centerOnRoot(); } }); } else { wrapper.centerOnRoot(); } } else { new_text += CatalogViewer.this.getSummaryText(); } // Text Mode if (text_mode) { if (CatalogViewer.this.text_mode == false) { CatalogViewer.this.mainPanel.remove(0); CatalogViewer.this.mainPanel.add(CatalogViewer.this.textInfoPanel); } CatalogViewer.this.textInfoTextArea.setText(new_text); // Scroll to top CatalogViewer.this.textInfoTextArea.grabFocus(); } CatalogViewer.this.text_mode = text_mode; } }); this.generateCatalogTree(this.catalog, this.catalog_file_path.getName()); // // Text Information Panel // this.textInfoPanel = new JPanel(); this.textInfoPanel.setLayout(new BorderLayout()); this.textInfoTextArea = new JTextArea(); this.textInfoTextArea.setEditable(false); this.textInfoTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); this.textInfoTextArea.setText(this.getSummaryText()); this.textInfoTextArea.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO Auto-generated method stub } @Override public void focusGained(FocusEvent e) { CatalogViewer.this.scrollTextInfoToTop(); } }); this.textInfoScroller = new JScrollPane(this.textInfoTextArea); this.textInfoPanel.add(this.textInfoScroller, BorderLayout.CENTER); this.mainPanel = new JPanel(new BorderLayout()); this.mainPanel.add(textInfoPanel, BorderLayout.CENTER); // // Search Toolbar // JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BorderLayout()); JPanel innerSearchPanel = new JPanel(); innerSearchPanel.setLayout(new BoxLayout(innerSearchPanel, BoxLayout.X_AXIS)); innerSearchPanel.add(new JLabel("Search: ")); this.searchField = new JTextField(30); innerSearchPanel.add(this.searchField); searchPanel.add(innerSearchPanel, BorderLayout.EAST); this.searchField.addKeyListener(new KeyListener() { private String last = null; @Override public void keyReleased(KeyEvent e) { String value = CatalogViewer.this.searchField.getText().toLowerCase().trim(); if (!value.isEmpty() && (this.last == null || !this.last.equals(value))) { CatalogViewer.this.search(value); } this.last = value; } @Override public void keyTyped(KeyEvent e) { // Do nothing... } @Override public void keyPressed(KeyEvent e) { // Do nothing... } }); // Putting it all together JScrollPane scrollPane = new JScrollPane(this.catalogTree); JPanel topPanel = new JPanel(); topPanel.setLayout(new BorderLayout()); topPanel.add(searchPanel, BorderLayout.NORTH); topPanel.add(scrollPane, BorderLayout.CENTER); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topPanel, this.mainPanel); splitPane.setDividerLocation(400); this.add(splitPane, BorderLayout.CENTER); }
From source file:de.codesourcery.eve.skills.ui.components.impl.ImportMarketLogFileComponent.java
private JPanel createSplitPanePanel(JComponent top, JScrollPane bottom) { final JScrollPane resultPane = new JScrollPane(top); resultPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); resultPane.setMinimumSize(new Dimension(400, 150)); resultPane.setPreferredSize(new Dimension(600, 200)); bottom.setMinimumSize(new Dimension(100, 200)); bottom.setPreferredSize(new Dimension(600, 300)); final JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, bottom); // pane.setResizeWeight( 0.5 ); pane.setDividerLocation(200); pane.setContinuousLayout(true);/* w w w .j av a 2 s. c o m*/ final JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BorderLayout()); contentPanel.add(pane); return contentPanel; }
From source file:st.jigasoft.dbutil.view.DUReport.java
/** * Definer o tamanho padrao do divider/* w w w.ja v a 2 s . c o m*/ * W as width * H as Heigth * @param key * @param sepTableGarfico * @param parcent */ private void defineDivider(char key, JSplitPane sepTableGarfico, double parcent) { double cParcent = parcent / 100; int size = (key == 'H') ? sepTableGarfico.getHeight() : sepTableGarfico.getWidth(); int location = (int) (size * cParcent); sepTableGarfico.setDividerLocation(location); }
From source file:net.sf.nmedit.nomad.core.Nomad.java
void setupUI() { this.clipBoard = new Clipboard("nomad clipboard"); ApplicationClipboard.setApplicationClipboard(clipBoard); mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Nomad.sharedInstance().handleExit(); }//from w w w .ja v a 2 s.co m }); pageContainer = new DefaultDocumentManager(); Container contentPane = mainWindow.getContentPane(); explorerTree = new FileExplorerTree(); explorerTree.setFont(new Font("Arial", Font.PLAIN, 11)); explorerTree.createPopup(menuBuilder); JScrollPane explorerTreeScroller = new JScrollPane(explorerTree); toolPane = new JTabbedPane2(); toolPane.setCloseActionEnabled(false); toolPane.addTab("Explorer", getImage("/icons/eview16/filenav_nav.gif"), explorerTreeScroller); new DropTarget(contentPane, new URIListDropHandler() { public void uriListDropped(URI[] uriList) { for (URI uri : uriList) { try { File f = new File(uri); openOrSelect(f); } catch (IllegalArgumentException e) { // ignore } } } }); synthPane = new JTabbedPane2(); synthPane.setCloseActionEnabled(true); JSplitPane sidebarSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false); sidebarSplit.setTopComponent(toolPane); sidebarSplit.setBottomComponent(synthPane); sidebarSplit.setResizeWeight(0.8); sidebarSplit.setOneTouchExpandable(true); /* JComponent sidebar = new JPanel(new BorderLayout()); sidebar.setBorder(null); sidebar.add(sidebarSplit, BorderLayout.CENTER); */ if (!Platform.isFlavor(OS.MacOSFlavor)) { /* JToolBar tb = createQuickActionToolbar(); sidebar.add(tb, BorderLayout.NORTH);*/ } else { registerForMacOSXEvents(); } JSplitPane splitLR = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitLR.setResizeWeight(0); splitLR.setDividerLocation(200); splitLR.setRightComponent(pageContainer); splitLR.setLeftComponent(sidebarSplit); contentPane.setLayout(new BorderLayout()); contentPane.add(splitLR, BorderLayout.CENTER); if (contentPane instanceof JComponent) ((JComponent) contentPane).revalidate(); }
From source file:org.jfree.chart.demo.SuperDemo.java
private JPanel createChartDisplayPanel() { displayPanel = new JPanel(new BorderLayout()); chartContainer = new JPanel(new BorderLayout()); chartContainer.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); chartContainer.add(createNoDemoSelectedPanel()); descriptionContainer = new JPanel(new BorderLayout()); descriptionContainer.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); descriptionContainer.setPreferredSize(new Dimension(600, 140)); descriptionPane = new JTextPane(); descriptionPane.setEditable(false);//from w ww.ja v a 2 s . c o m JScrollPane jscrollpane = new JScrollPane(descriptionPane, 20, 31); descriptionContainer.add(jscrollpane); displayDescription("select.html"); JSplitPane jsplitpane = new JSplitPane(0); jsplitpane.setTopComponent(chartContainer); jsplitpane.setBottomComponent(descriptionContainer); displayPanel.add(jsplitpane); jsplitpane.setDividerLocation(0.75D); return displayPanel; }