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:Main.java
public static void main(String[] a) { int HORIZSPLIT = JSplitPane.HORIZONTAL_SPLIT; int VERTSPLIT = JSplitPane.VERTICAL_SPLIT; boolean continuousLayout = true; JLabel label1 = new JLabel("a"); JLabel label2 = new JLabel("b"); JLabel label3 = new JLabel("c"); JSplitPane splitPane1 = new JSplitPane(VERTSPLIT, continuousLayout, label1, label2); splitPane1.setOneTouchExpandable(true); splitPane1.setDividerSize(2);/* w ww .ja v a 2 s. c o m*/ splitPane1.setDividerLocation(0.5); JSplitPane splitPane2 = new JSplitPane(HORIZSPLIT, splitPane1, label3); splitPane2.setOneTouchExpandable(true); splitPane2.setDividerLocation(0.4); splitPane2.setDividerSize(2); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(splitPane2); frame.pack(); frame.setVisible(true); }
From source file:NestedJSplitPane.java
public static void main(String[] a) { int HORIZSPLIT = JSplitPane.HORIZONTAL_SPLIT; int VERTSPLIT = JSplitPane.VERTICAL_SPLIT; boolean continuousLayout = true; JLabel label1 = new JLabel("a"); JLabel label2 = new JLabel("b"); JLabel label3 = new JLabel("c"); JSplitPane splitPane1 = new JSplitPane(VERTSPLIT, continuousLayout, label1, label2); splitPane1.setOneTouchExpandable(true); splitPane1.setDividerSize(2);//from ww w . jav a 2 s.c om splitPane1.setDividerLocation(0.5); JSplitPane splitPane2 = new JSplitPane(HORIZSPLIT, splitPane1, label3); splitPane2.setOneTouchExpandable(true); splitPane2.setDividerLocation(0.4); splitPane2.setDividerSize(2); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(splitPane2); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton leftComponent = new JButton("left"); JButton rightComponent = new JButton("right"); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); int size = pane.getDividerSize(); size = 1;/*from w w w .ja v a 2 s . co m*/ pane.setDividerSize(size); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton leftComponent = new JButton("left"); JButton rightComponent = new JButton("right"); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); double weight = pane.getResizeWeight(); // 0.0 by default weight = 1D;/*from ww w .j a v a 2 s . c o m*/ pane.setResizeWeight(weight); weight = .5D; pane.setResizeWeight(weight); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton leftComponent = new JButton("left"); JButton rightComponent = new JButton("right"); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); int loc = pane.getDividerLocation(); loc = (int) ((pane.getBounds().getWidth() - pane.getDividerSize()) / 2); pane.setDividerLocation(loc);/*from w ww .ja v a 2s. c o m*/ double propLoc = .5D; pane.setDividerLocation(propLoc); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton leftComponent = new JButton("left"); JButton rightComponent = new JButton("right"); // Create a left-right split pane JSplitPane hpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); }
From source file:SwingSplitSample.java
public static void main(String args[]) { JFrame frame = new JFrame("JSplitPane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(); splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); frame.getContentPane().add(splitPane, BorderLayout.CENTER); frame.setSize(300, 200);/*from w w w.ja v a 2 s. c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { DefaultTableModel model = new DefaultTableModel(); JTable table1 = new JTable(model); JTable table2 = new JTable(model); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.add(new JScrollPane(table1)); splitPane.add(new JScrollPane(table2)); table1.getColumnModel().removeColumn(table1.getColumnModel().getColumn(0)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton leftComponent = new JButton("left"); JButton rightComponent = new JButton("right"); JButton topComponent = new JButton("top"); JButton bottomComponent = new JButton("bottom"); JSplitPane hpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); JSplitPane vpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent); leftComponent = (JButton) hpane.getLeftComponent(); rightComponent = (JButton) hpane.getRightComponent(); topComponent = (JButton) vpane.getTopComponent(); bottomComponent = (JButton) vpane.getBottomComponent(); hpane.setLeftComponent(topComponent); hpane.setRightComponent(bottomComponent); vpane.setTopComponent(leftComponent); vpane.setBottomComponent(rightComponent); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("SplitPaneFrame"); JLabel leftImage = new JLabel(new ImageIcon("a.gif")); Component left = new JScrollPane(leftImage); JLabel rightImage = new JLabel(new ImageIcon("b.gif")); Component right = new JScrollPane(rightImage); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); split.setDividerLocation(100);//from w w w . j av a 2 s . c o m frame.getContentPane().add(split); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 200); frame.setVisible(true); }