List of usage examples for java.awt BorderLayout SOUTH
String SOUTH
To view the source code for java.awt BorderLayout SOUTH.
Click Source Link
From source file:JColorChooserSample.java
public static void main(String args[]) { JFrame frame = new JFrame("JColorChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel label = new JLabel("www.java2s.com", JLabel.CENTER); label.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 48)); frame.add(label, BorderLayout.SOUTH); final JColorChooser colorChooser = new JColorChooser(label.getBackground()); colorChooser.setBorder(BorderFactory.createTitledBorder("Pick Foreground Color")); frame.add(colorChooser, BorderLayout.CENTER); frame.pack();//from ww w . j av a 2s . com frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TestPane center = new TestPane(100, 100); frame.add(center);/*from w w w .j a va 2 s . co m*/ frame.add(new TestPane(100, 50), BorderLayout.NORTH); frame.add(new TestPane(100, 50), BorderLayout.SOUTH); frame.add(new TestPane(50, 100), BorderLayout.EAST); frame.add(new TestPane(50, 100), BorderLayout.WEST); System.out.println("Size beofre pack = " + frame.getSize() + "; " + center.getSize()); frame.pack(); System.out.println("Size after pack = " + frame.getSize() + "; " + center.getSize()); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JToggleButton Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JToggleButton("North"), BorderLayout.NORTH); f.add(new JToggleButton("East"), BorderLayout.EAST); f.add(new JToggleButton("West"), BorderLayout.WEST); f.add(new JToggleButton("Center"), BorderLayout.CENTER); f.add(new JToggleButton("South"), BorderLayout.SOUTH); f.setSize(300, 200);// w ww . j a v a 2 s .co m f.setVisible(true); }
From source file:Main.java
public static final void main(String[] args) { JFrame frame = new JFrame(); JPanel mainPanel = new JPanel(); JPanel buttonsPanel = new JPanel(); frame.add(mainPanel);/*from www. ja va 2 s . c om*/ frame.add(buttonsPanel, BorderLayout.SOUTH); String[] options = { "S", "G", "I", "T" }; JComboBox comboBox = new JComboBox(options); comboBox.setRenderer(new MyComboBoxRenderer("COUNTRY")); comboBox.setSelectedIndex(-1); mainPanel.add(comboBox); JButton clearSelectionButton = new JButton("Clear selection"); clearSelectionButton.addActionListener(e -> { comboBox.setSelectedIndex(-1); }); buttonsPanel.add(clearSelectionButton); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new BorderLayout()); JPanel panel2 = new JPanel(new BorderLayout()); panel2.add(new JButton("NORTH"), BorderLayout.NORTH); panel2.add(new JButton("CENTER")); panel.add(panel2);/*from w w w . j av a 2 s .com*/ panel.add(new JButton("SOUTH"), BorderLayout.SOUTH); panel.add(new JButton("EAST"), BorderLayout.EAST); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { final String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Selecting JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox comboBox = new JComboBox(labels); frame.add(comboBox, BorderLayout.SOUTH); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("Command: " + actionEvent.getActionCommand()); ItemSelectable is = (ItemSelectable) actionEvent.getSource(); System.out.println(", Selected: " + selectedString(is)); System.out.println(", Selected: " + new Date(actionEvent.getWhen())); }/*from w w w . jav a 2 s . c o m*/ }; comboBox.addActionListener(actionListener); frame.setSize(400, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("JSpinner Dates"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SpinnerModel model3 = new RolloverSpinnerListModel(new String[] { "a", "b", "c" }); JSpinner spinner3 = new JSpinner(model3); frame.add(spinner3, BorderLayout.SOUTH); frame.setSize(200, 90);/*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 args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Component rowTwo = Box.createHorizontalGlue(); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);//from ww w .j a v a 2s . c om f.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("Filled Slider"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider js1 = new JSlider(); js1.putClientProperty("JSlider.isFilled", Boolean.TRUE); JSlider js2 = new JSlider(); js2.putClientProperty("JSlider.isFilled", Boolean.FALSE); frame.getContentPane().add(js1, BorderLayout.NORTH); frame.getContentPane().add(js2, BorderLayout.SOUTH); frame.setSize(300, 200);/*w w w . j a va2s . c om*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); JButton jb1 = new JButton("Hello"); ButtonModel bm = jb1.getModel(); JButton jb2 = new JButton("World"); jb2.setModel(bm);// w w w . java2s . c om Container c = f.getContentPane(); c.add(jb1, BorderLayout.NORTH); c.add(jb2, BorderLayout.SOUTH); jb1.addActionListener(new MessageActionListener("Selected One")); jb2.addActionListener(new MessageActionListener("Selected Two")); f.pack(); f.show(); }