List of usage examples for java.awt BorderLayout PAGE_END
String PAGE_END
To view the source code for java.awt BorderLayout PAGE_END.
Click Source Link
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel outerPanel = new JPanel(new BorderLayout()); JPanel topPanel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name:"); JTextField text = new JTextField(); topPanel.add(label, BorderLayout.PAGE_END); topPanel.add(text, BorderLayout.CENTER); outerPanel.add(topPanel, BorderLayout.AFTER_LAST_LINE); frame.add(outerPanel);// w w w.ja v a 2 s. com frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("Hello"); label.setOpaque(true);// w ww. j a va 2 s . co m label.setBackground(Color.red); JPanel bottomPanel = new JPanel(new BorderLayout()); bottomPanel.add(label, BorderLayout.LINE_END); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(bottomPanel, BorderLayout.PAGE_END); mainPanel.setPreferredSize(new Dimension(400, 400)); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel gui = new JPanel(new BorderLayout(2, 2)); BufferedImage bi = new BufferedImage(600, 200, BufferedImage.TYPE_INT_RGB); gui.add(new JLabel(new ImageIcon(bi))); JFrame myframe = new JFrame(); JPanel myPanel = new JPanel(); gui.add(myPanel, BorderLayout.PAGE_END); myPanel.setLayout(new GridLayout(2, 0, 0, 0)); int x = 0;/*www . java 2 s . c om*/ int y = 5; for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) { myPanel.add(new JButton(alphabet + "")); x++; if (x > 15) { y = 6; x = 0; } } myframe.add(gui); myframe.pack(); myframe.setVisible(true); myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:Main.java
public static void main(String[] args) { JPanel bottomPanel = new JPanel(); bottomPanel.add(new JButton("Bottom Button")); bottomPanel.setBorder(BorderFactory.createTitledBorder("Bottom Panel")); JPanel centerPanel = new JPanel(); centerPanel.setBorder(BorderFactory.createTitledBorder("Center Panel")); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(centerPanel, BorderLayout.CENTER); mainPanel.add(bottomPanel, BorderLayout.PAGE_END); int eb = 25;//from w w w . j a v a 2s. c o m mainPanel.setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb)); mainPanel.setPreferredSize(new Dimension(500, 400)); JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { showFrameWithToolBar(BorderLayout.PAGE_START); showFrameWithToolBar(BorderLayout.PAGE_END); showFrameWithToolBar(BorderLayout.LINE_START); showFrameWithToolBar(BorderLayout.LINE_END); showFrameWithToolBar(BorderLayout.CENTER); }
From source file:Main.java
public static void main(String[] args) { int ROW_HEIGHT = 40; String[] TABLE_COLUMNS = { "Foo", "Bar" }; DefaultTableModel tableModel = new DefaultTableModel(TABLE_COLUMNS, 2); JTable table = new JTable(tableModel); table.setRowHeight(ROW_HEIGHT);/*ww w. j a va2s . com*/ JScrollPane scrollpane = new JScrollPane(table); JButton addRowBtn = new JButton(new AbstractAction("Add Row") { @Override public void actionPerformed(ActionEvent arg0) { tableModel.addRow(new String[] { "", "" }); } }); JPanel btnPanel = new JPanel(); btnPanel.add(addRowBtn); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(scrollpane, BorderLayout.CENTER); f.getContentPane().add(btnPanel, BorderLayout.PAGE_END); f.pack(); f.setLocationByPlatform(true); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); DefaultTreeModel model = new DefaultTreeModel(root); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(new JTree(model))); f.getContentPane().add(new JButton(new AbstractAction("Add thousand children") { @Override/*from w w w. ja v a 2s. co m*/ public void actionPerformed(ActionEvent e) { int offset = root.getChildCount() + 1; for (int i = 0; i < 1000; i++) { DefaultMutableTreeNode child = new DefaultMutableTreeNode("Person " + (i + offset)); // model.insertNodeInto(child, root, root.getChildCount()); root.add(child); } model.nodeStructureChanged(root); } }), BorderLayout.PAGE_END); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame() { @Override/*from w w w.j ava 2s . co m*/ public synchronized void setExtendedState(int state) { if (isUndecorated() && (state & MAXIMIZED_BOTH) == MAXIMIZED_BOTH) { super.setMaximizedBounds(new Rectangle(300, 300)); } super.setExtendedState(state); } }; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800, 600); frame.setUndecorated(true); frame.getContentPane().add(new JButton(new AbstractAction("Toggle maximize") { @Override public void actionPerformed(ActionEvent e) { int state = frame.getExtendedState(); if ((state & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH) { frame.setExtendedState(JFrame.NORMAL); } else { frame.setExtendedState(JFrame.MAXIMIZED_BOTH); } } }), BorderLayout.PAGE_END); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String[] data = { "alist", "arithmetic", "ASCIInumbers", "A", "B", "list", "C", "D", "E", "numeral", "G", "F" }; JCheckBox[] checkBox;/*from ww w .java2 s. co m*/ JButton submitButton; JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel contentPane = new JPanel(); contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(5, 5)); checkBox = new JCheckBox[data.length]; JPanel centerPanel = new JPanel(); centerPanel.setLayout(new GridLayout(0, 4, 5, 5)); for (int i = 0; i < data.length; i++) { checkBox[i] = new JCheckBox(data[i]); centerPanel.add(checkBox[i]); } contentPane.add(centerPanel, BorderLayout.CENTER); JPanel footerPanel = new JPanel(); submitButton = new JButton("Submit"); footerPanel.add(submitButton); contentPane.add(footerPanel, BorderLayout.PAGE_END); frame.setContentPane(contentPane); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); }
From source file:Main.java
private void addComponentsToPane() { JButton button = new JButton("Clear"); button.addActionListener(this); typingArea = new JTextField(20); typingArea.addKeyListener(this); getContentPane().add(typingArea, BorderLayout.PAGE_START); getContentPane().add(button, BorderLayout.PAGE_END); }