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:CardLayoutDemo.java

public void addCardsToPane(Container pane) {
    JRadioButton[] rb = new JRadioButton[strings.length];
    ButtonGroup group = new ButtonGroup();
    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.PAGE_AXIS));

    for (int i = 0; i < strings.length; i++) {
        rb[i] = new JRadioButton("Show component #" + (i + 1));
        rb[i].setActionCommand(String.valueOf(i));
        rb[i].addActionListener(this);
        group.add(rb[i]);// w w  w.j  a v  a  2 s  .  c om
        buttons.add(rb[i]);
    }
    rb[0].setSelected(true);

    //Create the panel that contains the "cards".
    cards = new JPanel(new CardLayout());
    for (int i = 0; i < strings.length; i++) {
        cards.add(createComponent(strings[i]), String.valueOf(i));
    }

    pane.add(buttons, BorderLayout.NORTH);
    pane.add(cards, BorderLayout.CENTER);
}

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 ww.  j a v a2 s.  co m*/
    JScrollPane pane = new JScrollPane(booklist);

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

From source file:net.kamhon.ieagle.swing.table.KTableTestPanel.java

@Override
public JPanel createPanel() {
    JPanel myPanel = new JPanel(new BorderLayout());

    myPanel.add(createNorthPanel(), BorderLayout.NORTH);
    myPanel.add(createCenterPanel(), BorderLayout.CENTER);

    return myPanel;
}

From source file:PersisTest.java

public PersisTest(String pathname) {
    super("Save Me");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.pathname = pathname;
    // Build the GUI. Make this object a listener for all actions.
    JPanel pan = new JPanel();
    clearBtn = new JButton("Clear");
    clearBtn.addActionListener(this);
    pan.add(clearBtn);/*from ww w. j  a v  a 2s  . co  m*/
    saveBtn = new JButton("Save");
    saveBtn.addActionListener(this);
    pan.add(saveBtn);
    restoreBtn = new JButton("Restore");
    restoreBtn.addActionListener(this);
    pan.add(restoreBtn);
    quitBtn = new JButton("Quit");
    quitBtn.addActionListener(this);
    pan.add(quitBtn);
    Container c = getContentPane();
    c.add(pan, BorderLayout.NORTH);
    c.add(new ClickPanel(), BorderLayout.CENTER);
    setSize(350, 200);
}

From source file:Main.java

public Main() {
    UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(1, 0, 0, 0));
    UIManager.put("TabbedPane.contentAreaColor", new ColorUIResource(Color.GREEN));
    UIManager.put("TabbedPane.focus", new ColorUIResource(Color.ORANGE));
    UIManager.put("TabbedPane.selected", new ColorUIResource(Color.YELLOW));
    UIManager.put("TabbedPane.darkShadow", new ColorUIResource(Color.DARK_GRAY));
    UIManager.put("TabbedPane.borderHightlightColor", new ColorUIResource(Color.LIGHT_GRAY));
    UIManager.put("TabbedPane.light", new ColorUIResource(Color.WHITE));
    UIManager.put("TabbedPane.tabAreaBackground", new ColorUIResource(Color.CYAN));
    UIManager.put("ToolTip.background", Color.WHITE);
    UIManager.put("ToolTip.border", new BorderUIResource(new LineBorder(Color.BLACK)));
    this.updateUI();

    this.setBackground(Color.BLUE);

    JPanel testPanel = new JPanel();
    testPanel.setLayout(new BorderLayout());
    testPanel.add(new JLabel("Hello World"), BorderLayout.NORTH);
    testPanel.add(new JTextArea("Looks nice out there :)"), BorderLayout.CENTER);

    JPanel testPanel2 = new JPanel();
    testPanel2.setLayout(new BorderLayout());
    testPanel2.add(new JLabel("Good Bye World"), BorderLayout.NORTH);
    testPanel2.add(new JTextArea("OK"), BorderLayout.CENTER);

    this.addTab("Hello World", testPanel);
    this.addTab("World", testPanel2);
}

From source file:org.broad.igv.peaks.PeakTimePlotFrame.java

public PeakTimePlotFrame(ChartPanel chartPanel) {
    initComponents();//w  w w  .j  a v a2 s. co m

    getContentPane().add(new PeakCommandBar(), BorderLayout.NORTH);
    getContentPane().add(chartPanel, BorderLayout.CENTER);
    // setContentPane(chartPanel);
}

From source file:com.game.ui.views.UserDialog.java

public UserDialog(String message, JFrame frame) {
    setLayout(new BorderLayout(5, 5));
    setModalityType(ModalityType.APPLICATION_MODAL);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setResizable(false);//from   ww  w.ja v  a  2  s .c om
    ImageIcon icon = null;
    try {
        icon = GameUtils.shrinkImage("warning.gif", 30, 30);
    } catch (IOException e) {
        System.out.println("Dialog : showDialogForMap(): Exception occured :" + e);
        e.printStackTrace();
    }
    JPanel panel = new JPanel();
    JLabel label = new JLabel(icon);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT));
    label.setText(message);
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    label.setHorizontalAlignment(0);
    panel.add(label);
    add(panel, BorderLayout.NORTH);
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    txt = new JTextField();
    txt.setPreferredSize(new Dimension(150, 30));
    txt.setAlignmentX(.5f);
    txt.setMaximumSize(new Dimension(150, 30));
    contentPanel.add(txt);
    contentPanel.add(Box.createVerticalStrut(10));
    JButton btn = new JButton("Submit.");
    btn.setAlignmentX(.5f);
    btn.setPreferredSize(new Dimension(50, 25));
    btn.addActionListener(this);
    validationMess = new JLabel("All fields are mandatory");
    validationMess.setVisible(false);
    validationMess.setForeground(Color.red);
    validationMess.setAlignmentX(.5f);
    contentPanel.add(btn);
    contentPanel.add(Box.createVerticalStrut(10));
    contentPanel.add(validationMess);
    contentPanel.add(Box.createVerticalGlue());
    add(contentPanel, BorderLayout.CENTER);
    pack();
    setSize(new Dimension(300, 200));
    setLocationRelativeTo(frame);
    setVisible(true);
}

From source file:gate.termraider.gui.HyponymyDebugger.java

public HyponymyDebugger(HyponymyTermbank termbank) {
    this.termbank = termbank;
    setLayout(new BorderLayout());
    makeControlPanel();/* ww  w  . java 2s.com*/
    this.add(controlPanel, BorderLayout.NORTH);
    placeholder = new JPanel();
    this.add(placeholder, BorderLayout.CENTER);
}

From source file:com.intuit.tank.proxy.settings.ui.ProxyConfigDialog.java

private void initialize() {
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(getProxyConfigPanel(), BorderLayout.CENTER);
    getContentPane().add(getToolbar(), BorderLayout.NORTH);
    setPreferredSize(new Dimension(600, 300));
    setMinimumSize(new Dimension(600, 300));
}

From source file:MyStatsPanel.java

public MyStatsPanel(AdminGUI adminGUI, Statement statement) {
    this.adminGUI = adminGUI;
    this.statement = statement;

    pieChartPanel = createPieChartPanel();
    pieChartPanel.setBackground(Color.GRAY);
    pieChartPanel.setPreferredSize(new Dimension(550, 260));

    northPanel = new JPanel(new FlowLayout());
    northPanel.setBackground(Color.GRAY);
    clockPanel = new MyClock("Advanced");
    northPanel.add(clockPanel);/*  w  w  w  . j  a va 2 s  .c  om*/

    statsPanel = setFields();

    add(northPanel, BorderLayout.NORTH);
    add(statsPanel, BorderLayout.CENTER);
    add(pieChartPanel, BorderLayout.SOUTH);

    setUpGUI();
}