List of usage examples for javax.swing JSplitPane VERTICAL_SPLIT
int VERTICAL_SPLIT
To view the source code for javax.swing JSplitPane VERTICAL_SPLIT.
Click Source Link
Component
s are split along the y axis. From source file:components.TreeDemo.java
public TreeDemo() { super(new GridLayout(1, 0)); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top);//www . j a va 2 s .c o m //Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); //Listen for when the selection changes. tree.addTreeSelectionListener(this); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); //Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); //Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); splitPane.setPreferredSize(new Dimension(500, 300)); //Add the split pane to this panel. add(splitPane); }
From source file:i18nplugin.TranslatorEditor.java
private void createGui() { setLayout(new FormLayout("fill:min:grow", "fill:min:grow, pref")); CellConstraints cc = new CellConstraints(); // Top//from w ww .j av a2s. co m PanelBuilder topPanel = new PanelBuilder(new FormLayout("fill:10dlu:grow", "pref, 5dlu, fill:pref:grow")); topPanel.setBorder(Borders.DLU4_BORDER); topPanel.addSeparator(mLocalizer.msg("original", "Original text"), cc.xy(1, 1)); mOriginal = new JTextArea(); mOriginal.setWrapStyleWord(false); mOriginal.setEditable(false); topPanel.add(new JScrollPane(mOriginal), cc.xy(1, 3)); // Bottom PanelBuilder bottomPanel = new PanelBuilder( new FormLayout("fill:10dlu:grow", "pref, 5dlu, fill:pref:grow")); bottomPanel.setBorder(Borders.DLU4_BORDER); bottomPanel.addSeparator(mLocalizer.msg("translation", "Translation"), cc.xy(1, 1)); mTranslation = new JTextArea(); mTranslation.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { updateState(); } public void insertUpdate(DocumentEvent e) { updateState(); } public void removeUpdate(DocumentEvent e) { updateState(); } }); mOriginal.setBackground(mTranslation.getBackground()); mOriginal.setForeground(mTranslation.getForeground()); bottomPanel.add(new JScrollPane(mTranslation), cc.xy(1, 3)); // Splitpane final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split.setBorder(null); split.setTopComponent(topPanel.getPanel()); split.setBottomComponent(bottomPanel.getPanel()); SwingUtilities.invokeLater(new Runnable() { public void run() { split.setDividerLocation(0.5); } }); add(split, cc.xy(1, 1)); // translation state PanelBuilder panel = new PanelBuilder(new FormLayout("pref, 2dlu, fill:10dlu:grow", "pref, 3dlu, pref")); panel.setBorder(Borders.DLU4_BORDER); panel.addSeparator(mLocalizer.msg("state", "State"), cc.xyw(1, 1, 3)); mIcon = new JLabel(); panel.add(mIcon, cc.xy(1, 3)); mState = new JLabel("-"); panel.add(mState, cc.xy(3, 3)); add(panel.getPanel(), cc.xy(1, 2)); }
From source file:com.joey.software.Tools.AScanViewerTool.java
public void createJPanel() { JSplitPane graphSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); graphSplit.setLeftComponent(previewPanel); graphSplit.setRightComponent(dataPanel); graphSplit.setOneTouchExpandable(true); graphSplit.setDividerLocation(400);/*from ww w . j a va 2s .c o m*/ JPanel graphHolder = new JPanel(new BorderLayout()); graphHolder.add(graphSplit, BorderLayout.CENTER); graphHolder.setBorder(BorderFactory.createTitledBorder("")); JPanel tool = new JPanel(new BorderLayout()); tool.add(saveCSVData, BorderLayout.SOUTH); tool.add(aScanType, BorderLayout.CENTER); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.add(graphHolder, BorderLayout.CENTER); leftPanel.add(tool, BorderLayout.SOUTH); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.setOneTouchExpandable(true); split.setRightComponent(imageViewPanel); split.setLeftComponent(leftPanel); split.setDividerLocation(600); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(split, BorderLayout.CENTER); getContentPane().setLayout(new BorderLayout()); getContentPane().add(mainPanel); aScanType.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { imageViewPanel.setViewType(aScanType.getSelectedIndex()); } }); saveCSVData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { File f = FileSelectionField.getUserFile(); f = FileOperations.renameFileType(f, "csv"); saveAScanData(f); } catch (Exception e1) { JOptionPane.showMessageDialog(null, "Error : " + e1.getLocalizedMessage(), "Error Saving Data", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } } }); }
From source file:com.sshtools.tunnel.PortForwardingPane.java
public PortForwardingPane(ActiveTunnelsSessionPanel sessionPanel) { super(new BorderLayout()); this.sessionPanel = sessionPanel; JPanel north = new JPanel(new BorderLayout()); table = new PortForwardingTable(model = new PortForwardingModel()); table.setShowGrid(false);/*from ww w .ja v a 2 s.co m*/ table.setShowHorizontalLines(false); table.setShowVerticalLines(false); table.setIntercellSpacing(new Dimension(0, 0)); table.setColumnSelectionAllowed(false); table.getColumnModel().getColumn(0).setMaxWidth(25); table.getColumnModel().getColumn(0).setMinWidth(25); table.getColumnModel().getColumn(1).setMaxWidth(60); table.getColumnModel().getColumn(1).setMinWidth(60); table.getColumnModel().getColumn(2).setMaxWidth(60); table.getColumnModel().getColumn(2).setMinWidth(60); table.getColumnModel().getColumn(3).setMaxWidth(150); table.getColumnModel().getColumn(3).setMinWidth(80); //table.getColumnModel().getColumn(4).setMaxWidth(150); //table.getColumnModel().getColumn(4).setMinWidth(80); table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); // Scroller for table JScrollPane scroller = new JScrollPane(table) { public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, 164); } }; // Create the active forward pane active = new ActiveChannelPane(); // Create the top panel JPanel top = new JPanel(new BorderLayout()); top.add(north, BorderLayout.NORTH); top.add(scroller, BorderLayout.CENTER); // Create the split pane for forward selection / active channels split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, active); split.setOneTouchExpandable(true); split.setDividerSize(7); // Create the panel add(split, BorderLayout.CENTER); // Hide the active channel display initially toggleActiveChannelDisplay(); // Initialise setClient(null); }
From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformXYScatterChart.java
public void init() { sliderPanel = new JPanel(); powerXSlider = new FloatSlider("PowerX", 1.0, -10.0, 10.0); powerXSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80)); powerXSlider.addObserver(this); powerXSlider.setToolTipText("Slider for adjusting the value of power for the axis."); sliderPanel.add(this.powerXSlider); powerYSlider = new FloatSlider("PowerY", 1.0, -10.0, 10.0); powerYSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80)); powerYSlider.addObserver(this); powerYSlider.setToolTipText("Slider for adjusting the value of power for the Y axis."); sliderPanel.add(this.powerYSlider); super.init(); toolBar = new JToolBar(); createActionComponents(toolBar);// w w w.j av a 2s. co m JPanel toolBarContainer = new JPanel(); toolBarContainer.add(toolBar); JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer, new JScrollPane(sliderPanel)); toolContainer.setContinuousLayout(true); toolContainer.setDividerLocation(0.6); this.getContentPane().add(toolContainer, BorderLayout.NORTH); }
From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java
public void init() { sliderPanel = new JPanel(); powerSlider = new FloatSlider("Power", 1.0, -10.0, 10.0); powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80)); powerSlider.addObserver(this); powerSlider.setToolTipText("Slider for adjusting the value of power."); sliderPanel.add(this.powerSlider); binSlider2 = new FloatSlider("Bin Size", 5, 1, 10); super.reset_BinSlider(); binSlider2.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80)); binSlider2.addObserver(this); binSlider2.setToolTipText("Slider for adjusting the bin size."); sliderPanel.add(this.binSlider2); mapDep = false;/*from w w w. j ava2 s .c o m*/ super.init(); indLabel.setText("Data"); // Y toolBar = new JToolBar(); createActionComponents(toolBar); JPanel toolBarContainer = new JPanel(); toolBarContainer.add(toolBar); JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer, new JScrollPane(sliderPanel)); toolContainer.setContinuousLayout(true); toolContainer.setDividerLocation(0.6); this.getContentPane().add(toolContainer, BorderLayout.NORTH); }
From source file:TreeDemo.java
public TreeDemo() { super(new GridLayout(1, 0)); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top);/*w w w.j a v a2s.com*/ //Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); //Listen for when the selection changes. tree.addTreeSelectionListener(this); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); //Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); //Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); //XXX: ignored in some releases //of Swing. bug 4101306 //workaround for bug 4101306: //treeView.setPreferredSize(new Dimension(100, 100)); splitPane.setPreferredSize(new Dimension(500, 300)); //Add the split pane to this panel. add(splitPane); }
From source file:events.TableListSelectionDemo.java
public TableListSelectionDemo() { super(new BorderLayout()); String[] columnNames = { "French", "Spanish", "Italian" }; String[][] tableData = { { "un", "uno", "uno" }, { "deux", "dos", "due" }, { "trois", "tres", "tre" }, { "quatre", "cuatro", "quattro" }, { "cinq", "cinco", "cinque" }, { "six", "seis", "sei" }, { "sept", "siete", "sette" } }; table = new JTable(tableData, columnNames); listSelectionModel = table.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); table.setSelectionModel(listSelectionModel); JScrollPane tablePane = new JScrollPane(table); //Build control area (use default FlowLayout). JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);/*from ww w. j a v a 2s. c o m*/ comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); //Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); JPanel tableContainer = new JPanel(new GridLayout(1, 1)); tableContainer.setBorder(BorderFactory.createTitledBorder("Table")); tableContainer.add(tablePane); tablePane.setPreferredSize(new Dimension(420, 130)); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(250, 50)); topHalf.setPreferredSize(new Dimension(200, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); //XXX: next line needed if bottomHalf is a scroll pane: //bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 110)); splitPane.add(bottomHalf); }
From source file:TreeIconDemo2.java
public TreeIconDemo2() { super(new GridLayout(1, 0)); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top);//w w w .j a va 2 s . co m //Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); //Enable tool tips. ToolTipManager.sharedInstance().registerComponent(tree); //Set the icon for leaf nodes. ImageIcon tutorialIcon = createImageIcon("images/middle.gif"); if (tutorialIcon != null) { tree.setCellRenderer(new MyRenderer(tutorialIcon)); } else { System.err.println("Tutorial icon missing; using default."); } //Listen for when the selection changes. tree.addTreeSelectionListener(this); //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); //Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); //Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); //XXX: ignored in some releases //of Swing. bug 4101306 //workaround for bug 4101306: //treeView.setPreferredSize(new Dimension(100, 100)); splitPane.setPreferredSize(new Dimension(500, 300)); //Add the split pane to this panel. add(splitPane); }
From source file:uk.co.petertribble.jangle.SnmpTreePanel.java
/** * Create a new SnmpTreePanel, starting exploration at the specified OID. * * @param startOID the OID to start from *///w ww . j a va2 s . c o m public SnmpTreePanel(String startOID) { this.startOID = startOID; setLayout(new BorderLayout()); jtpl = new JTabbedPane(); model = new DefaultListModel(); oidList = new ArrayList<SnmpObject>(); slist = new JList(model); slist.addListSelectionListener(this); slist.setCellRenderer(new SnmpListCellRenderer()); jtpl.add(SnmpResources.getString("SNMP.LIST.TEXT"), new JScrollPane(slist)); // we use explicit placement so the tabs can be manipulated later jtpr = new JTabbedPane(); // details tab jp1 = new JPanel(new BorderLayout()); jp2 = new JPanel(new BorderLayout()); tp = new JingleTextPane("text/plain"); jp1.add(new JScrollPane(tp)); // jp2 holds the chart jp2 = new JPanel(new BorderLayout()); JSplitPane jpt = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp1, jp2); jpt.setOneTouchExpandable(true); jpt.setDividerLocation(120); jtpr.insertTab(SnmpResources.getString("SNMP.DETAILS.TEXT"), (Icon) null, jpt, (String) null, TAB_D); tpdesc = new JingleTextPane("text/plain"); jtpr.insertTab(SnmpResources.getString("SNMP.ABOUT.TEXT"), (Icon) null, new JScrollPane(tpdesc), (String) null, TAB_A); // siblings tab tpsiblings = new JingleTextPane("text/plain"); jp3 = new JPanel(new BorderLayout()); jp3t = new JPanel(new BorderLayout()); JSplitPane jps = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp3t, jp3); jps.setOneTouchExpandable(true); jps.setDividerLocation(200); jtpr.insertTab(SnmpResources.getString("SNMP.SIBLINGS.TEXT"), (Icon) null, jps, (String) null, TAB_S); // cousins tab tpcousins = new JingleTextPane("text/plain"); jp4 = new JPanel(new BorderLayout()); jp4t = new JPanel(new BorderLayout()); JSplitPane jpc = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp4t, jp4); jpc.setOneTouchExpandable(true); jpc.setDividerLocation(200); jtpr.insertTab(SnmpResources.getString("SNMP.COUSINS.TEXT"), (Icon) null, jpc, (String) null, TAB_C); // split pane to hold the lot JSplitPane psplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtpl, jtpr); psplit.setOneTouchExpandable(true); psplit.setDividerLocation(200); add(psplit); }