Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

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

Prototype

String EAST

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

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:max.hubbard.Factoring.Graphing.java

public static void graph(String equation) {
    LinkedList<LinkedHashMap<Float, Integer>> list = Separate.separate(equation);

    XYDataset set = createDataset(list, equation);
    final JFreeChart chart = createChart(set, equation);
    final ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.setVisible(true);// ww w. j  a  va2  s  .  c o  m
    chartPanel.setDomainZoomable(true);
    chartPanel.setRangeZoomable(true);
    chartPanel.setMouseWheelEnabled(true);

    chartPanel.setPreferredSize(new java.awt.Dimension(Main.label.getWidth(), Main.label.getHeight()));

    Main.getPanel().removeAll();
    Main.getPanel().updateUI();
    Main.getPanel().add(chartPanel, BorderLayout.CENTER);
    Main.getPanel().add(Interface.box, BorderLayout.EAST);

    Main.getFrame().pack();
}

From source file:MainClass.java

public MainClass() {
    setLayout(new BorderLayout());
    model = new DefaultListModel();
    list = new JList(model);
    JScrollPane pane = new JScrollPane(list);
    JButton addButton = new JButton("Add Element");
    JButton removeButton = new JButton("Remove Element");
    for (int i = 0; i < 15; i++)
        model.addElement("Element " + i);

    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            model.addElement("Element " + counter);
            counter++;/*  w  w w .j  a  v  a2  s.c  o m*/
        }
    });
    removeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (model.getSize() > 0)
                model.removeElementAt(0);
        }
    });

    add(pane, BorderLayout.NORTH);
    add(addButton, BorderLayout.WEST);
    add(removeButton, BorderLayout.EAST);
}

From source file:Main.java

void initContainer(Container container) {
    container.setLayout(new GridLayout(1, 0));
    buttonPanel = new JPanel(new GridLayout(0, 1));
    Object[] menuNames = { "ROOT",
            new Object[] { "A", new Object[] { "CSS", "HTML", "SQL", "Java" }, "Code",
                    new Object[] { "Test", "S", "C" } },
            new Object[] { "Code 1", new Object[] { "A", "I", "H", "O" }, "Code",
                    new Object[] { "P", "S", "C" }, "C" } };

    DefaultMutableTreeNode currentNode = processHierarchy(menuNames);
    menuTree = new JTree(currentNode);
    menuTree.setVisibleRowCount(10);//from   w  w w  .jav  a 2  s  . c  o  m
    menuTree.expandRow(2);
    initializeButtons(currentNode);
    container.add(buttonPanel, BorderLayout.WEST);
    container.add(new JScrollPane(menuTree), BorderLayout.EAST);
    menuTree.addTreeSelectionListener(e -> {
        initializeButtons((DefaultMutableTreeNode) menuTree.getLastSelectedPathComponent());
    });
}

From source file:CommonLayouts.java

public CommonLayouts() {
    super("Common Layout Managers");
    setSize(500, 380);// ww w  .j  a  v a 2  s. co  m

    JPanel desktop = new JPanel();
    getContentPane().add(desktop);

    JPanel fr1 = new JPanel();
    fr1.setBorder(new TitledBorder("FlowLayout"));
    fr1.setLayout(new FlowLayout());
    fr1.add(new JButton("1"));
    fr1.add(new JButton("2"));
    fr1.add(new JButton("3"));
    fr1.add(new JButton("4"));
    desktop.add(fr1, 0);

    JPanel fr2 = new JPanel();
    fr2.setBorder(new TitledBorder("GridLayout"));
    fr2.setLayout(new GridLayout(2, 2));
    fr2.add(new JButton("1"));
    fr2.add(new JButton("2"));
    fr2.add(new JButton("3"));
    fr2.add(new JButton("4"));
    desktop.add(fr2, 0);

    JPanel fr3 = new JPanel();
    fr3.setBorder(new TitledBorder("BorderLayout"));
    fr3.add(new JButton("1"), BorderLayout.NORTH);
    fr3.add(new JButton("2"), BorderLayout.EAST);
    fr3.add(new JButton("3"), BorderLayout.SOUTH);
    fr3.add(new JButton("4"), BorderLayout.WEST);
    desktop.add(fr3, 0);

    JPanel fr4 = new JPanel();
    fr4.setBorder(new TitledBorder("BoxLayout - X"));
    fr4.setLayout(new BoxLayout(fr4, BoxLayout.X_AXIS));
    fr4.add(new JButton("1"));
    fr4.add(Box.createHorizontalStrut(12));
    fr4.add(new JButton("2"));
    fr4.add(Box.createGlue());
    fr4.add(new JButton("3"));
    fr4.add(Box.createHorizontalGlue());
    fr4.add(new JButton("4"));
    desktop.add(fr4, 0);

    JPanel fr5 = new JPanel();
    fr5.setBorder(new TitledBorder("BoxLayout - Y"));
    fr5.setLayout(new BoxLayout(fr5, BoxLayout.Y_AXIS));
    fr5.add(new JButton("1"));
    fr5.add(Box.createVerticalStrut(10));
    fr5.add(new JButton("2"));
    fr5.add(Box.createGlue());
    fr5.add(new JButton("3"));
    fr5.add(Box.createVerticalGlue());
    fr5.add(new JButton("4"));
    desktop.add(fr5, 0);

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

From source file:SelectionMonitor.java

public SelectionMonitor() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    //  Format the list and the buttons in a vertical box
    Box rightBox = new Box(BoxLayout.Y_AXIS);
    Box leftBox = new Box(BoxLayout.Y_AXIS);

    //  Monitor all list selections
    list.addListSelectionListener(new RadioUpdater());

    for (int i = 0; i < label.length; i++) {
        checks[i] = new JCheckBox("Selection " + i);
        checks[i].setEnabled(false);//from  w ww.  j a  v a2  s .  c  o m
        rightBox.add(checks[i]);
    }
    leftBox.add(pane);
    add(rightBox, BorderLayout.EAST);
    add(leftBox, BorderLayout.WEST);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());
    model = new DefaultListModel();
    list = new JList(model);
    JScrollPane pane = new JScrollPane(list);
    JButton addButton = new JButton("Add Element");
    JButton removeButton = new JButton("Remove Element");
    for (int i = 0; i < 15; i++)
        model.addElement("Element " + i);

    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            model.addElement("Element " + counter);
            counter++;/*from  ww w.  jav  a2  s.c o  m*/
        }
    });
    removeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (model.getSize() > 0)
                model.removeElementAt(0);
        }
    });

    add(pane, BorderLayout.NORTH);
    add(addButton, BorderLayout.WEST);
    add(removeButton, BorderLayout.EAST);
}

From source file:Main.java

public Main() {
    super("Demostrating BoxLayout");
    final int SIZE = 3;
    Container c = getContentPane();
    c.setLayout(new BorderLayout(30, 30));

    Box boxes[] = new Box[4];

    boxes[0] = Box.createHorizontalBox();
    boxes[1] = Box.createVerticalBox();
    boxes[2] = Box.createHorizontalBox();
    boxes[3] = Box.createVerticalBox();

    for (int i = 0; i < SIZE; i++)
        boxes[0].add(new JButton("boxes[0]: " + i));

    for (int i = 0; i < SIZE; i++) {
        boxes[1].add(Box.createVerticalStrut(25));
        boxes[1].add(new JButton("boxes[1]: " + i));
    }/*from   w  w w . j ava 2  s. c o  m*/

    for (int i = 0; i < SIZE; i++) {
        boxes[2].add(Box.createHorizontalGlue());
        boxes[2].add(new JButton("boxes[2]: " + i));
    }

    for (int i = 0; i < SIZE; i++) {
        boxes[3].add(Box.createRigidArea(new Dimension(12, 8)));
        boxes[3].add(new JButton("boxes[3]: " + i));
    }

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    for (int i = 0; i < SIZE; i++) {
        panel.add(Box.createGlue());
        panel.add(new JButton("panel: " + i));
    }

    c.add(boxes[0], BorderLayout.NORTH);
    c.add(boxes[1], BorderLayout.EAST);
    c.add(boxes[2], BorderLayout.SOUTH);
    c.add(boxes[3], BorderLayout.WEST);
    c.add(panel, BorderLayout.CENTER);

    setSize(350, 300);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);

}

From source file:ListModelExample.java

public ListModelExample() {
    setLayout(new BorderLayout());
    model = new DefaultListModel();
    list = new JList(model);
    JScrollPane pane = new JScrollPane(list);
    JButton addButton = new JButton("Add Element");
    JButton removeButton = new JButton("Remove Element");
    for (int i = 0; i < 15; i++)
        model.addElement("Element " + i);

    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            model.addElement("Element " + counter);
            counter++;/*from  w ww  .  j a v a2 s  .c o  m*/
        }
    });
    removeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (model.getSize() > 0)
                model.removeElementAt(0);
        }
    });

    add(pane, BorderLayout.NORTH);
    add(addButton, BorderLayout.WEST);
    add(removeButton, BorderLayout.EAST);
}

From source file:se.cambio.cds.gdl.editor.view.panels.TerminologyPanel.java

public void init() {
    this.setLayout(new BorderLayout());
    this.add(getEditButtonPanel(), BorderLayout.EAST);
    this.add(getMainPanel(), BorderLayout.CENTER);
    this.setFocusable(true);
    refresh();/*ww w .java2  s.  c  o m*/
}

From source file:mls.FramePlot.java

public FramePlot() {

    seriesMedia = new XYSeries("Media campionaria (Gordon)");
    seriesVarianza = new XYSeries("Varianza campionaria (Gordon)");

    final XYSeriesCollection datasetMedia = new XYSeriesCollection(this.seriesMedia);
    final XYSeriesCollection datasetVarianza = new XYSeriesCollection(this.seriesVarianza);
    final JFreeChart chartMedia = createChartMedia(datasetMedia);
    final JFreeChart chartVarianza = createChartVarianza(datasetVarianza);

    ChartPanel chartPanelMedia = new ChartPanel(chartMedia);
    final ChartPanel chartPanelVarianza = new ChartPanel(chartVarianza);

    final JPanel content = new JPanel(new BorderLayout());
    content.add(chartPanelMedia);/*from   w ww  .  j a v  a2  s  .  c  om*/
    content.add(chartPanelVarianza, BorderLayout.EAST);
    chartPanelMedia.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanelVarianza.setPreferredSize(new java.awt.Dimension(500, 270));
    add(content);
    //setContentPane(content);
}