List of usage examples for java.awt BorderLayout NORTH
String NORTH
To view the source code for java.awt BorderLayout NORTH.
Click Source Link
From source file:FormattedSample.java
public static void main(final String args[]) { JFrame frame = new JFrame("Formatted Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel datePanel = new JPanel(new BorderLayout()); DateFormat format = new SimpleDateFormat("yyyy--MMMM--dd"); JFormattedTextField dateTextField = new JFormattedTextField(format); datePanel.add(dateTextField, BorderLayout.CENTER); frame.add(datePanel, BorderLayout.NORTH); frame.add(new JTextField(), BorderLayout.SOUTH); frame.setSize(250, 100);/* www . ja v a 2 s.co 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); MyModel myArrayClass = new MyModel(25); MyView panel = new MyView(myArrayClass); myArrayClass.myView = panel;//from ww w . j ava2s . c om JButton sortButton = new JButton("Sort"); sortButton.addActionListener(e -> performSorting(myArrayClass)); f.getContentPane().add(sortButton, BorderLayout.NORTH); f.getContentPane().add(panel, BorderLayout.CENTER); f.setSize(400, 400); f.setVisible(true); }
From source file:DualSample.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; JFrame f = new JFrame("Sample Components"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list = new JList(labels); JScrollPane scrollPane = new JScrollPane(list); JComboBox comboBox = new JComboBox(labels); comboBox.setMaximumRowCount(4);/*from w w w . j a v a2 s .c o m*/ Container contentPane = f.getContentPane(); contentPane.add(comboBox, BorderLayout.NORTH); contentPane.add(scrollPane, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("LabelFor Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Username"); JTextField textField = new JTextField(); label.setDisplayedMnemonic(KeyEvent.VK_U); label.setLabelFor(textField);/* w w w. j a v a2 s . c om*/ Container box = Box.createHorizontalBox(); box.add(label); box.add(textField); frame.add(box, BorderLayout.NORTH); frame.add(new JButton("Submit"), BorderLayout.SOUTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("ArrayListComboBoxModel"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Collection<Object> col = System.getProperties().values(); ArrayList<Object> arrayList = new ArrayList<Object>(col); ArrayListComboBoxModel model = new ArrayListComboBoxModel(arrayList); JComboBox comboBox = new JComboBox(model); frame.add(comboBox, BorderLayout.NORTH); frame.setSize(300, 225);//from w w w . j a v a 2 s . c o m frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { final String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Popup JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox comboBox = new JComboBox(labels); comboBox.setUI((ComboBoxUI) MyComboBoxUI.createUI(comboBox)); frame.add(comboBox, BorderLayout.NORTH); frame.setSize(300, 200);//from w ww .j a v a 2s .com frame.setVisible(true); }
From source file:PopupComboSample.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G" }; JFrame frame = new JFrame("Popup JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox comboBox = new JComboBox(labels); comboBox.setUI((ComboBoxUI) MyComboBoxUI.createUI(comboBox)); frame.add(comboBox, BorderLayout.NORTH); frame.setSize(300, 200);// w w w. j av a2 s . c om 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 model1 = new SpinnerDateModel(); JSpinner spinner1 = new JSpinner(model1); JLabel label1 = new JLabel("All"); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(label1, BorderLayout.WEST); panel1.add(spinner1, BorderLayout.CENTER); frame.add(panel1, BorderLayout.NORTH); frame.setSize(200, 90);// w w w . j a va2 s. c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name: "); label.setDisplayedMnemonic(KeyEvent.VK_N); JTextField textField = new JTextField(); label.setLabelFor(textField);/*w w w. j a va 2 s . co m*/ panel.add(label, BorderLayout.WEST); panel.add(textField, BorderLayout.CENTER); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel, BorderLayout.NORTH); frame.add(new JButton("Somewhere Else"), BorderLayout.SOUTH); frame.setSize(250, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name: "); label.setDisplayedMnemonic(KeyEvent.VK_N); JTextField textField = new JTextField(); label.setLabelFor(textField);/*from w w w . j a va 2 s . c o m*/ panel.add(label, BorderLayout.WEST); panel.add(textField, BorderLayout.CENTER); frame.add(panel, BorderLayout.NORTH); frame.add(new JButton("Somewhere Else"), BorderLayout.SOUTH); frame.setSize(250, 150); frame.setVisible(true); }