List of usage examples for java.awt BorderLayout EAST
String EAST
To view the source code for java.awt BorderLayout EAST.
Click Source Link
From source file:TreeLines.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container content = frame.getContentPane(); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); tree1.putClientProperty("JTree.lineStyle", "Angled"); JScrollPane scrollPane1 = new JScrollPane(tree1); tree1.setAutoscrolls(true);/*from www . j a v a 2 s . com*/ JTree tree2 = new JTree(); JScrollPane scrollPane2 = new JScrollPane(tree2); box.add(scrollPane1, BorderLayout.WEST); box.add(scrollPane2, BorderLayout.EAST); frame.getContentPane().add(box, BorderLayout.CENTER); frame.setSize(300, 240); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(Main.class.getSimpleName()); DefaultTreeModel model = getTreeModel(); JTree tree1 = new JTree(model); JTree tree2 = new JTree(model); frame.add(new JScrollPane(tree1), BorderLayout.WEST); frame.add(new JScrollPane(tree2), BorderLayout.EAST); frame.pack();//from ww w. j av a2 s.co m frame.setSize(frame.getWidth() + 50, frame.getHeight() + 140); frame.setVisible(true); Timer t = new Timer(2000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); root.add(new DefaultMutableTreeNode("A new node")); model.nodesWereInserted(root, new int[] { root.getChildCount() - 1 }); tree1.expandRow(0); tree2.expandRow(0); frame.revalidate(); } }); t.start(); }
From source file:TryBorderLayout.java
public static void main(String[] args) { JFrame aWindow = new JFrame("This is a Border Layout"); aWindow.setBounds(30, 30, 300, 300); // Size aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BorderLayout border = new BorderLayout(); // Create a layout manager Container content = aWindow.getContentPane(); // Get the content pane content.setLayout(border); // Set the container layout mgr EtchedBorder edge = new EtchedBorder(EtchedBorder.RAISED); // Button border // Now add five JButton components and set their borders JButton button;/*from w ww . ja v a 2 s . co m*/ content.add(button = new JButton("EAST"), BorderLayout.EAST); button.setBorder(edge); content.add(button = new JButton("WEST"), BorderLayout.WEST); button.setBorder(edge); content.add(button = new JButton("NORTH"), BorderLayout.NORTH); button.setBorder(edge); content.add(button = new JButton("SOUTH"), BorderLayout.SOUTH); button.setBorder(edge); content.add(button = new JButton("CENTER"), BorderLayout.CENTER); button.setBorder(edge); aWindow.setVisible(true); // Display the window }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("UIDefaults Example"); frame.setDefaultCloseOperation(3);/*from w w w.j av a2 s.c om*/ Container c = frame.getContentPane(); UIManager.put("Button.background", Color.red); UIManager.put("Button.foreground", Color.white); Font f = new Font("Serif", Font.ITALIC, 24); UIManager.put("Button.font", f); JButton north = new JButton("North"); JButton south = new JButton("South"); JButton east = new JButton("East"); JButton west = new JButton("West"); JButton center = new JButton("Center"); c.add(north, BorderLayout.NORTH); c.add(south, BorderLayout.SOUTH); c.add(east, BorderLayout.EAST); c.add(west, BorderLayout.WEST); c.add(center, BorderLayout.CENTER); frame.pack(); frame.show(); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { String title = (args.length == 0 ? "Sample Slider" : args[0]); JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider js4 = new JSlider(JSlider.VERTICAL); Hashtable<Integer, JLabel> table = new Hashtable<Integer, JLabel>(); table.put(0, new JLabel("O")); table.put(10, new JLabel("Ten")); table.put(25, new JLabel("Twenty-Five")); table.put(34, new JLabel("Thirty-Four")); table.put(52, new JLabel("Fifty-Two")); table.put(70, new JLabel("Seventy")); table.put(82, new JLabel("Eighty-Two")); table.put(100, new JLabel("100")); js4.setLabelTable(table);/*from w ww . j av a 2 s . c o m*/ js4.setPaintLabels(true); js4.setSnapToTicks(true); frame.add(js4, BorderLayout.EAST); frame.setSize(300, 200); frame.setVisible(true); }
From source file:BorderLayoutExample.java
public static void main(String[] args) { BorderSample bs = new BorderSample(); bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container pane = bs.getContentPane(); pane.setLayout(new BorderLayout()); JLabel label = new JLabel("North", JLabel.CENTER); label.setFont(new Font("Courier", Font.BOLD, 36)); label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); pane.add(label, BorderLayout.NORTH); label = new JLabel("South", JLabel.CENTER); label.setFont(new Font("Courier", Font.BOLD, 36)); label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); pane.add(label, BorderLayout.SOUTH); label = new JLabel("East", JLabel.CENTER); label.setFont(new Font("Courier", Font.BOLD, 36)); label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); pane.add(label, BorderLayout.EAST); label = new JLabel("West", JLabel.CENTER); label.setFont(new Font("Courier", Font.BOLD, 36)); label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); pane.add(label, BorderLayout.WEST); label = new JLabel("Center", JLabel.CENTER); label.setFont(new Font("Courier", Font.BOLD, 36)); label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); pane.add(label, BorderLayout.CENTER); bs.setSize(400, 300);/*from w ww . j ava2 s .co m*/ bs.setVisible(true); }
From source file:MovingIconTest.java
public static void main(String args[]) { JFrame frame = new JFrame(); Container contentPane = frame.getContentPane(); JButton b;/*from w ww.j a v a 2 s . c o m*/ Icon icon = new PieIcon(Color.red); b = new JButton("Default", icon); contentPane.add(b, BorderLayout.NORTH); b = new JButton("Text Left", icon); b.setHorizontalTextPosition(JButton.LEFT); contentPane.add(b, BorderLayout.SOUTH); b = new JButton("Text Up", icon); b.setHorizontalTextPosition(JButton.CENTER); b.setVerticalTextPosition(JButton.TOP); contentPane.add(b, BorderLayout.EAST); b = new JButton("Text Down", icon); b.setHorizontalTextPosition(JButton.CENTER); b.setVerticalTextPosition(JButton.BOTTOM); contentPane.add(b, BorderLayout.WEST); b = new JButton("Align Bottom Left", icon); b.setHorizontalAlignment(JButton.LEFT); b.setVerticalAlignment(JButton.BOTTOM); contentPane.add(b, BorderLayout.CENTER); frame.setSize(300, 200); frame.show(); }
From source file:TickSliders.java
public static void main(String args[]) { JFrame f = new JFrame("Tick Slider"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // No Ticks/*from ww w .j a v a 2 s. com*/ JSlider jSliderOne = new JSlider(); // Major Tick 25 - Minor 5 JSlider jSliderTwo = new JSlider(); jSliderTwo.setMinorTickSpacing(5); jSliderTwo.setMajorTickSpacing(25); jSliderTwo.setPaintTicks(true); jSliderTwo.setSnapToTicks(true); // Major Tick 25 - Minor 6 JSlider jSliderThree = new JSlider(JSlider.VERTICAL); jSliderThree.setMinorTickSpacing(6); jSliderThree.setMajorTickSpacing(25); jSliderThree.setPaintTicks(true); JSlider jSliderFour = new JSlider(JSlider.VERTICAL); // Major Tick 25 - Minor 1 jSliderFour.setMinorTickSpacing(1); jSliderFour.setMajorTickSpacing(25); jSliderFour.setPaintTicks(true); Container c = f.getContentPane(); c.add(jSliderOne, BorderLayout.NORTH); c.add(jSliderTwo, BorderLayout.SOUTH); c.add(jSliderThree, BorderLayout.WEST); c.add(jSliderFour, BorderLayout.EAST); f.setSize(300, 200); f.setVisible(true); }
From source file:GroupRadio.java
public static void main(String args[]) { JFrame frame = new JFrame("Grouping Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container sliceContainer = RadioButtonUtils.createRadioButtonGrouping(sliceOptions, "Slice Count"); Container crustContainer = RadioButtonUtils.createRadioButtonGrouping(crustOptions, "Crust Type"); Container contentPane = frame.getContentPane(); contentPane.add(sliceContainer, BorderLayout.WEST); contentPane.add(crustContainer, BorderLayout.EAST); frame.setSize(300, 200);//from w w w. j a v a2s. c o m frame.setVisible(true); }
From source file:RadioButtonUtils.java
public static void main(String args[]) { JFrame frame = new JFrame("Grouping Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container sliceContainer = RadioButtonUtils.createRadioButtonGrouping(sliceOptions, "Slice Count"); Container crustContainer = RadioButtonUtils.createRadioButtonGrouping(crustOptions, "Crust Type"); frame.add(sliceContainer, BorderLayout.WEST); frame.add(crustContainer, BorderLayout.EAST); frame.setSize(300, 200);/*from w ww. j a v a 2 s. c om*/ frame.setVisible(true); }