Example usage for java.awt BorderLayout SOUTH

List of usage examples for java.awt BorderLayout SOUTH

Introduction

In this page you can find the example usage for java.awt BorderLayout SOUTH.

Prototype

String SOUTH

To view the source code for java.awt BorderLayout SOUTH.

Click Source Link

Document

The south layout constraint (bottom of container).

Usage

From source file:PrinterSettingUpDialogPrint.java

public PrinterSettingUpDialogPrint() {
    getContentPane().add(canvas);/*from w  w  w. j a v  a  2  s  .  c  o  m*/

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(1, 3));

    setUpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent a) {
            setup();
        }
    });
    panel.add(setUpButton);
    printButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent a) {
            print();
        }
    });
    panel.add(printButton);
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent a) {
            cancel();
        }
    });
    panel.add(cancelButton);
    getContentPane().add(BorderLayout.SOUTH, panel);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 275);
    setVisible(true);
}

From source file:ClipArea.java

public ClipArea() {
    super();/*from  w w w .jav a  2 s. c  om*/
    Container contentPane = getContentPane();

    canvas = new MyCanvas();
    contentPane.add(canvas);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(1, 2));
    clipButton = new JRadioButton("Clip", true);
    clipButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            canvas.clip = true;
            canvas.clipFurther = false;
            canvas.repaint();
        }
    });
    clipFurButton = new JRadioButton("Clip Further");
    clipFurButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            canvas.clipFurther = true;
            canvas.repaint();
        }
    });
    ButtonGroup group = new ButtonGroup();
    group.add(clipButton);
    group.add(clipFurButton);

    panel.add(clipButton);
    panel.add(clipFurButton);
    contentPane.add(BorderLayout.SOUTH, panel);

    // 4. Add a window listener to close the frame properly.
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    pack();
    setVisible(true);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    root = new DefaultMutableTreeNode("Root");
    root.add(e1);/*from   w  w  w  . ja  va2  s  .  c om*/
    root.add(e2);
    root.add(e3);
    e1.add(e11);
    e2.add(e22);
    e3.add(e33);
    e11.add(e111);
    e22.add(e222);
    e33.add(e333);

    tree = new JTree(root);
    tree.addTreeSelectionListener(this);
    add(new JScrollPane(tree), BorderLayout.CENTER);
    currentSelectionField = new JTextField("Current Selection: NONE");
    add(currentSelectionField, BorderLayout.SOUTH);
    setSize(250, 275);
    setLocationRelativeTo(null);
    setVisible(true);
}

From source file:Main.java

public Main() {
    super(new BorderLayout());
    populateTree(treePanel);//from ww  w  .  j a v a 2s .  co m
    JButton addButton = new JButton("Add");
    addButton.setActionCommand(ADD_COMMAND);
    addButton.addActionListener(this);
    JButton removeButton = new JButton("Remove");
    removeButton.setActionCommand(REMOVE_COMMAND);
    removeButton.addActionListener(this);
    JButton clearButton = new JButton("Clear");
    clearButton.setActionCommand(CLEAR_COMMAND);
    clearButton.addActionListener(this);
    treePanel.setPreferredSize(new Dimension(300, 150));
    add(treePanel, BorderLayout.CENTER);
    JPanel panel = new JPanel(new GridLayout(0, 3));
    panel.add(addButton);
    panel.add(removeButton);
    panel.add(clearButton);
    add(panel, BorderLayout.SOUTH);
}

From source file:NewFilterTable.java

public NewFilterTable() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    String[] columns = { "ID", "Des", "Date", "Fixed" };
    Object[][] rows = { { 1, "C", new Date(), new Date() }, { 2, "G", new Date(), new Date() },
            { 5, "F", new Date(), new Date() } };

    TableModel model = new DefaultTableModel(rows, columns);
    JTable table = new JTable(model);
    final TableRowSorter<TableModel> sorter;
    sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);/*from  ww w .j  a va2 s. co  m*/
    getContentPane().add(new JScrollPane(table));

    JPanel pnl = new JPanel();
    pnl.add(new JLabel("Filter expression:"));
    final JTextField txtFE = new JTextField(25);
    pnl.add(txtFE);
    JButton btnSetFE = new JButton("Set Filter Expression");
    ActionListener al;
    al = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String expr = txtFE.getText();
            sorter.setRowFilter(RowFilter.regexFilter(expr));
            sorter.setSortKeys(null);
        }
    };
    btnSetFE.addActionListener(al);
    pnl.add(btnSetFE);
    getContentPane().add(pnl, BorderLayout.SOUTH);

    setSize(750, 150);
    setVisible(true);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());
    JButton button = new JButton("Print");
    button.addActionListener(new PrintListener());

    booklist = new JList(books);
    booklist.setCellRenderer(new BookCellRenderer());
    booklist.setVisibleRowCount(4);//w w w.  j  a  va  2s .c o m
    JScrollPane pane = new JScrollPane(booklist);

    add(pane, BorderLayout.NORTH);
    add(button, BorderLayout.SOUTH);
}

From source file:SwingListExample.java

public SwingListExample() {
    setLayout(new BorderLayout());
    JButton button = new JButton("Print");
    button.addActionListener(new PrintListener());

    booklist = new JList(books);
    booklist.setCellRenderer(new BookCellRenderer());
    booklist.setVisibleRowCount(4);//from w  w  w . j a v  a  2 s .  c o m
    JScrollPane pane = new JScrollPane(booklist);

    add(pane, BorderLayout.NORTH);
    add(button, BorderLayout.SOUTH);
}

From source file:ConvolveApp.java

public ConvolveApp() {
    super();//  www.ja  va 2 s.  co m
    Container container = getContentPane();

    displayPanel = new CPanel();
    container.add(displayPanel);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 2));
    panel.setBorder(new TitledBorder("Click a Button to Perform the Associated Operation and Reset..."));

    sharpenButton = new JButton("Sharpen");
    sharpenButton.addActionListener(new ButtonListener());
    blurringButton = new JButton("Blur");
    blurringButton.addActionListener(new ButtonListener());
    edButton = new JButton("Edge Detect");
    edButton.addActionListener(new ButtonListener());
    resetButton = new JButton("Reset");
    resetButton.addActionListener(new ButtonListener());

    panel.add(sharpenButton);
    panel.add(blurringButton);
    panel.add(edButton);
    panel.add(resetButton);

    container.add(BorderLayout.SOUTH, panel);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    setSize(displayPanel.getWidth(), displayPanel.getHeight() + 10);
    setVisible(true);
}

From source file:Main.java

public ConfirmDialog(Frame parent) {
    super(parent, true);

    JPanel gui = new JPanel(new BorderLayout(3, 3));
    gui.setBorder(new EmptyBorder(5, 5, 5, 5));
    content = new JPanel(new BorderLayout());
    gui.add(content, BorderLayout.CENTER);
    JPanel buttons = new JPanel(new FlowLayout(4));
    gui.add(buttons, BorderLayout.SOUTH);

    JButton ok = new JButton("OK");
    buttons.add(ok);/*from  www  .j a  va2 s .co m*/
    ok.addActionListener(e -> {
        result = OK_OPTION;
        setVisible(false);
    });

    JButton cancel = new JButton("Cancel");
    buttons.add(cancel);
    cancel.addActionListener(e -> {
        result = CANCEL_OPTION;
        setVisible(false);
    });
    setContentPane(gui);
}

From source file:ToolbarFrame2.java

public ToolbarFrame2() {
    setSize(450, 250);//from  w  w  w.  j a  va2s.c o  m

    ActionListener printListener = new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            System.out.println(ae.getActionCommand());
        }
    };

    // JPanel works similarly to Panel, so we'll use it
    JPanel toolbar = new JPanel();
    toolbar.setLayout(new FlowLayout(FlowLayout.LEFT));

    cutButton = new JButton("Cut");
    cutButton.addActionListener(printListener);
    toolbar.add(cutButton);

    copyButton = new JButton("Copy");
    copyButton.addActionListener(printListener);
    toolbar.add(copyButton);

    pasteButton = new JButton("Paste");
    pasteButton.addActionListener(printListener);
    toolbar.add(pasteButton);

    add(toolbar, BorderLayout.NORTH); // The new BorderLayout add

    JPanel lnfPanel = new JPanel();
    macButton = new JButton("Mac");
    macButton.addActionListener(printListener);
    lnfPanel.add(macButton);
    javaButton = new JButton("Metal");
    javaButton.addActionListener(printListener);
    lnfPanel.add(javaButton);
    motifButton = new JButton("Motif");
    motifButton.addActionListener(printListener);
    lnfPanel.add(motifButton);
    winButton = new JButton("Windows");
    winButton.addActionListener(printListener);
    lnfPanel.add(winButton);
    add(lnfPanel, BorderLayout.SOUTH);
}