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
private void createAndDisplayGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tPane = new JTextPane(); JScrollPane scroller = new JScrollPane(); scroller.setViewportView(tPane);// www .j av a 2s. com tfield.addActionListener(e -> { counter++; if (counter == 8) counter = 0; String text = tfield.getText() + "\n"; appendToPane(tPane, text, colours[counter]); tfield.selectAll(); }); getContentPane().add(scroller, BorderLayout.CENTER); getContentPane().add(tfield, BorderLayout.PAGE_END); setSize(200, 100); setVisible(true); tfield.requestFocusInWindow(); tfield.setText("hi enter to start"); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); textField1.requestFocusInWindow();// w ww. ja va2s. c o m tab1.add(textField1); tab2.add(textField2); tab2.add(textField3); contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT); tabbedPane.addTab("TAB 1", null, tab1, "I am TAB 1"); tabbedPane.addTab("TAB 2", null, tab2, "I am TAB 2"); focusButton = new JButton("CHANGE FOCUS"); getRootPane().setDefaultButton(focusButton); focusButton.addActionListener(this); contentPane.add(tabbedPane, BorderLayout.CENTER); contentPane.add(focusButton, BorderLayout.PAGE_END); setContentPane(contentPane); pack(); 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); displayArea = new JTextArea(); displayArea.setEditable(false);//ww w . j a v a2 s.c o m JScrollPane scrollPane = new JScrollPane(displayArea); scrollPane.setPreferredSize(new Dimension(375, 125)); getContentPane().add(typingArea, BorderLayout.PAGE_START); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(button, BorderLayout.PAGE_END); }
From source file:Main.java
public void build() { setSize(600, 600);/*from w w w. j a va 2 s. c o m*/ JTextPane textPane = new JTextPane(); JScrollPane scrollPane = new JScrollPane(textPane); scrollPane.setPreferredSize(new Dimension(300, 300)); JTextArea changeLog = new JTextArea(5, 30); changeLog.setEditable(false); JScrollPane scrollPaneForLog = new JScrollPane(changeLog); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, scrollPaneForLog); splitPane.setOneTouchExpandable(true); JPanel statusPane = new JPanel(new GridLayout(1, 1)); JLabel caretListenerLabel = new JLabel("Caret Status"); statusPane.add(caretListenerLabel); JToolBar toolBar = new JToolBar(); toolBar.add(new JButton("Btn1")); toolBar.add(new JButton("Btn2")); toolBar.add(new JButton("Btn3")); toolBar.add(new JButton("Btn4")); getContentPane().add(toolBar, BorderLayout.PAGE_START); getContentPane().add(splitPane, BorderLayout.CENTER); getContentPane().add(statusPane, BorderLayout.PAGE_END); JMenu editMenu = new JMenu("test"); JMenu styleMenu = new JMenu("test"); JMenuBar mb = new JMenuBar(); mb.add(editMenu); mb.add(styleMenu); setJMenuBar(mb); }
From source file:QandE.MyDemo3.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread./*from w ww .j av a 2 s.c o m*/ */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("MyDemo3"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add a label with bold italic font. JLabel label = new JLabel("My Demo"); frame.getContentPane().add(BorderLayout.CENTER, label); if (true) { label.setFont(label.getFont().deriveFont(Font.ITALIC | Font.BOLD)); } else { //another way of doing it, but not as appropriate since //setFont is faster than using HTML. label.setText("<html><i>My Demo</i></html>"); } label.setHorizontalAlignment(JLabel.CENTER); JButton b = new JButton("A button"); frame.getContentPane().add(BorderLayout.PAGE_END, b); frame.getRootPane().setDefaultButton(b); //Display the window, making it a little bigger than it really needs to be. frame.pack(); frame.setSize(frame.getWidth() + 100, frame.getHeight() + 50); frame.setVisible(true); }
From source file:layout.BorderLayoutDemo.java
public static void addComponentsToPane(Container pane) { if (!(pane.getLayout() instanceof BorderLayout)) { pane.add(new JLabel("Container doesn't use BorderLayout!")); return;// w w w .j a va 2 s . c om } if (RIGHT_TO_LEFT) { pane.setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT); } JButton button = new JButton("Button 1 (PAGE_START)"); pane.add(button, BorderLayout.PAGE_START); //Make the center component big, since that's the //typical usage of BorderLayout. button = new JButton("Button 2 (CENTER)"); button.setPreferredSize(new Dimension(200, 100)); pane.add(button, BorderLayout.CENTER); button = new JButton("Button 3 (LINE_START)"); pane.add(button, BorderLayout.LINE_START); button = new JButton("Long-Named Button 4 (PAGE_END)"); pane.add(button, BorderLayout.PAGE_END); button = new JButton("5 (LINE_END)"); pane.add(button, BorderLayout.LINE_END); }
From source file:Main.java
/** * Sets up the given window content pane by setting its border to provide a * good default spacer, and setting the content pane to the given components. * //from w ww . j a v a 2 s . c o m * @param aWindow * the window to setup, cannot be <code>null</code>; * @param aCenterComponent * the component that should appear at the center of the dialog; * @param aButtonPane * the component that should appear at the bottom of the dialog * @param defaultButton * the default button for this dialog; can be null for "none". * @see javax.swing.JRootPane#setDefaultButton(javax.swing.JButton) */ public static void setupWindowContentPane(final Window aWindow, final Component aCenterComponent, final Component aButtonPane, final JButton defaultButton) { final JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setBorder(BorderFactory.createEmptyBorder(DIALOG_PADDING, DIALOG_PADDING, // DIALOG_PADDING, DIALOG_PADDING)); contentPane.add(aCenterComponent, BorderLayout.CENTER); contentPane.add(aButtonPane, BorderLayout.PAGE_END); if (aWindow instanceof JDialog) { ((JDialog) aWindow).setContentPane(contentPane); ((JDialog) aWindow).getRootPane().setDefaultButton(defaultButton); } else if (aWindow instanceof JFrame) { ((JFrame) aWindow).setContentPane(contentPane); ((JFrame) aWindow).getRootPane().setDefaultButton(defaultButton); } aWindow.pack(); }
From source file:QandE.Beeper1.java
public Beeper1() { super(new BorderLayout()); textField = new JTextField(20); add(textField, BorderLayout.CENTER); //The object registered as the action //listener is informed when the user //has finished entering text; for example //by pressing Enter. textField.addActionListener(this); button = new JButton("Click Me"); add(button, BorderLayout.PAGE_END); button.addActionListener(this); }
From source file:net.team2xh.crt.gui.entities.EntityTree.java
public EntityTree() { setLayout(new BorderLayout()); add(tree, BorderLayout.CENTER); add(properties, BorderLayout.PAGE_END); tree.getVerticalScrollBar().setUnitIncrement(16); tree.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setPopupAllowed(false);// www . jav a 2s. c o m // ((JViewport) tree.getComponent(0)).getComponent(0).setForeground(Color.white); }
From source file:components.SplitPaneDividerDemo.java
public SplitPaneDividerDemo() { super(new BorderLayout()); Font font = new Font("Serif", Font.ITALIC, 24); ImageIcon icon = createImageIcon("images/Cat.gif"); SizeDisplayer sd1 = new SizeDisplayer("left", icon); sd1.setMinimumSize(new Dimension(30, 30)); sd1.setFont(font);//from w w w. j ava 2 s .co m icon = createImageIcon("images/Dog.gif"); SizeDisplayer sd2 = new SizeDisplayer("right", icon); sd2.setMinimumSize(new Dimension(60, 60)); sd2.setFont(font); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sd1, sd2); splitPane.setResizeWeight(0.5); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); add(splitPane, BorderLayout.CENTER); add(createControlPanel(), BorderLayout.PAGE_END); }