Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

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

Prototype

String WEST

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

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:org.eclipse.wb.tests.designer.core.model.association.InvocationSecondaryAssociationTest.java

public void test_0() throws Exception {
    setFileContentSrc("test/AFrame.java",
            getTestSource("public class AFrame extends JFrame {",
                    "  protected void addGB(Container parent, Component child, String constraints) {",
                    "    parent.add(child, constraints);", "  }", "}"));
    setFileContentSrc("test/AFrame.wbp-component.xml", getSourceDQ("<?xml version='1.0' encoding='UTF-8'?>",
            "<component xmlns='http://www.eclipse.org/wb/WBPComponent'>", "  <methods>",
            "    <method name='addGB'>", "      <parameter type='java.awt.Container' parent2='true'/>",
            "      <parameter type='java.awt.Component' child2='true'/>",
            "      <parameter type='java.lang.String'/>", "    </method>", "  </methods>", "</component>"));
    waitForAutoBuild();// w  w w.  j ava 2s.  c  om
    //
    ContainerInfo frame = parseContainer("public class Test extends AFrame {", "  public Test() {",
            "    addGB(getContentPane(), new JButton('north'), BorderLayout.NORTH);",
            "    addGB(getContentPane(), new JButton('west'), BorderLayout.WEST);", "  }", "}");
    frame.refresh();
    // prepare contentPane with BorderLayout
    assertEquals(1, frame.getChildrenComponents().size());
    ContainerInfo contentPane = (ContainerInfo) frame.getChildrenComponents().get(0);
    BorderLayout borderLayout = (BorderLayout) contentPane.getContainer().getLayout();
    // check children of contentPane
    assertEquals(2, contentPane.getChildrenComponents().size());
    {
        Container container = contentPane.getContainer();
        Component[] components = container.getComponents();
        assertEquals(2, components.length);
    }
    // check "button north"
    {
        ComponentInfo button = contentPane.getChildrenComponents().get(0);
        assertSame(BorderLayout.NORTH, borderLayout.getConstraints(button.getComponent()));
    }
    // check "button west"
    {
        ComponentInfo button = contentPane.getChildrenComponents().get(1);
        assertSame(BorderLayout.WEST, borderLayout.getConstraints(button.getComponent()));
    }
    // check association for "button"
    {
        ComponentInfo button = contentPane.getChildrenComponents().get(0);
        InvocationSecondaryAssociation association = (InvocationSecondaryAssociation) button.getAssociation();
        assertEquals("addGB(getContentPane(), new JButton(\"north\"), BorderLayout.NORTH)",
                association.getSource());
        assertEquals("addGB(getContentPane(), new JButton(\"north\"), BorderLayout.NORTH);",
                m_lastEditor.getSource(association.getStatement()));
        // can not be moved
        try {
            association.move(null);
            fail();
        } catch (NotImplementedException e) {
        }
        // can not be reparented
        try {
            association.setParent(null);
            fail();
        } catch (NotImplementedException e) {
        }
    }
}

From source file:utilities.GraphViewer.java

public GraphViewer() {

    super("Graph Viewer");
    setRootPaneCheckingEnabled(false);/*from  www.j a v a  2  s .  c  o  m*/

    this.setLocation(0, 0);
    this.setVisible(false);
    dataset = new XYSeriesCollection();
    this.db = new Db();
    this.sensors = new LinkedList<JCheckBox>();
    this.sensors1 = new LinkedList<JCheckBox>();

    getContentPane().setLayout(new BorderLayout(0, 0));

    this.setName("Graph Viewer");
    setIconifiable(true);
    setClosable(true);
    setBounds(6, 95, 1000, 600);

    option = new JPanel();
    option.setBackground(new Color(240, 240, 255));
    option.setPreferredSize(new Dimension(200, 500));
    option.setLayout(new BorderLayout(10, 10));
    getContentPane().add(option, BorderLayout.WEST);

    parcourir = new JButton("Add Sensor");
    parcourir.setAlignmentX(Component.CENTER_ALIGNMENT);
    parcourir.addActionListener(this);
    option.add(parcourir, BorderLayout.NORTH);

    this.sensorsList = new JPanel();
    sensorsList.setLayout(new VerticalLayout());
    sensorsList.setBackground(Color.WHITE);

    scpane = new JScrollPane(sensorsList);
    scpane.setBorder(BorderFactory.createLineBorder(Color.black));
    scpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    option.add(scpane, BorderLayout.CENTER);

    paneGraphe = new JPanel();
    paneGraphe.setLayout(new BorderLayout(0, 0));
    graphe = graphe();
    paneGraphe.add(graphe, BorderLayout.CENTER);
    getContentPane().add(paneGraphe);

}

From source file:de.unidue.inf.is.ezdl.gframedl.components.checkboxlist.CheckBoxListCellRenderer.java

private void initialize() {
    panel = new JPanel();
    panel.setLayout(new BorderLayout());

    choicePanel = new JPanel(new BorderLayout());

    choice = new JCheckBox();

    choicePanel.add(choice, BorderLayout.CENTER);
    choicePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    choicePanel.setPreferredSize(new Dimension(150, 48));

    description = new JTextArea();
    description.setOpaque(true);//from w  w w . j a  v a2s  .  c  o  m
    description.setEditable(false);
    description.setLineWrap(true);
    description.setWrapStyleWord(true);

    description.setSize(400, 30);
    description.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    iconLabel = new JLabel();
    iconLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    choicePanel.add(iconLabel, BorderLayout.EAST);

    panel.add(choicePanel, BorderLayout.WEST);
    panel.add(description, BorderLayout.CENTER);

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    panel.revalidate();
    panel.repaint();
}

From source file:org.ecoinformatics.seek.ecogrid.RegistrySearchDialog.java

/**
 * Construct of this dialog/*from   w w  w  . ja v  a  2s .c o  m*/
 * 
 * @param parent
 *            Frame
 * @param title
 *            String
 */
public RegistrySearchDialog(EcogridPreferencesTab parent, String title, Vector originalServiceList) {
    this.parent = parent;
    this.originalServiceList = originalServiceList;
    this.setLocation(parent.getLocation());
    setSize(new Dimension(WIDTH, HEIGHT));
    initMainPanel();
    getContentPane().add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.NORTH);
    getContentPane().add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.EAST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.SOUTH);
    getContentPane().add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.WEST);
    setVisible(true);
}

From source file:org.kuali.test.ui.utils.UIUtils.java

/**
 *
 * @param labels/*  ww  w  .  ja v a 2s .  c o m*/
 * @param components
 * @return
 */
public static JPanel buildEntryPanel(String[] labels, JComponent[] components) {
    JPanel retval = new JPanel(new FlowLayout(FlowLayout.CENTER));

    JPanel entryPanel = new JPanel(new BorderLayout());
    entryPanel.add(buildComponentGridPanel(components), BorderLayout.CENTER);
    entryPanel.add(buildLabelGridPanel(labels), BorderLayout.WEST);
    retval.add(entryPanel);

    return retval;
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java

private JPanel getJPanelOptionWrapper() {
    if (jPanelOptionWrapper == null) {
        jPanelOptionWrapper = new JPanel();
        jPanelOptionWrapper.setLayout(new BorderLayout());
        jPanelOptionWrapper.add(getJPanelSelectedProjectLabel(), BorderLayout.NORTH);
        jPanelOptionWrapper.add(getJPanelOptions(), BorderLayout.WEST);
    }/*  w  ww  .j  a va  2 s  .co m*/
    return jPanelOptionWrapper;
}

From source file:Main.java

public CheckBoxNodeEditor() {
    super();//from   w w w  . jav  a2  s  .c  o m
    check.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            stopCellEditing();
        }
    });
    p.setFocusable(false);
    p.setRequestFocusEnabled(false);
    p.setOpaque(false);
    p.add(check, BorderLayout.WEST);
    check.setOpaque(false);
}

From source file:org.apache.commons.jelly.demos.HomepageBuilder.java

public HomepageBuilder() {

    System.out.println("Starting Homepage Builder");

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

    leftPanel.add(new JLabel("Name:"));

    nameField = new JTextField("James Bond");
    leftPanel.add(nameField);//from   w  w w.java  2s  . c  o  m

    leftPanel.add(new JLabel("Favorite Color:"));

    colorField = new JTextField("#007007");
    leftPanel.add(colorField);

    leftPanel.add(new JLabel("Picture URL:"));

    urlField = new JTextField("http://www.ianfleming.org/007news/images3/c2002_pierce1.jpg");
    leftPanel.add(urlField);

    leftPanel.add(new JLabel("Choose template:"));

    templateList = new JComboBox(new String[] { "template1.jelly", "template2.jelly" });
    leftPanel.add(templateList);

    //        JPanel rightPanel = new JPanel();
    //        rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));

    leftPanel.add(new JLabel("Add a Hobby:"));

    addField = new JTextField();
    leftPanel.add(addField);

    JButton addButton = new JButton("Add >>>");
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            listModel.addElement(addField.getText());
        }
    });
    leftPanel.add(addButton);

    listModel = new DefaultListModel();
    listModel.addElement("Killing bad guys");
    listModel.addElement("Wrecking cars");
    listModel.addElement("Eating jelly");
    interestList = new JList(listModel);

    JButton submit = new JButton("Build and preview your page!");
    submit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            buildPage(templateList.getSelectedItem().toString(), new JellyContext());
            showPage();
        }
    });

    // Layout the demo
    setLayout(new BorderLayout());
    add(submit, BorderLayout.SOUTH);
    add(leftPanel, BorderLayout.WEST);
    add(new JScrollPane(interestList), BorderLayout.EAST);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:edu.ku.brc.ui.ProgressFrame.java

/**
 * @param title//ww w  .  j  av a  2 s .  co m
 * @param iconName
 */
protected void createUI(final String title, final String iconName) {
    PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,5px,p,5px,p,10px,p"));
    CellConstraints cc = new CellConstraints();

    overallProgress = new JProgressBar();
    processProgress = new JProgressBar();
    desc = createLabel("");
    closeBtn = createButton("Cancel");

    processProgress.setStringPainted(true);
    overallProgress.setStringPainted(true);

    desc.setHorizontalAlignment(SwingConstants.CENTER);
    builder.add(desc, cc.xywh(1, 1, 3, 1));

    builder.add(createLabel("Process:"), cc.xy(1, 3)); // I18N
    builder.add(processProgress, cc.xy(3, 3));

    builder.add(overallLbl = createLabel("Overall:"), cc.xy(1, 5)); // I18N
    builder.add(overallProgress, cc.xy(3, 5));

    builder.add(closeBtn, cc.xy(1, 7));

    builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel mainPanel = new JPanel(new BorderLayout());
    if (StringUtils.isNotEmpty(iconName)) {
        PanelBuilder iconBldr = new PanelBuilder(
                new FormLayout("8px, f:p:g,130px,f:p:g", "8px,f:p:g,130px,f:p:g, 8px"));
        iconBldr.add(new JLabel(IconManager.getIcon(iconName)), cc.xy(3, 3));
        mainPanel.add(iconBldr.getPanel(), BorderLayout.WEST);
        mainPanel.add(builder.getPanel(), BorderLayout.CENTER);

    } else {
        mainPanel = builder.getPanel();
    }

    setContentPane(mainPanel);

    setSize(new Dimension(500, 125));

    setTitle(title);

    overallProgress.setIndeterminate(true);

    instance = this;
    closeBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            instance.setVisible(false);
            System.exit(0);
        }
    });

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    ImageIcon appIcon = IconManager.getIcon("AppIcon"); //$NON-NLS-1$
    if (appIcon != null) {
        setIconImage(appIcon.getImage());
    }

    pack();
}

From source file:es.emergya.ui.base.Message.java

private void inicializar(final String texto) {
    log.trace("inicializar(" + texto + ")");
    final Message message_ = this;

    SwingUtilities.invokeLater(new Runnable() {

        @Override/*from www .j av a 2 s. co m*/
        public void run() {
            log.trace("Sacamos un nuevo mensaje: " + texto);
            JDialog frame = new JDialog(window.getFrame(), true);
            frame.setUndecorated(true);
            frame.getContentPane().setBackground(Color.WHITE);
            frame.setLocation(150, window.getHeight() - 140);
            frame.setSize(new Dimension(window.getWidth() - 160, 130));
            frame.setName("Incoming Message");
            frame.setBackground(Color.WHITE);
            frame.getRootPane().setBorder(new MatteBorder(4, 4, 4, 4, color));

            frame.setLayout(new BorderLayout());
            if (font != null)
                frame.setFont(font);

            JLabel icon = new JLabel(new ImageIcon(this.getClass().getResource("/images/button-ok.png")));
            icon.setToolTipText("Cerrar");

            icon.removeMouseListener(null);
            icon.addMouseListener(new Cerrar(frame, message_));

            JLabel text = new JLabel(texto);
            text.setBackground(Color.WHITE);
            text.setForeground(Color.BLACK);
            frame.add(text, BorderLayout.WEST);
            frame.add(icon, BorderLayout.EAST);

            frame.setVisible(true);
        }
    });
}