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: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);// w ww.ja v a 2 s . c o 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:Main.java
public static void main(String[] args) throws Exception { MaskFormatter formatter = new MaskFormatter("###-##-####"); JFormattedTextField tf = new JFormattedTextField(formatter); JPanel panel = new JPanel(new BorderLayout()); panel.add(tf, BorderLayout.NORTH); JButton clickBtn = new JButton("Click me!"); clickBtn.addActionListener(e -> { if (!tf.getText().matches(formatter.getMask())) { System.err.println("Your Input does not match the pattern!"); } else {//from www .j av a2s . c om System.out.println(tf.getText()); } }); panel.add(clickBtn, BorderLayout.SOUTH); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(panel, BorderLayout.CENTER); f.setSize(800, 600); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel ui = new JPanel(new BorderLayout(20, 20)); ui.setBorder(new LineBorder(Color.RED, 1)); JTextField fileName = new JTextField(); ui.add(fileName, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(new GridLayout(1, 0, 10, 30)); ui.add(buttonPanel, BorderLayout.CENTER); JButton creater = new JButton("Create File"); buttonPanel.add(creater);// w w w . j av a2s . c o m JButton deleter = new JButton("Delete File"); buttonPanel.add(deleter); JOptionPane.showMessageDialog(null, ui); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(""); Container contentPane = frame.getContentPane(); Icon icon = new PieIcon(Color.red); JButton b = new JButton("Button!", icon); contentPane.add(b, BorderLayout.NORTH); b = new JButton(icon); contentPane.add(b, BorderLayout.SOUTH); frame.setSize(300, 200);/* www . j a va 2s . com*/ frame.show(); }
From source file:FileSamplePanel.java
public static void main(String args[]) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel directoryLabel = new JLabel(" "); directoryLabel.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 36)); frame.add(directoryLabel, BorderLayout.NORTH); final JLabel filenameLabel = new JLabel(" "); filenameLabel.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 36)); frame.add(filenameLabel, BorderLayout.SOUTH); JFileChooser fileChooser = new JFileChooser("."); fileChooser.setControlButtonsAreShown(false); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();//from w w w . ja v a2 s . co m frame.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);//from w ww . j a v a2 s .co m frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(labels); jlist1.setVisibleRowCount(4);/* w w w .j a v a 2s .c o m*/ JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); frame.setSize(300, 350); 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);/* www .j ava 2 s . c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(labels); jlist1.setVisibleRowCount(4);//from w w w . j a v a2s . co m JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); jlist1.setValueIsAdjusting(false); frame.setSize(300, 350); frame.setVisible(true); }
From source file:ScrollBarPieces.java
public static void main(String args[]) { JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); String title = (args.length == 0 ? "ScrollBar Sample" : args[0]); JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); contentPane.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(200, 44);/*from w ww . j av a 2 s . co m*/ frame.setVisible(true); }