Example usage for java.awt BorderLayout PAGE_START

List of usage examples for java.awt BorderLayout PAGE_START

Introduction

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

Prototype

String PAGE_START

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

Click Source Link

Document

The component comes before the first line of the layout's content.

Usage

From source file:FocusTraversalDemo.java

public FocusTraversalDemo() {
    super(new BorderLayout());
    newPolicy = new MyOwnFocusTraversalPolicy();

    tf1 = new JTextField("Field 1");
    tf2 = new JTextField("A Bigger Field 2");
    tf3 = new JTextField("Field 3");
    tf4 = new JTextField("A Bigger Field 4");
    tf5 = new JTextField("Field 5");
    tf6 = new JTextField("A Bigger Field 6");
    table = new JTable(4, 3);
    togglePolicy = new JCheckBox("Custom FocusTraversalPolicy");
    togglePolicy.setActionCommand("toggle");
    togglePolicy.addActionListener(this);
    togglePolicy.setFocusable(false); //Remove it from the focus cycle.
    //Note that HTML is allowed and will break this run of text
    //across two lines.
    label = new JLabel(
            "<html>Use Tab (or Shift-Tab) to navigate from component to component.<p>Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>");

    JPanel leftTextPanel = new JPanel(new GridLayout(3, 2));
    leftTextPanel.add(tf1, BorderLayout.PAGE_START);
    leftTextPanel.add(tf3, BorderLayout.CENTER);
    leftTextPanel.add(tf5, BorderLayout.PAGE_END);
    leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
    JPanel rightTextPanel = new JPanel(new GridLayout(3, 2));
    rightTextPanel.add(tf2, BorderLayout.PAGE_START);
    rightTextPanel.add(tf4, BorderLayout.CENTER);
    rightTextPanel.add(tf6, BorderLayout.PAGE_END);
    rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
    JPanel tablePanel = new JPanel(new GridLayout(0, 1));
    tablePanel.add(table, BorderLayout.CENTER);
    tablePanel.setBorder(BorderFactory.createEtchedBorder());
    JPanel bottomPanel = new JPanel(new GridLayout(2, 1));
    bottomPanel.add(togglePolicy, BorderLayout.PAGE_START);
    bottomPanel.add(label, BorderLayout.PAGE_END);

    add(leftTextPanel, BorderLayout.LINE_START);
    add(rightTextPanel, BorderLayout.CENTER);
    add(tablePanel, BorderLayout.LINE_END);
    add(bottomPanel, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:SwingToolBarDemo.java

public SwingToolBarDemo() {
    super(new BorderLayout());

    //Create the toolbar.
    JToolBar toolBar = new JToolBar("Still draggable");
    addButtons(toolBar);//from   www .  jav  a2s . c  om

    //Create the text area used for output. Request
    //enough space for 5 rows and 30 columns.
    textArea = new JTextArea(5, 30);
    textArea.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);

    //Lay out the main panel.
    setPreferredSize(new Dimension(450, 130));
    add(toolBar, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}

From source file:GenealogyExample.java

public GenealogyExample() {
    super(new BorderLayout());

    // Construct the panel with the toggle buttons.
    JRadioButton showDescendant = new JRadioButton("Show descendants", true);
    final JRadioButton showAncestor = new JRadioButton("Show ancestors");
    ButtonGroup bGroup = new ButtonGroup();
    bGroup.add(showDescendant);//from   www.  ja  va 2  s.c  o m
    bGroup.add(showAncestor);
    showDescendant.addActionListener(this);
    showAncestor.addActionListener(this);
    showAncestor.setActionCommand(SHOW_ANCESTOR_CMD);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(showDescendant);
    buttonPanel.add(showAncestor);

    // Construct the tree.
    tree = new GenealogyTree(getGenealogyGraph());
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(200, 200));

    // Add everything to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}

From source file:org.parosproxy.paros.view.OutputPanel.java

private JPanel getMainPanel() {
    if (mainPanel == null) {
        mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(getToolBar(), BorderLayout.PAGE_START);
        mainPanel.add(getJScrollPane(), BorderLayout.CENTER);
    }//from   w ww  . j a v  a  2  s . c om
    return mainPanel;
}

From source file:CustomComboBoxDemo.java

public CustomComboBoxDemo() {
    super(new BorderLayout());

    //Load the pet images and create an array of indexes.
    images = new ImageIcon[petStrings.length];
    Integer[] intArray = new Integer[petStrings.length];
    for (int i = 0; i < petStrings.length; i++) {
        intArray[i] = new Integer(i);
        images[i] = createImageIcon("images/" + petStrings[i] + ".gif");
        if (images[i] != null) {
            images[i].setDescription(petStrings[i]);
        }/*from  w w  w . j  a va  2  s  . co m*/
    }

    //Create the combo box.
    JComboBox petList = new JComboBox(intArray);
    ComboBoxRenderer renderer = new ComboBoxRenderer();
    renderer.setPreferredSize(new Dimension(200, 130));
    petList.setRenderer(renderer);
    petList.setMaximumRowCount(3);

    //Lay out the demo.
    add(petList, BorderLayout.PAGE_START);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:components.FileChooserDemo.java

public FileChooserDemo() {
    super(new BorderLayout());

    //Create the log first, because the action listeners
    //need to refer to it.
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);/* ww w  . j  a  v a2 s . com*/
    JScrollPane logScrollPane = new JScrollPane(log);

    //Create a file chooser
    fc = new JFileChooser();

    //Uncomment one of the following lines to try a different
    //file selection mode.  The first allows just directories
    //to be selected (and, at least in the Java look and feel,
    //shown).  The second allows both files and directories
    //to be selected.  If you leave these lines commented out,
    //then the default mode (FILES_ONLY) will be used.
    //
    //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    //Create the open button.  We use the image from the JLF
    //Graphics Repository (but we extracted it from the jar).
    openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif"));
    openButton.addActionListener(this);

    //Create the save button.  We use the image from the JLF
    //Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif"));
    saveButton.addActionListener(this);

    //For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel(); //use FlowLayout
    buttonPanel.add(openButton);
    buttonPanel.add(saveButton);

    //Add the buttons and the log to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(logScrollPane, BorderLayout.CENTER);
}

From source file:sanger.team16.gui.genevar.eqtl.query.SNPGeneAssocPlot.java

public SNPGeneAssocPlot(List<Tuple> tuples, double max, double min) throws ArrayIndexOutOfBoundsException {
    JPanel mainPanel = new JPanel(new GridLayout(0, 3));
    mainPanel.setBackground(Color.white);

    int size = tuples.size();
    for (int i = 0; i < size; i++) {
        Tuple tuple = tuples.get(i);//from w w  w .  j  a  v  a2  s .c  om
        String populationName = tuple.populationName;

        // if (trait.expressionRanks != null) {   // BUG FIXED 02/02/10
        if (tuple.phenotypes != null && tuple.phenotypes.length != 0) {
            CategoryDataset dataset = this.createDataset(tuple);
            JFreeChart chart = createChart(populationName, dataset, max, min);
            chart.setBackgroundPaint(Color.white);

            TextTitle textTitle = new TextTitle(tuple.subtitle);
            textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
            //subtitle1.setPosition(RectangleEdge.BOTTOM);
            textTitle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            chart.addSubtitle(textTitle);

            ChartPanel chartPanel = new ChartPanel(chart);
            chartPanel.setPreferredSize(this.getAutoPreferredSize()); // Original Dimension(680, 420)
            mainPanel.add(chartPanel);

        } else {
            BaseJPane empty = new BaseJPane(2, 50, 0, 0);
            empty.setPreferredSize(this.getAutoPreferredSize());
            BaseJPane na = new BaseJPane();
            na.setLayout(new BorderLayout());

            JLabel name = new JLabel("      " + populationName);
            name.setFont(new Font("Arial", Font.BOLD, 12));
            name.setForeground(Color.gray);
            na.add(name, BorderLayout.PAGE_START);

            JLabel message = new JLabel("Not Available");
            message.setForeground(Color.lightGray);
            na.add(message, BorderLayout.CENTER);

            empty.add(Box.createHorizontalGlue());
            empty.add(na);
            empty.add(Box.createHorizontalGlue());
            empty.setBaseSpringBox();

            mainPanel.add(empty);
        }
    }

    this.add(mainPanel);
}

From source file:components.ProgressBarDemo2.java

public ProgressBarDemo2() {
    super(new BorderLayout());

    //Create the demo's UI.
    startButton = new JButton("Start");
    startButton.setActionCommand("start");
    startButton.addActionListener(this);

    progressBar = new JProgressBar(0, 100);
    progressBar.setValue(0);//w w w.  j  a v  a  2  s .co  m

    //Call setStringPainted now so that the progress bar height
    //stays the same whether or not the string is shown.
    progressBar.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);

    JPanel panel = new JPanel();
    panel.add(startButton);
    panel.add(progressBar);

    add(panel, BorderLayout.PAGE_START);
    add(new JScrollPane(taskOutput), BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:GenealogyExample.java

public GenealogyExample() {
    super(new BorderLayout());

    //Construct the panel with the toggle buttons.
    JRadioButton showDescendant = new JRadioButton("Show descendants", true);
    final JRadioButton showAncestor = new JRadioButton("Show ancestors");
    ButtonGroup bGroup = new ButtonGroup();
    bGroup.add(showDescendant);/*  w  w w. j  av a2  s . c om*/
    bGroup.add(showAncestor);
    showDescendant.addActionListener(this);
    showAncestor.addActionListener(this);
    showAncestor.setActionCommand(SHOW_ANCESTOR_CMD);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(showDescendant);
    buttonPanel.add(showAncestor);

    //Construct the tree.
    tree = new GenealogyTree(getGenealogyGraph());
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(200, 200));

    //Add everything to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}

From source file:org.openstatic.irc.client.O5Client.java

public O5Client() {
    super("O5 IRC");
    this.chat_panels = new Hashtable<String, O5ChatPanel>();
    this.server_panels = new Hashtable<String, O5ServerPanel>();
    this.token_id = null;
    this.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(WindowEvent winEvt) {
            System.exit(0);/*  w  ww  . jav a 2 s .c  o m*/
        }
    });
    this.tabbed = new JTabbedPane();

    JPanel main_pane = new JPanel();
    main_pane.setLayout(new BorderLayout());
    // Setup tab
    JPanel pane = new JPanel(new GridLayout(0, 2, 6, 6));
    pane.setSize(50, 100);

    JLabel server_label = new JLabel("Server:", JLabel.TRAILING);
    server_field = new JTextField(15);
    server_field.setText("127.0.0.1:4050");

    JLabel username_label = new JLabel("Username:", JLabel.TRAILING);
    username_field = new JTextField(15);

    JLabel password_label = new JLabel("Password:", JLabel.TRAILING);
    password_field = new JTextField(15);

    login_btn = new JButton("Connect");
    login_btn.setActionCommand("login");
    login_btn.addActionListener(this);

    pane.add(server_label);
    pane.add(server_field);

    pane.add(username_label);
    pane.add(username_field);

    pane.add(password_label);
    pane.add(password_field);

    pane.add(new JLabel(""));
    pane.add(login_btn);

    JPanel page_start = new JPanel(new BorderLayout());

    JLabel page_header = new JLabel("O5 Client");
    page_header.setFont(new Font("Monospaced", Font.BOLD, 36));

    page_start.add(page_header, BorderLayout.PAGE_START);
    page_start.add(pane, BorderLayout.PAGE_END);

    main_pane.add(page_start, BorderLayout.PAGE_START);

    tabbed.addTab("Connect", null, main_pane, "");

    // finish window
    this.add(tabbed);
    centerWindow();
    this.setVisible(true);
}