List of usage examples for javax.swing JSplitPane setContinuousLayout
@BeanProperty(description = "Whether the child components are continuously redisplayed and laid out during user intervention.") public void setContinuousLayout(boolean newContinuousLayout)
continuousLayout
property, which must be true
for the child components to be continuously redisplayed and laid out during user intervention. From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Property Split"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setContinuousLayout(true); splitPane.setOneTouchExpandable(true); JComponent topComponent = new JButton("A"); splitPane.setTopComponent(topComponent); JComponent bottomComponent = new JButton("B"); splitPane.setBottomComponent(bottomComponent); frame.add(splitPane, BorderLayout.CENTER); frame.setSize(300, 150);// w w w.j a va2 s . co m frame.setVisible(true); }
From source file:PropertySplitPane.java
public static void main(String args[]) { JFrame frame = new JFrame("Property Split"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setContinuousLayout(true); splitPane.setOneTouchExpandable(true); JComponent topComponent = new JButton("A"); splitPane.setTopComponent(topComponent); JComponent bottomComponent = new JButton("B"); splitPane.setBottomComponent(bottomComponent); PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent changeEvent) { JSplitPane sourceSplitPane = (JSplitPane) changeEvent.getSource(); String propertyName = changeEvent.getPropertyName(); if (propertyName.equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) { int current = sourceSplitPane.getDividerLocation(); System.out.println("Current: " + current); Integer last = (Integer) changeEvent.getNewValue(); System.out.println("Last: " + last); Integer priorLast = (Integer) changeEvent.getOldValue(); System.out.println("Prior last: " + priorLast); }/*w ww . j a va2s. c o m*/ } }; splitPane.addPropertyChangeListener(propertyChangeListener); frame.add(splitPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton topComponent = new JButton("top"); JButton bottomComponent = new JButton("bottom"); JSplitPane vpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent); boolean b = vpane.isContinuousLayout(); // false by default // Set the split pane to continuously resize the child components which the divider is dragged vpane.setContinuousLayout(true); }
From source file:VerticalSplit.java
public static void main(String args[]) { JFrame vFrame = new JFrame("Vertical Split"); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent leftButton = new JButton("Left"); JComponent rightButton = new JButton("Right"); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setLeftComponent(leftButton); splitPane.setRightComponent(rightButton); ActionListener oneActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.resetToPreferredSizes(); }/* w w w. j ava2 s . c om*/ }; ((JButton) rightButton).addActionListener(oneActionListener); ActionListener anotherActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.setDividerLocation(10); splitPane.setContinuousLayout(true); } }; ((JButton) leftButton).addActionListener(anotherActionListener); vFrame.getContentPane().add(splitPane, BorderLayout.CENTER); vFrame.setSize(300, 150); vFrame.setVisible(true); }
From source file:ExpandableSplit.java
public static void main(String args[]) { String title = (args.length == 0 ? "Expandable Split" : args[0]); JFrame vFrame = new JFrame(title); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent leftButton = new JButton("Top"); JComponent rightButton = new JButton("Bottom"); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setLeftComponent(leftButton); splitPane.setRightComponent(rightButton); ActionListener oneActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.resetToPreferredSizes(); }/*w w w . j a v a 2 s . c o m*/ }; ((JButton) rightButton).addActionListener(oneActionListener); ActionListener anotherActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.setDividerLocation(10); splitPane.setContinuousLayout(true); } }; ((JButton) leftButton).addActionListener(anotherActionListener); vFrame.getContentPane().add(splitPane, BorderLayout.CENTER); vFrame.setSize(300, 150); vFrame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame vFrame = new JFrame("Vertical Split"); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent leftButton = new JButton("Left"); JComponent rightButton = new JButton("Right"); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setLeftComponent(leftButton); splitPane.setRightComponent(rightButton); ActionListener oneActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.resetToPreferredSizes(); }/*w w w.j a v a 2s . c o m*/ }; ((JButton) rightButton).addActionListener(oneActionListener); ActionListener anotherActionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { splitPane.setDividerLocation(10); splitPane.setContinuousLayout(true); } }; ((JButton) leftButton).addActionListener(anotherActionListener); HierarchyListener hierarchyListener = new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { long flags = e.getChangeFlags(); if ((flags & HierarchyEvent.SHOWING_CHANGED) == HierarchyEvent.SHOWING_CHANGED) { splitPane.setDividerLocation(.75); } } }; splitPane.addHierarchyListener(hierarchyListener); vFrame.add(splitPane, BorderLayout.CENTER); vFrame.setSize(300, 150); vFrame.setVisible(true); }
From source file:Test.java
public Test() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel1 = new JPanel(new GridLayout(1, 5)); for (int i = 0; i < 5; i++) { panel1.add(new JLabel("Left " + i)); }//from w ww. j a v a 2s .c o m panel1.setPreferredSize(new Dimension(250, 50)); JPanel panel2 = new JPanel(new GridLayout(1, 5)); for (int i = 0; i < 5; i++) { panel2.add(new JLabel("Right " + i)); } panel2.setPreferredSize(new Dimension(250, 50)); final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2); split.setContinuousLayout(true); getContentPane().add(split, BorderLayout.CENTER); pack(); setSize(500, 100); }
From source file:SplitSample.java
public SplitSample() { super("Simple Split Pane"); setSize(400, 400);// w ww .j ava 2s. c om getContentPane().setLayout(new BorderLayout()); JSplitPane spLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JPanel(), new JPanel()); spLeft.setDividerSize(8); spLeft.setContinuousLayout(true); JSplitPane spRight = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JPanel(), new JPanel()); spRight.setDividerSize(8); spRight.setContinuousLayout(true); split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, spLeft, spRight); split.setContinuousLayout(false); split.setOneTouchExpandable(true); getContentPane().add(split, BorderLayout.CENTER); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:SplitPaneTest.java
public SplitPaneFrame() { setTitle("SplitPaneTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // set up components for planet names, images, descriptions final JList planetList = new JList(planets); final JLabel planetImage = new JLabel(); final JTextArea planetDescription = new JTextArea(); planetList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { Planet value = (Planet) planetList.getSelectedValue(); // update image and description planetImage.setIcon(value.getImage()); planetDescription.setText(value.getDescription()); }/* ww w . ja va 2 s . c o m*/ }); // set up split panes JSplitPane innerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, planetList, planetImage); innerPane.setContinuousLayout(true); innerPane.setOneTouchExpandable(true); JSplitPane outerPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, innerPane, planetDescription); add(outerPane, BorderLayout.CENTER); }
From source file:com.choicemaker.cm.modelmaker.gui.panels.AsymmetricThresholdVsAccuracyPlotPanel.java
private void layoutPanel() { setLayout(new BorderLayout()); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setDividerSize(2);/*from w ww .jav a 2 s. c o m*/ splitPane.setContinuousLayout(true); splitPane.setDividerLocation(0.5d); splitPane.setResizeWeight(0.5f); splitPane.setOneTouchExpandable(true); ChartPanel dP = new ChartPanel(dPlot, false, false, false, true, true); // dP.setHorizontalZoom(true); // dP.setVerticalZoom(true); splitPane.setTopComponent(dP); ChartPanel mP = new ChartPanel(mPlot, false, false, false, true, true); // mP.setHorizontalZoom(true); // mP.setVerticalZoom(true); splitPane.setBottomComponent(mP); add(splitPane, BorderLayout.CENTER); }