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() {
    super("Drop Test");
    setSize(300, 300);//from   ww  w  . j a v a 2  s .com
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    add(new JLabel("Drop a list from your file chooser here:"), BorderLayout.NORTH);
    ta.setBackground(Color.white);
    getContentPane().add(ta, BorderLayout.CENTER);

    dt = new DropTarget(ta, this);
    setVisible(true);
}

From source file:MainClass.java

public MainClass() {
    super();// w ww.j  av  a  2s.c om
    JToolBar urlToolBar = new JToolBar();
    mURLField = new JTextField(40);
    urlToolBar.add(new JLabel("Location:"));
    urlToolBar.add(mURLField);
    frame.add(urlToolBar, BorderLayout.NORTH);

    mEditorPane = new JEditorPane();
    mEditorPane.setEditable(false);
    frame.add(new JScrollPane(mEditorPane), BorderLayout.CENTER);

    openURL("http://www.java2s.com");

    mURLField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            openURL(ae.getActionCommand());
        }
    });

    mEditorPane.addHyperlinkListener(new LinkActivator());

    setSize(500, 600);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:DropTest.java

public DropTest() {
    super("Drop Test");
    setSize(300, 300);/* w  w w . ja va 2 s . c o m*/
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    add(new JLabel("Drop a list from your file chooser here:"), BorderLayout.NORTH);
    ta.setBackground(Color.white);
    getContentPane().add(ta, BorderLayout.CENTER);

    dt = new DropTarget(ta, this);
    setVisible(true);
}

From source file:Main.java

public Main() {
    JPanel holderPanel = new JPanel(new BorderLayout());
    holderPanel.add(thumbPanel, BorderLayout.NORTH);
    holderPanel.add(Box.createGlue(), BorderLayout.CENTER);

    setLayout(new BorderLayout());
    add(new JScrollPane(holderPanel), BorderLayout.CENTER);
}

From source file:Main.java

Main() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(900, 600);//from   w w w . j a v  a2  s.  com

    JPanel left = new JPanel();
    left.setBackground(Color.BLUE);

    JPanel right = new JPanel(new BorderLayout());

    JLabel fox = new JLabel("The quick brown fox jumps over the lazy dog.");
    fox.setFont(new Font(null, 0, 50));

    JPanel rightBottom = new JPanel();
    rightBottom.setLayout(new GridLayout(10, 10));
    for (int i = 1; i <= 100; i++) {
        rightBottom.add(new JButton("butt" + i));
    }
    right.add(fox, BorderLayout.NORTH);
    right.add(rightBottom, BorderLayout.CENTER);
    add(right);
}

From source file:Main.java

Main(String title) {
    super(title);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    commandLine = new JTextField();
    commandLine.addActionListener(this);
    getContentPane().add(commandLine, BorderLayout.NORTH);

    view = new JEditorPane();
    view.setEditable(false);/*  ww  w.  j  a va2  s  .  c o  m*/
    view.setPreferredSize(new Dimension(400, 400));
    view.addHyperlinkListener(this);

    getContentPane().add(view, BorderLayout.CENTER);

    pack();
    setVisible(true);
}

From source file:Main.java

public Main() {
    super("Drop Test");
    setSize(300, 300);/*  www .j  a v a 2s .c  o  m*/
    getContentPane().add(new JLabel("Drop something here:"), BorderLayout.NORTH);

    ta.setBackground(Color.white);
    getContentPane().add(ta, BorderLayout.CENTER);
    dt = new DropTarget(ta, this);
    setVisible(true);
}

From source file:Main.java

public Main() {
    String[] comboTypes = { "Numbers", "Alphabets", "Symbols" };
    JComboBox<String> comboTypesList = new JComboBox<>(comboTypes);
    comboTypesList.setSelectedIndex(2);//w  w w. j  a v  a  2  s  .  co m
    comboTypesList.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JComboBox jcmbType = (JComboBox) e.getSource();
            String cmbType = (String) jcmbType.getSelectedItem();
            System.out.println(cmbType);
        }
    });
    setLayout(new BorderLayout());
    add(comboTypesList, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {

    GridLayout g = new GridLayout(3, 3);
    pan = new JPanel(g);
    pan.add(new JButton("1"));
    pan.add(new JButton("2"));
    pan.add(new JButton("3"));
    pan.add(new JButton("4"));
    pan.add(new JButton("5"));
    pan.add(new JButton("6"));
    pan.add(new JButton("7"));
    pan.add(new JButton("8"));
    pan.add(new JButton("9"));
    JLabel l = new JLabel("grid layout");
    l.setHorizontalAlignment(SwingConstants.CENTER);

    setLayout(new BorderLayout());
    add(l, BorderLayout.NORTH);
    add(pan, BorderLayout.CENTER);
    setSize(1000, 500);/*  w  ww  .ja  v  a2  s .  c  o m*/
    setVisible(true);
}

From source file:MainClass.java

MainClass(String title) {
    super(title);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    commandLine = new JTextField();
    commandLine.addActionListener(this);
    getContentPane().add(commandLine, BorderLayout.NORTH);

    view = new JEditorPane();
    view.setEditable(false);//from  w w w . j a  va  2s . co m
    view.setPreferredSize(new Dimension(400, 400));
    view.addHyperlinkListener(this);

    getContentPane().add(view, BorderLayout.CENTER);

    pack();
    setVisible(true);
}