Example usage for java.awt BorderLayout SOUTH

List of usage examples for java.awt BorderLayout SOUTH

Introduction

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

Prototype

String SOUTH

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

Click Source Link

Document

The south layout constraint (bottom of container).

Usage

From source file:EHRAppointment.ChartPanelDraw.java

/**
 *
 * @param result//  ww w  .  j a  va  2s  .  c om
 * @param type
 */
public ChartPanelDraw(java.util.List<Vitals> result, String type) {
    this.type = type;
    this.result = result;
    dataset = createTimeDataset();
    chartPanel = createChart(dataset, type);

    JFrame f = new JFrame("Vital Plot"); //Jframe to draw the graph
    f.setTitle("Vital Plot");
    f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    f.setLayout(new BorderLayout(0, 5));
    f.add(chartPanel, BorderLayout.CENTER);
    f.setIconImage(new ImageIcon(getClass().getResource("/images/icon_transparent.png")).getImage());

    chartPanel.setHorizontalAxisTrace(true); //set properties of the graph 
    chartPanel.setVerticalAxisTrace(true);
    chartPanel.setMouseWheelEnabled(true);

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(createTrace()); //Add components to panel
    panel.add(createDate());
    panel.add(createZoom());
    f.add(panel, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:TArea.java

public void init() {
    Container container = getContentPane();

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 2));

    resetButton = new JRadioButton("Reset", true);

    addButton = new JRadioButton("Add");
    subtractButton = new JRadioButton("Subtract");
    intersectButton = new JRadioButton("Intersect");
    exclusiveORButton = new JRadioButton("ExclusiveOR");

    ButtonGroup group = new ButtonGroup();
    group.add(resetButton);/*from  w w w.j  a  v  a  2 s . c  o  m*/
    group.add(addButton);
    group.add(subtractButton);
    group.add(intersectButton);
    group.add(exclusiveORButton);
    group.add(resetButton);

    resetButton.addActionListener(this);
    addButton.addActionListener(this);
    subtractButton.addActionListener(this);
    intersectButton.addActionListener(this);
    exclusiveORButton.addActionListener(this);

    panel.add(addButton);
    panel.add(subtractButton);
    panel.add(intersectButton);
    panel.add(exclusiveORButton);

    container.add(panel, BorderLayout.NORTH);
    container.add(resetButton, BorderLayout.SOUTH);

    canvas = new DrawingCanvas();
    container.add(canvas);
}

From source file:RadioButtonTest.java

public RadioButtonFrame() {
    setTitle("RadioButtonTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // add the sample text label

    label = new JLabel("The quick brown fox jumps over the lazy dog.");
    label.setFont(new Font("Serif", Font.PLAIN, DEFAULT_SIZE));
    add(label, BorderLayout.CENTER);

    // add the radio buttons

    buttonPanel = new JPanel();
    group = new ButtonGroup();

    addRadioButton("Small", 8);
    addRadioButton("Medium", 12);
    addRadioButton("Large", 18);
    addRadioButton("Extra large", 36);

    add(buttonPanel, BorderLayout.SOUTH);
}

From source file:ButtonScroll.java

public ButtonScroll() {
    super("Scrolling Programmatically");
    setSize(400, 400);//from  www .  j  a  va2  s .  com
    getContentPane().setLayout(new BorderLayout());

    ImageIcon shuttle = new ImageIcon("largeJava2sLogo.GIF");
    pgVertical = shuttle.getIconHeight() / 5;
    pgHorzontal = shuttle.getIconWidth() / 5;
    JLabel lbl = new JLabel(shuttle);

    viewport = new JViewport();
    viewport.setView(lbl);
    viewport.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            enableButtons(ButtonScroll.this.viewport.getViewPosition());
        }
    });
    getContentPane().add(viewport, BorderLayout.CENTER);

    JPanel pv = new JPanel(new BorderLayout());
    upButton = createButton("up", 'u');
    ActionListener lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            movePanel(0, -1);
        }
    };
    upButton.addActionListener(lst);
    pv.add(upButton, BorderLayout.NORTH);

    downButton = createButton("down", 'd');
    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            movePanel(0, 1);
        }
    };
    downButton.addActionListener(lst);
    pv.add(downButton, BorderLayout.SOUTH);
    getContentPane().add(pv, BorderLayout.EAST);

    JPanel ph = new JPanel(new BorderLayout());
    leftButton = createButton("left", 'l');
    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            movePanel(-1, 0);
        }
    };
    leftButton.addActionListener(lst);
    ph.add(leftButton, BorderLayout.WEST);

    rightButton = createButton("right", 'r');
    lst = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            movePanel(1, 0);
        }
    };
    rightButton.addActionListener(lst);
    ph.add(rightButton, BorderLayout.EAST);
    getContentPane().add(ph, BorderLayout.SOUTH);

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setVisible(true);
    movePanel(0, 0);
}

From source file:AffineTransformApp.java

public AffineTransformApp() {
    super();/*ww w  . ja  v a2s. com*/
    Container container = getContentPane();

    displayPanel = new DisplayPanel();
    container.add(displayPanel);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 4, 5, 5));
    scaleXval = new JComboBox(scaleValues);
    scaleXval.setSelectedItem("1.00");
    scaleXval.addActionListener(new ComboBoxListener());
    scaleYval = new JComboBox(scaleValues);
    scaleYval.setSelectedItem("1.00");
    scaleYval.addActionListener(new ComboBoxListener());

    shearXval = new JComboBox(shearValues);
    shearXval.setSelectedItem("0.00");
    shearXval.addActionListener(new ComboBoxListener());
    shearYval = new JComboBox(shearValues);
    shearYval.setSelectedItem("0.00");
    shearYval.addActionListener(new ComboBoxListener());

    panel.add(new JLabel("Scale X value:"));
    panel.add(scaleXval);
    panel.add(new JLabel("Scale Y value:"));
    panel.add(scaleYval);
    panel.add(new JLabel("Shear X value:"));
    panel.add(shearXval);
    panel.add(new JLabel("Shear Y value:"));
    panel.add(shearYval);

    container.add(BorderLayout.SOUTH, panel);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    setSize(displayPanel.getWidth(), displayPanel.getHeight() + 10);
    setVisible(true);
}

From source file:ProgressMonitorTest.java

public ProgressMonitorFrame() {
    setTitle("ProgressMonitorTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // this text area holds the activity output
    textArea = new JTextArea();

    // set up a button panel
    JPanel panel = new JPanel();
    startButton = new JButton("Start");
    panel.add(startButton);//from w  w  w . ja  v a  2 s  .  c o  m

    add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);

    // set up the button action

    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            startButton.setEnabled(false);
            final int MAX = 1000;

            // start activity
            activity = new SimulatedActivity(MAX);
            activity.execute();

            // launch progress dialog
            progressDialog = new ProgressMonitor(ProgressMonitorFrame.this, "Waiting for Simulated Activity",
                    null, 0, MAX);
            cancelMonitor.start();
        }
    });

    // set up the timer action

    cancelMonitor = new Timer(500, new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            if (progressDialog.isCanceled()) {
                activity.cancel(true);
                startButton.setEnabled(true);
            } else if (activity.isDone()) {
                progressDialog.close();
                startButton.setEnabled(true);
            } else {
                progressDialog.setProgress(activity.getProgress());
            }
        }
    });
}

From source file:SwingThreading.java

public SwingThreading() {
    super("Swing Threading");

    JButton freezer = new JButton("Increment");
    freezer.addActionListener(this);

    counter = new JLabel("0");

    add(freezer, BorderLayout.CENTER);
    add(counter, BorderLayout.SOUTH);

    pack();/* w  w  w .j  a va  2s . co  m*/
    setLocationRelativeTo(null);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
}

From source file:SpinnerTest.java

public SpinnerFrame() {
    setTitle("SpinnerTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    JPanel buttonPanel = new JPanel();
    okButton = new JButton("Ok");
    buttonPanel.add(okButton);//  www  .j ava2s .c  o  m
    add(buttonPanel, BorderLayout.SOUTH);

    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 3));
    add(mainPanel, BorderLayout.CENTER);

    JSpinner defaultSpinner = new JSpinner();
    addRow("Default", defaultSpinner);

    JSpinner boundedSpinner = new JSpinner(new SpinnerNumberModel(5, 0, 10, 0.5));
    addRow("Bounded", boundedSpinner);

    String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

    JSpinner listSpinner = new JSpinner(new SpinnerListModel(fonts));
    addRow("List", listSpinner);

    JSpinner reverseListSpinner = new JSpinner(new SpinnerListModel(fonts) {
        public Object getNextValue() {
            return super.getPreviousValue();
        }

        public Object getPreviousValue() {
            return super.getNextValue();
        }
    });
    addRow("Reverse List", reverseListSpinner);

    JSpinner dateSpinner = new JSpinner(new SpinnerDateModel());
    addRow("Date", dateSpinner);

    JSpinner betterDateSpinner = new JSpinner(new SpinnerDateModel());
    String pattern = ((SimpleDateFormat) DateFormat.getDateInstance()).toPattern();
    betterDateSpinner.setEditor(new JSpinner.DateEditor(betterDateSpinner, pattern));
    addRow("Better Date", betterDateSpinner);

    JSpinner timeSpinner = new JSpinner(new SpinnerDateModel());
    pattern = ((SimpleDateFormat) DateFormat.getTimeInstance(DateFormat.SHORT)).toPattern();
    timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, pattern));
    addRow("Time", timeSpinner);

    JSpinner permSpinner = new JSpinner(new PermutationSpinnerModel("meat"));
    addRow("Word permutations", permSpinner);
}

From source file:ColorApp.java

public ColorApp() {
    super();/* ww w .  j a  v a 2s .  c  o  m*/
    Container container = getContentPane();

    displayPanel = new DisplayPanel();
    container.add(displayPanel);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(3, 2));
    panel.setBorder(new TitledBorder("Click a Button to Perform the Associated Operation and Reset..."));

    brightenButton = new JButton("Brightness >>");
    brightenButton.addActionListener(new ButtonListener());
    darkenButton = new JButton("Darkness >>");
    darkenButton.addActionListener(new ButtonListener());
    contrastIncButton = new JButton("Contrast >>");
    contrastIncButton.addActionListener(new ButtonListener());
    contrastDecButton = new JButton("Contrast <<");
    contrastDecButton.addActionListener(new ButtonListener());
    reverseButton = new JButton("Negative");
    reverseButton.addActionListener(new ButtonListener());
    resetButton = new JButton("Reset");
    resetButton.addActionListener(new ButtonListener());

    panel.add(brightenButton);
    panel.add(darkenButton);
    panel.add(contrastIncButton);
    panel.add(contrastDecButton);
    panel.add(reverseButton);
    panel.add(resetButton);

    container.add(BorderLayout.SOUTH, panel);

    addWindowListener(new WindowEventHandler());
    setSize(displayPanel.getWidth(), displayPanel.getHeight() + 25);
    show();
}

From source file:CombineApp.java

public CombineApp() {
    super("TBandCombineOp");
    Container container = getContentPane();

    displayPanel = new CombinePanel();
    container.add(displayPanel);/*  w w w.j  a va2 s  . c om*/

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(3, 2));
    panel.setBorder(new TitledBorder("Click a Button to Perform the Associated Operation and Reset..."));

    redBandButton = new JButton("Show Red Band");
    redBandButton.addActionListener(new ButtonListener());
    greenBandButton = new JButton("Show Green Band");
    greenBandButton.addActionListener(new ButtonListener());
    blueBandButton = new JButton("Show Blue Band");
    blueBandButton.addActionListener(new ButtonListener());
    inverseBandButton = new JButton("Invert All Bands");
    inverseBandButton.addActionListener(new ButtonListener());
    middleBandButton = new JButton("Average Each Band");
    middleBandButton.addActionListener(new ButtonListener());

    resetButton = new JButton("Reset");
    resetButton.addActionListener(new ButtonListener());

    panel.add(redBandButton);
    panel.add(blueBandButton);
    panel.add(greenBandButton);
    panel.add(inverseBandButton);
    panel.add(middleBandButton);
    panel.add(resetButton);

    container.add(BorderLayout.SOUTH, panel);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    setSize(displayPanel.getWidth(), displayPanel.getHeight());
    setVisible(true);
}