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:SelectingComboSample.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F" }; JFrame frame = new JFrame("Selecting JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox comboBox = new JComboBox(labels); frame.add(comboBox, BorderLayout.SOUTH); JComboBox.KeySelectionManager manager = new JComboBox.KeySelectionManager() { public int selectionForKey(char aKey, ComboBoxModel aModel) { System.out.println(aKey); return -1; }// ww w. ja v a2 s. c o m }; comboBox.setKeySelectionManager(manager); frame.setSize(400, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Popup JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new BasicArrowButton(BasicArrowButton.NORTH), BorderLayout.NORTH); frame.add(new BasicArrowButton(BasicArrowButton.EAST), BorderLayout.EAST); frame.add(new BasicArrowButton(BasicArrowButton.SOUTH), BorderLayout.SOUTH); frame.add(new BasicArrowButton(BasicArrowButton.WEST), BorderLayout.WEST); frame.setSize(300, 200);/*from ww w. j ava2s.co m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); MyTextArea txt = new MyTextArea(); f.getContentPane().add(txt);/*www. j a va2 s . com*/ f.getContentPane().add(new JButton("OK"), BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("BorderLayout Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = frame.getContentPane(); // Add a button to each of the five areas of the BorderLayout container.add(new JButton("North"), BorderLayout.NORTH); container.add(new JButton("South"), BorderLayout.SOUTH); container.add(new JButton("East"), BorderLayout.EAST); container.add(new JButton("West"), BorderLayout.WEST); container.add(new JButton("Center"), BorderLayout.CENTER); frame.pack();// ww w.ja v a 2s.c o m 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)); }/*from w w w . ja va 2 s. c o m*/ }; comboBox.addActionListener(actionListener); frame.setSize(400, 200); frame.setVisible(true); }
From source file:FormattedTest.java
public static void main(String args[]) { JFrame frame = new JFrame("Formatted"); Container contentPane = frame.getContentPane(); JFormattedTextField ftf1 = new JFormattedTextField(new Integer(0)); contentPane.add(ftf1, BorderLayout.NORTH); JFormattedTextField ftf2 = new JFormattedTextField(new Date()); contentPane.add(ftf2, BorderLayout.SOUTH); frame.setSize(200, 100);/*from w ww. j a va 2 s. c om*/ frame.show(); }
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)); }/*www .j av a 2s . c o m*/ }; comboBox.addActionListener(actionListener); comboBox.removeActionListener(actionListener); frame.setSize(400, 200); 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); ItemListener itemListener = new ItemListener() { public void itemStateChanged(ItemEvent itemEvent) { int state = itemEvent.getStateChange(); String stateString = ((state == ItemEvent.SELECTED) ? "Selected" : "Deselected"); System.out.println("Item: " + itemEvent.getItem()); System.out.println(", State: " + stateString); ItemSelectable is = itemEvent.getItemSelectable(); System.out.println(", Selected: " + selectedString(is)); }//from w w w . jav a 2s . co m }; comboBox.addItemListener(itemListener); frame.setSize(400, 200); 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("paramString:" + actionEvent.paramString()); }//from w w w. ja va2 s. co m }; comboBox.addActionListener(actionListener); frame.setSize(400, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JTextArea textarea = new JTextArea(); textarea.setDragEnabled(true);/*from w w w. j a v a2 s.c om*/ textarea.setText("Drag target"); frame.getContentPane().add(BorderLayout.CENTER, textarea); JTextField textarea1 = new JTextField(); textarea1.setText("Drop target"); frame.getContentPane().add(BorderLayout.SOUTH, textarea1); frame.setSize(500, 300); frame.setVisible(true); frame.setLocation(100, 100); }