Example usage for java.awt BorderLayout PAGE_END

List of usage examples for java.awt BorderLayout PAGE_END

Introduction

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

Prototype

String PAGE_END

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

Click Source Link

Document

The component comes after the last line of the layout's content.

Usage

From source file:UserInterface.PatientRole.VitalSignsChartJPanel.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   www  .ja v a  2  s.co  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    backJButton = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    backJButton.setBackground(new java.awt.Color(204, 255, 255));
    backJButton.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
    backJButton.setForeground(new java.awt.Color(0, 102, 255));
    backJButton.setText("<<Back");
    backJButton.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    backJButton.setOpaque(true);
    backJButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            backJButtonActionPerformed(evt);
        }
    });
    add(backJButton, java.awt.BorderLayout.PAGE_END);
}

From source file:visualizer.projection.distance.view.DistanceHistogram.java

/** This method is called from within the constructor to
 * initialize the form./* w ww. j  a  va2  s  .  c  om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonPanel = new javax.swing.JPanel();
    saveImageButton = new javax.swing.JButton();
    closeButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Distance Histogram");
    setModal(true);

    saveImageButton.setText("Save Image");
    saveImageButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveImageButtonActionPerformed(evt);
        }
    });
    buttonPanel.add(saveImageButton);

    closeButton.setText("Close");
    closeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, java.awt.BorderLayout.PAGE_END);

    pack();
}

From source file:org.cytoscape.dyn.internal.graphMetrics.SaveChartDialog.java

public SaveChartDialog(JFrame frame, JFreeChart chart) {
    super(frame, "Save Chart to File", false);
    this.chart = chart;
    JPanel sizePanel = new JPanel(new GridLayout(2, 3, 4, 4));
    sizePanel.setBorder(BorderFactory.createTitledBorder("Image Size"));

    // Add a spinner for choosing width
    sizePanel.add(new JLabel("Width:", SwingConstants.RIGHT));
    int width = ChartPanel.DEFAULT_WIDTH;
    int minWidth = ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH;
    int maxWidth = ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH;
    SpinnerModel widthSettings = new SpinnerNumberModel(width, minWidth, maxWidth, 1);
    sizePanel.add(widthSpinner = new JSpinner(widthSettings));
    sizePanel.add(new JLabel("pixels"));

    // Add a spinner for choosing height
    sizePanel.add(new JLabel("Height:", SwingConstants.RIGHT));
    int height = ChartPanel.DEFAULT_HEIGHT;
    int minHeight = ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT;
    int maxHeight = ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT;
    SpinnerModel heightSettings = new SpinnerNumberModel(height, minHeight, maxHeight, 1);
    sizePanel.add(heightSpinner = new JSpinner(heightSettings));
    sizePanel.add(new JLabel("pixels"));

    JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, 4, 0));
    saveChartButton = new JButton("Save");
    saveChartButton.setMaximumSize(new Dimension(Short.MAX_VALUE, saveChartButton.getHeight()));
    saveChartButton.addActionListener(this);
    cancelButton = new JButton("Cancel");
    cancelButton.setMaximumSize(new Dimension(Short.MAX_VALUE, cancelButton.getHeight()));
    cancelButton.addActionListener(this);
    buttonsPanel.add(saveChartButton);/*from   w w w .  java  2 s. co m*/
    buttonsPanel.add(cancelButton);
    Box buttonsBox = Box.createHorizontalBox();
    buttonsBox.add(Box.createHorizontalGlue());
    buttonsBox.add(buttonsPanel);
    buttonsBox.add(Box.createHorizontalGlue());

    Container contentPane = getContentPane();
    contentPane.add(sizePanel, BorderLayout.NORTH);
    contentPane.add(Box.createVerticalStrut(3));
    contentPane.add(buttonsBox, BorderLayout.PAGE_END);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    getRootPane().setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    pack();
    setModal(true);
    setResizable(false);
    setLocationRelativeTo(frame);

}

From source file:TrackFocusDemo.java

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

    JPanel mugshots = new JPanel(new GridLayout(2, 3));
    pic1 = new Picture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage());
    pic1.setName("1");
    mugshots.add(pic1);//from  w  w w. jav  a  2s .  c  o  m
    pic2 = new Picture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage());
    pic2.setName("2");
    mugshots.add(pic2);
    pic3 = new Picture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage());
    pic3.setName("3");
    mugshots.add(pic3);
    pic4 = new Picture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage());
    pic4.setName("4");
    mugshots.add(pic4);
    pic5 = new Picture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage());
    pic5.setName("5");
    mugshots.add(pic5);
    pic6 = new Picture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage());
    pic6.setName("6");
    mugshots.add(pic6);

    info = new JLabel("Nothing selected");

    setPreferredSize(new Dimension(450, 350));
    add(mugshots, BorderLayout.CENTER);
    add(info, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();
            if (("focusOwner".equals(prop)) && (e.getNewValue() != null)
                    && ((e.getNewValue()) instanceof Picture)) {

                Component comp = (Component) e.getNewValue();
                String name = comp.getName();
                Integer num = new Integer(name);
                int index = num.intValue();
                if (index < 0 || index > comments.length) {
                    index = 0;
                }
                info.setText(comments[index]);
            }
        }
    });
}

From source file:events.KeyEventDemo.java

private void addComponentsToPane() {

    JButton button = new JButton("Clear");
    button.addActionListener(this);

    typingArea = new JTextField(20);
    typingArea.addKeyListener(this);

    //Uncomment this if you wish to turn off focus
    //traversal.  The focus subsystem consumes
    //focus traversal keys, such as Tab and Shift Tab.
    //If you uncomment the following line of code, this
    //disables focus traversal and the Tab events will
    //become available to the key event listener.
    //typingArea.setFocusTraversalKeysEnabled(false);

    displayArea = new JTextArea();
    displayArea.setEditable(false);/*from w w  w  .  j  a va2s  .  c  o  m*/
    JScrollPane scrollPane = new JScrollPane(displayArea);
    scrollPane.setPreferredSize(new Dimension(375, 125));

    getContentPane().add(typingArea, BorderLayout.PAGE_START);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    getContentPane().add(button, BorderLayout.PAGE_END);
}

From source file:ListDemo.java

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

    listModel = new DefaultListModel();
    listModel.addElement("Debbie Scott");
    listModel.addElement("Scott Hommel");
    listModel.addElement("Sharon Zakhour");

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);// w w w .  j  av  a2 s  .c om
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton hireButton = new JButton(hireString);
    HireListener hireListener = new HireListener(hireButton);
    hireButton.setActionCommand(hireString);
    hireButton.addActionListener(hireListener);
    hireButton.setEnabled(false);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    employeeName = new JTextField(10);
    employeeName.addActionListener(hireListener);
    employeeName.getDocument().addDocumentListener(hireListener);
    String name = listModel.getElementAt(list.getSelectedIndex()).toString();

    // Create a panel that uses BoxLayout.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(employeeName);
    buttonPane.add(hireButton);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
}

From source file:visualizer.datamining.dataanalysis.CreateLineGraph.java

/** This method is called from within the constructor to
 * initialize the form.//from ww w .j a va  2s . c o  m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonPanel = new javax.swing.JPanel();
    saveImageButton = new javax.swing.JButton();
    closeButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setModal(true);

    saveImageButton.setText("Save Image");
    saveImageButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveImageButtonActionPerformed(evt);
        }
    });
    buttonPanel.add(saveImageButton);

    closeButton.setText("Close");
    closeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, java.awt.BorderLayout.PAGE_END);

    pack();
}

From source file:org.opendatakit.briefcase.ui.ScrollingStatusListDialog.java

private ScrollingStatusListDialog(Frame frame, String title, IFormDefinition form, String statusHtml) {
    super(frame, title + form.getFormName(), true);
    this.form = form;
    AnnotationProcessor.process(this);
    // Create and initialize the buttons.
    JButton cancelButton = new JButton("Close");
    cancelButton.addActionListener(this);
    getRootPane().setDefaultButton(cancelButton);

    editorArea = new JEditorPane("text/plain", statusHtml);
    editorArea.setEditable(false);/*  ww w. j a  va2s . c  om*/
    //Put the editor pane in a scroll pane.
    JScrollPane editorScrollPane = new JScrollPane(editorArea);
    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    editorScrollPane.setPreferredSize(new Dimension(400, 300));
    editorScrollPane.setMinimumSize(new Dimension(10, 10));

    // Create a container so that we can add a title around
    // the scroll pane. Can't add a title directly to the
    // scroll pane because its background would be white.
    // Lay out the label and scroll pane from top to bottom.
    JPanel listPane = new JPanel();
    listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
    listPane.add(Box.createRigidArea(new Dimension(0, 5)));
    listPane.add(editorScrollPane);
    listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // Lay out the buttons from left to right.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(cancelButton);

    // Put everything together, using the content pane's BorderLayout.
    Container contentPane = getContentPane();
    contentPane.add(listPane, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);

    // Initialize values.
    pack();
    setLocationRelativeTo(null);
}

From source file:DialogDemo.java

/** Creates the GUI shown inside the frame's content pane. */
public DialogDemo(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;
    customDialog = new CustomDialog(frame, "geisel", this);
    customDialog.pack();/*from   w w w  .j av  a  2  s.c  o  m*/

    // Create the components.
    JPanel frequentPanel = createSimpleDialogBox();
    JPanel featurePanel = createFeatureDialogBox();
    JPanel iconPanel = createIconDialogBox();
    label = new JLabel("Click the \"Show it!\" button" + " to bring up the selected dialog.", JLabel.CENTER);

    // Lay them out.
    Border padding = BorderFactory.createEmptyBorder(20, 20, 5, 20);
    frequentPanel.setBorder(padding);
    featurePanel.setBorder(padding);
    iconPanel.setBorder(padding);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Simple Modal Dialogs", null, frequentPanel, simpleDialogDesc); // tooltip text
    tabbedPane.addTab("More Dialogs", null, featurePanel, moreDialogDesc); // tooltip
                                                                           // text
    tabbedPane.addTab("Dialog Icons", null, iconPanel, iconDesc); // tooltip
                                                                  // text

    add(tabbedPane, BorderLayout.CENTER);
    add(label, BorderLayout.PAGE_END);
    label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}

From source file:de.rub.syssec.saaf.gui.frame.CfgSelectorFrame.java

/**
 * A frame to generate and open Control Flow Graphs. CFGs are created using mxGraph
 * and are saved as PNGs.//  w  ww  .  j av a2  s  . com
 * 
 * @param smaliClass the smali class to select methods from
 */
public CfgSelectorFrame(ClassInterface smaliClass) {
    super(smaliClass.getFullClassName(true), true, true, true, true);
    this.smaliClass = smaliClass;

    listModel = new MethodTableModel(smaliClass);
    list.setModel(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent event) {
            int viewRow = list.getSelectedRow();
            if (viewRow <= 0) {
                showButton.setEnabled(false);
            } else {
                showButton.setEnabled(true);
            }
        }
    });

    JScrollPane listScrollPane = new JScrollPane(list);

    ActionListener al = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (e.getActionCommand().equals(SHOW_OPERATION)) {
                generateAndShowCfg(true);
            } else if (e.getActionCommand().equals(GENERATE_OPERATION)) {
                generateAndShowCfg(false);
            }
        }
    };

    generateButton = new JButton(GENERATE_OPERATION);
    generateButton.setActionCommand(GENERATE_OPERATION);
    generateButton.addActionListener(al);
    showButton = new JButton(SHOW_OPERATION);
    showButton.setEnabled(false);
    showButton.addActionListener(al);

    saveCfgCheckBox = new JCheckBox("Save a copy");
    saveCfgCheckBox.setToolTipText("Save a copy in the configured CFG folder upon generation.");

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(generateButton);
    buttonPane.add(saveCfgCheckBox);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JPanel filler = new JPanel();
    filler.setPreferredSize(new Dimension(10, 10));
    buttonPane.add(filler);
    buttonPane.add(showButton);

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);

    this.setPreferredSize(new Dimension(500, 250));
    this.pack();
    this.setVisible(true);
}