Example usage for java.awt BorderLayout NORTH

List of usage examples for java.awt BorderLayout NORTH

Introduction

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

Prototype

String NORTH

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

Click Source Link

Document

The north layout constraint (top of container).

Usage

From source file:Main.java

public Main() {
    Vector model = new Vector();
    model.addElement(new Item(1, "A"));
    model.addElement(new Item(2, "B"));
    model.addElement(new Item(3, "C"));
    model.addElement(new Item(4, "D"));

    JComboBox comboBox = new JComboBox(model);
    comboBox.addActionListener(this);
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    getContentPane().add(comboBox, BorderLayout.NORTH);

    comboBox = new JComboBox(model);
    comboBox.setRenderer(new ItemRenderer());
    comboBox.addActionListener(this);
    getContentPane().add(comboBox, BorderLayout.SOUTH);
}

From source file:JTable2Pdf.java

private void createTable() {
    Object[][] data = { { "a", "b", "e", 4, false } };
    String[] columnNames = { "A", "B", "C", "D", "E" };

    table = new JTable(data, columnNames);

    JPanel tPanel = new JPanel(new BorderLayout());
    tPanel.add(table.getTableHeader(), BorderLayout.NORTH);
    tPanel.add(table, BorderLayout.CENTER);

    getContentPane().add(tPanel, BorderLayout.CENTER);
}

From source file:Main.java

@Override
public void run() {
    button = new JButton("Shake with this Button  ");
    button.addActionListener(new ActionListener() {
        @Override// w  w w.j a  va 2 s .  c  o  m
        public void actionPerformed(ActionEvent e) {
            shakeButton();
        }
    });
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(button, BorderLayout.NORTH);

    frame.setSize(240, 160);
    frame.setVisible(true);
}

From source file:Main.java

public Main() {
    MyCanvas thingy = new MyCanvas();
    setLayout(new BorderLayout());
    JPanel panel = new JPanel();
    panel.add(thingy);//from   w ww .ja  v  a 2  s .  co m
    JScrollPane scroll = new JScrollPane();
    scroll.setViewportView(panel);
    add(scroll, BorderLayout.CENTER);
    SpinnerNumberModel spmodel = new SpinnerNumberModel(thingy.getThingySize(), 10.0, 2000.0, 10.0);
    spmodel.addChangeListener(e -> thingy.setThingySize((Double) spmodel.getNumber()));
    add(new JSpinner(spmodel), BorderLayout.NORTH);
}

From source file:MonthPanel.java

public MonthPanel(int month, int year) {
    this.month = month;
    this.year = year;
    JPanel monthPanel = new JPanel(true);
    monthPanel.setLayout(new BorderLayout());
    monthPanel.add(createTitleGUI(), BorderLayout.NORTH);
    monthPanel.add(createDaysGUI(), BorderLayout.SOUTH);
    this.add(monthPanel);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }// ww  w. java  2  s.  c  o  m
    });

    list.setSelectionModel(m);

    m.setLeadSelectionIndex(1);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//from   w w  w . ja  va  2  s . co  m
    });

    list.setSelectionModel(m);

    m.removeIndexInterval(1, 1);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }/*from ww w  .  j  a  v a 2 s. co  m*/
    });

    list.setSelectionModel(m);

    m.moveLeadSelectionIndex(1);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }// ww w  .  j  a va  2s.c  om
    });

    list.setSelectionModel(m);

    m.setAnchorSelectionIndex(1);

    add(pane, BorderLayout.NORTH);
}

From source file:NonNumericDocument.java

public void prepareAndShowGUI() {
    tf = new JTextField(30);
    tf.setDocument(new NonNumericDocument());
    getContentPane().add(tf, BorderLayout.NORTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();// ww w . j a  v  a2 s. co  m
    setVisible(true);
}