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

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    TreeNode root = getNodes();/* ww w .  j a va  2s.c om*/
    DefaultTreeModel model = new DefaultTreeModel(root);
    JTree tree = new JTree(model);
    tree.setRootVisible(false);

    JButton add = new JButton("add new");
    add.addActionListener(e -> {
        DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
        if (selectedNode == null) {
            return;
        }
        MyObject obj = (MyObject) selectedNode.getUserObject();
        MyObject newChild = new MyObject(obj.name + "-" + (obj.childs.size() + 1));
        obj.childs.add(newChild);
        DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(newChild);
        model.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
        TreeNode[] nodes = model.getPathToRoot(newNode);
        TreePath path = new TreePath(nodes);
        tree.scrollPathToVisible(path);
    });

    JButton print = new JButton("print childs");
    print.addActionListener(e -> {
        DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
        if (selectedNode == null) {
            return;
        }
        MyObject obj = (MyObject) selectedNode.getUserObject();
        System.out.println(obj.childs);
    });
    JPanel btns = new JPanel();
    btns.add(add);
    btns.add(print);

    add(new JScrollPane(tree));
    add(btns, BorderLayout.SOUTH);
    pack();
    setVisible(true);
}

From source file:org.pgptool.gui.ui.importkey.KeyImporterView.java

@Override
protected void internalInitComponents() {
    pnl = new JPanel(new BorderLayout());
    pnl.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    keysTableView.setPersistenceCode("keyImprt");
    keysTableView.renderTo(pnl, BorderLayout.CENTER);

    pnl.add(buildPanelButtons(), BorderLayout.SOUTH);
}

From source file:userinterface.graph.GraphOptions.java

/** Creates a new instance of MultiGraphOptions */
public GraphOptions(GUIPlugin plugin, JPanel theModel, JFrame gui, String title) {
    super(gui, title);

    gop = new GraphOptionsPanel(plugin, gui, theModel);

    gop.setPreferredSize(new Dimension(400, 650));

    this.getContentPane().add(gop);

    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    this.getContentPane().add(p, BorderLayout.SOUTH);

    this.getContentPane().setSize(400, 650);

    JButton jb = new JButton("Close");

    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            gop.stopEditors();/*from   w ww. j a  va  2 s  .c o m*/
            setVisible(false);
        }
    });

    jb.addFocusListener(new FocusListener() {
        /**
         * Invoked when a component gains the keyboard focus.
         */
        public void focusGained(FocusEvent e) {
        }

        /**
         * Invoked when a component loses the keyboard focus.
         */
        public void focusLost(FocusEvent e) {
            //gop.stopEditors();
        }

    });

    p.add(jb);

    pack();
    setLocationRelativeTo(getParent()); // centre
    //show();
    setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
}

From source file:app.gui.ViewGraphic.java

public ViewGraphic(String title) {
    setSize(600, 400);/*from ww  w  .j a  v a  2 s  .c o  m*/
    setLocationRelativeTo(this);
    setTitle(title);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent arg0) {
            dispose();
        }
    });
    setLayout(new BorderLayout());

    serieError = new XYSeries(title);

    dataset = new XYSeriesCollection();
    dataset.addSeries(serieError);

    chart = ChartFactory.createXYLineChart(title, Translate.get("GUI_PERIODS"), Translate.get("GUI_ERROR"),
            dataset, PlotOrientation.VERTICAL, true, true, false);
    add(new ChartPanel(chart), BorderLayout.CENTER);

    JPanel south = new JPanel(new MigLayout());

    lblError = new JLabel("");
    lblError.setHorizontalTextPosition(SwingConstants.LEFT);
    lblError.setFont(new Font("ARIAL", Font.BOLD, 26));
    JLabel lblErrorTitle = new JLabel(Translate.get("GUI_ERROR") + ": ");
    lblErrorTitle.setFont(new Font("ARIAL", Font.BOLD, 26));
    south.add(lblErrorTitle);
    south.add(lblError, "wrap");

    add(south, BorderLayout.SOUTH);
    setVisible(true);
}

From source file:com.fisher.mainFrame.java

private void startButtonActionPerformed(ActionEvent e) {
    // TODO add your code here
    this.logger.log("starting the application");
    this.handler = new DataHandler(fileLogger); // kick start the connection in the DataHandler constructor

    // Create and attach chart panel
    this.plotter = new BotDataPlotter();
    this.handler.setPlotter(this.plotter);

    this.plotter.setKalmanTickSource(this.handler.m_kalmanBot.m_midTicks);
    this.plotter.setKalmanOutputSource(this.handler.m_kalmanBot.m_output);
    this.plotter.setKalmanSignalSource(this.handler.m_kalmanBot.m_kFilter.buySellSignal);

    this.chart = plotter.createKalmanChart();
    this.plotter.customizeChart();

    this.chartPanel = new ChartPanel(this.chart);
    this.plotScrollPane = new JScrollPane();
    this.plotScrollPane.add(chartPanel);
    this.plotScrollPane.setViewportView(chartPanel);

    Container pane = this.getContentPane();

    pane.add(this.plotScrollPane, BorderLayout.SOUTH);

    this.plotScrollPane.setVisible(true);

    pane.setVisible(false);//from w w w .j a  va2 s.  c o  m
    pane.setVisible(true);

    this.startButton.setEnabled(false);
    this.stopButton.setEnabled(true);

}

From source file:org.encog.workbench.dialogs.common.ChartField.java

public int createField(JPanel panel, int x, int y, int width) {
    this.chartHolder = new JPanel();

    XYDataset dataset = generator.createDataset();
    JFreeChart chart = generator.createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartHolder.setLayout(new BorderLayout());
    chartHolder.add(chartPanel, BorderLayout.CENTER);
    chartHolder.add(this.refreshButton = new JButton("Refresh Chart"), BorderLayout.SOUTH);

    this.refreshButton.addActionListener(this);
    this.setField(chartHolder);

    this.getField().setLocation(5, y);
    this.getField().setSize(this.getOwner().getWidth() - 5, height);

    JLabel label = createLabel();
    label.setVisible(false);/*from   ww  w .j a  v  a  2  s . com*/
    label.setLocation(label.getX(), y);
    panel.add(label);
    panel.add(this.getField());

    return y + this.getField().getHeight();
}

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.dialogs.DownloadNotice.java

public DownloadNotice(HashMap<JSONObject, URL> downloads) {

    this.setDownloads(downloads);
    JPanel basic = new JPanel();
    basic.setLayout(new BoxLayout(basic, BoxLayout.Y_AXIS));
    add(basic);/* w w  w . j  a  va  2s.co m*/

    JPanel topPanel = new JPanel(new BorderLayout(0, 0));
    topPanel.setMaximumSize(new Dimension(450, 0));
    JLabel hint = new JLabel("CHGManager Download Manager");
    hint.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
    topPanel.add(hint);

    JSeparator separator = new JSeparator();
    separator.setForeground(Color.gray);

    topPanel.add(separator, BorderLayout.SOUTH);

    basic.add(topPanel);

    JPanel textPanel = new JPanel(new BorderLayout());
    textPanel.setBorder(BorderFactory.createEmptyBorder(15, 25, 15, 25));
    this.setTextPanel(new JTextPane());

    this.getTextPanel().setContentType("text/html");
    String text = "<p><b>Some files are missing from your CHGManager install. Don't worry. We're trying to download them. Please don't close this panel!</b></p>";
    this.getText().add(text);
    this.getTextPanel().setText(text);
    this.getTextPanel().setEditable(false);
    JScrollPane sp = new JScrollPane();
    sp.setSize(this.getTextPanel().getSize());
    basic.add(sp);

    //basic.add(textPanel);

    JPanel boxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0));
    basic.add(boxPanel);

    JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton close = new JButton("Close");

    bottom.add(close);
    basic.add(bottom);

    bottom.setMaximumSize(new Dimension(450, 0));

    this.setTitle("CHGManager Download Manager");
    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    try {

        Thread.sleep(2000);

    } catch (InterruptedException e) {

    }

    this.startDownload();

}

From source file:ColorPicker3.java

public ColorPicker3() {
    super("JColorChooser Test Frame");
    setSize(200, 100);/*from  www .ja  v a2  s. c o m*/
    final JButton go = new JButton("Show JColorChoser");
    final Container contentPane = getContentPane();
    go.addActionListener(new ActionListener() {
        final JColorChooser chooser = new JColorChooser();

        boolean first = true;

        public void actionPerformed(ActionEvent e) {
            if (first) {
                first = false;
                GrayScalePanel gsp = new GrayScalePanel();
                chooser.addChooserPanel(gsp);
                chooser.setPreviewPanel(new CustomPane());
            }
            JDialog dialog = JColorChooser.createDialog(ColorPicker3.this, "Demo 3", true, chooser,
                    new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            c = chooser.getColor();
                        }
                    }, null);
            dialog.setVisible(true);
            contentPane.setBackground(c);
        }
    });
    contentPane.add(go, BorderLayout.SOUTH);
    // addWindowListener(new BasicWindowMonitor()); // 1.1 & 1.2
    setDefaultCloseOperation(EXIT_ON_CLOSE);
}

From source file:Main.java

public TextPaneAttributes() {
    JTextPane textPane = new JTextPane();
    StyledDocument doc = textPane.getStyledDocument();
    MutableAttributeSet standard = new SimpleAttributeSet();

    StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
    doc.setParagraphAttributes(0, 0, standard, true);
    MutableAttributeSet keyWord = new SimpleAttributeSet();

    StyleConstants.setForeground(keyWord, Color.red);
    StyleConstants.setItalic(keyWord, true);

    textPane.setText("this is a test. \nthis is a four.");

    doc.setCharacterAttributes(0, 3, keyWord, false);
    doc.setCharacterAttributes(19, 4, keyWord, false);
    try {//w  w  w. java 2  s  .c o  m
        doc.insertString(0, "Start of text\n", null);
        doc.insertString(doc.getLength(), "End of text\n", keyWord);
    } catch (Exception e) {
    }
    MutableAttributeSet selWord = new SimpleAttributeSet();

    StyleConstants.setForeground(selWord, Color.RED);
    StyleConstants.setItalic(selWord, true);

    JScrollPane scrollPane = new JScrollPane(textPane);
    scrollPane.setPreferredSize(new Dimension(200, 200));
    add(scrollPane);

    JButton toggleButton = new JButton("Find 'four'");
    toggleButton.addActionListener(e -> {
        int index = textPane.getText().indexOf("four");
        StyledDocument doc1 = textPane.getStyledDocument();
        doc1.setCharacterAttributes(index, 4, selWord, false);
    });
    add(toggleButton, BorderLayout.SOUTH);
}

From source file:freemrs.ChartPanelDraw.java

public ChartPanelDraw(java.util.List<Vitals> result, String type) {
    this.type = type;
    this.result = result;
    dataset = createTimeDataset();// w w  w.  j  a  v a2s.c om
    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);
}