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:se.cambio.cds.gdl.editor.view.panels.TerminologyPanel.java

public void refresh() {
    getMainPanel().removeAll();// w  ww.  j  a  va 2  s .c o  m
    terminologyScrollPanel = null;
    terminologyTable = null;
    _context = JXPathContext.newContext(_controller.getCurrentTermsMap());
    getMainPanel().add(getTerminologyScrollPanel(), BorderLayout.CENTER);
    getMainPanel().add(getAddDeleteButtonPanel(), BorderLayout.WEST);
    TerminologyTableModel ttm = getTerminologyTable().getTerminologyTableModel();
    Map<String, Term> termMap = _controller.getCurrentTermsMap();
    List<String> gtCodes = new ArrayList<String>(termMap.keySet());
    Collections.sort(gtCodes);
    for (String gtCode : gtCodes) {
        Term term = termMap.get(gtCode);
        Vector<String> v = new Vector<String>();
        v.add(term.getId());
        v.add(term.getText());
        v.add(term.getDescription());
        ttm.addRow(v);
    }
    getMainPanel().revalidate();
    getMainPanel().repaint();
}

From source file:com.googlecode.vfsjfilechooser2.demo.Main.java

/**
 * Setup the GUI components/*w  w  w  .ja v  a  2  s.  c  o  m*/
 */
private void createGUI() {
    fileChooser = new VFSJFileChooser(); // create a file dialog

    // configure the file dialog
    fileChooser.setAccessory(new DefaultAccessoriesPanel(fileChooser));
    fileChooser.setFileHidingEnabled(false);
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setFileSelectionMode(SELECTION_MODE.FILES_ONLY);

    // create the filename textbox
    filenameTextField = new JTextField(40);

    // lookup the localized string for the open button
    buttonText = VFSResources.getMessage("VFSJFileChooser.directoryOpenButtonText");

    // the open button
    openButton = new JButton(new OpenAction(buttonText));

    // add the components to the frame
    getContentPane().add(openButton, BorderLayout.WEST);
    getContentPane().add(filenameTextField, BorderLayout.CENTER);

    // setup the components
    pack();
}

From source file:org.nebulaframework.ui.swing.AboutDialog.java

/**
 * No-args Constructor constructs and displays 
 * the about dialog as a modal dialog of the
 * specified owner frame./*from  w w  w.  ja  v  a 2s  .co  m*/
 * 
 * @param owner Owner frame
 */
public AboutDialog(Frame owner) {
    super(owner, true);

    setTitle("About Nebula Framework " + Grid.VERSION);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setSize(320, 500);
    this.setLayout(new BorderLayout());

    this.setLocationRelativeTo(this); // Center on Main UI

    /* -- Logo Image Section -- */
    JLabel lbl = new JLabel(
            new ImageIcon(ClassLoader.getSystemResource("META-INF/resources/nebula-about.png")));
    this.add(lbl, BorderLayout.CENTER);

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

    this.add(southPanel, BorderLayout.SOUTH);

    /* -- Information Section -- */
    JPanel information = new JPanel();
    information.setBorder(BorderFactory.createTitledBorder("Information"));
    information.setLayout(new BorderLayout());

    JPanel westPanel = new JPanel();
    westPanel.setLayout(new BoxLayout(westPanel, BoxLayout.Y_AXIS));
    information.add(westPanel, BorderLayout.WEST);

    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
    information.add(centerPanel, BorderLayout.CENTER);

    westPanel.add(new JLabel("Version : "));
    centerPanel.add(new JLabel(Grid.VERSION));

    westPanel.add(new JLabel("Project Site :   "));
    final String site_link = "http://code.google.com/p/nebulaframework";
    JLabel siteLabel = new JLabel(
            "<html><body><a href=\"" + site_link + "\">" + site_link + "</a></body></html>");
    centerPanel.add(siteLabel);
    siteLabel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            try {
                Browser.displayURL(site_link);
            } catch (IOException e) {
                log.warn("[UI] Unable to invoke Browser", e);
            }
        }
    });

    westPanel.add(new JLabel("Project Blog :   "));
    final String blog_link = "http://nebulaframework.blogspot.com";
    JLabel blogLabel = new JLabel(
            "<html><body><a href=\"" + blog_link + "\">" + blog_link + "</a></body></html>");
    centerPanel.add(blogLabel);
    blogLabel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            try {
                Browser.displayURL(blog_link);
            } catch (IOException e) {
                log.warn("[UI] Unable to invoke Browser", e);
            }
        }

    });

    westPanel.add(new JLabel("License : "));
    centerPanel.add(new JLabel("Apache 2.0 License"));

    southPanel.add(information);

    /* -- Copyright Section -- */

    JPanel developedBy = new JPanel();
    developedBy.setBorder(BorderFactory.createTitledBorder("Developer / Copyright"));
    developedBy.setLayout(new BorderLayout());
    developedBy.add(new JLabel("Copyright (C) 2008 Yohan Liyanage", JLabel.CENTER), BorderLayout.CENTER);
    southPanel.add(developedBy);

    // Resize to fit to size
    this.pack();
    this.setResizable(false);

    // Initialize Browser
    Browser.init();

    // Show 
    this.setVisible(true);
}

From source file:tarea1.histogram.java

private void display() {
    JFrame f = new JFrame("Histogram");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(createChartPanel());//  ww  w.j ava  2s  .com
    f.add(new JLabel(new ImageIcon(image)), BorderLayout.WEST);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:org.anarres.filechooser.impl.vfs2.demo.Main.java

/**
 * Setup the GUI components/*from  w  w  w. j av  a2  s.co m*/
 */
private void createGUI() throws Exception {
    fileChooser = new CommonsVfs2JFileChooser(); // create a file dialog

    // configure the file dialog
    fileChooser.setAccessory(new DefaultAccessoriesPanel(fileChooser));
    fileChooser.setFileHidingEnabled(false);
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setFileSelectionMode(SELECTION_MODE.FILES_ONLY);

    // create the filename textbox
    filenameTextField = new JTextField(40);

    // lookup the localized string for the open button
    buttonText = VFSResources.getMessage("VFSJFileChooser.directoryOpenButtonText");

    // the open button
    openButton = new JButton(new OpenAction(buttonText));

    // add the components to the frame
    getContentPane().add(openButton, BorderLayout.WEST);
    getContentPane().add(filenameTextField, BorderLayout.CENTER);

    // setup the components
    pack();
}

From source file:dnd.ChooseDropActionDemo.java

public ChooseDropActionDemo() {
    super("ChooseDropActionDemo");

    for (int i = 15; i >= 0; i--) {
        from.add(0, "Source item " + i);
    }//from  www .j a v  a 2  s . c  om

    for (int i = 2; i >= 0; i--) {
        copy.add(0, "Target item " + i);
        move.add(0, "Target item " + i);
    }

    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    dragFrom = new JList(from);
    dragFrom.setTransferHandler(new FromTransferHandler());
    dragFrom.setPrototypeCellValue("List Item WWWWWW");
    dragFrom.setDragEnabled(true);
    dragFrom.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JLabel label = new JLabel("Drag from here:");
    label.setAlignmentX(0f);
    p.add(label);
    JScrollPane sp = new JScrollPane(dragFrom);
    sp.setAlignmentX(0f);
    p.add(sp);
    add(p, BorderLayout.WEST);

    JList moveTo = new JList(move);
    moveTo.setTransferHandler(new ToTransferHandler(TransferHandler.COPY));
    moveTo.setDropMode(DropMode.INSERT);
    JList copyTo = new JList(copy);
    copyTo.setTransferHandler(new ToTransferHandler(TransferHandler.MOVE));
    copyTo.setDropMode(DropMode.INSERT);

    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    label = new JLabel("Drop to COPY to here:");
    label.setAlignmentX(0f);
    p.add(label);
    sp = new JScrollPane(moveTo);
    sp.setAlignmentX(0f);
    p.add(sp);
    label = new JLabel("Drop to MOVE to here:");
    label.setAlignmentX(0f);
    p.add(label);
    sp = new JScrollPane(copyTo);
    sp.setAlignmentX(0f);
    p.add(sp);
    p.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
    add(p, BorderLayout.CENTER);

    ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    getContentPane().setPreferredSize(new Dimension(320, 315));
}

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

private void init() {
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createTitledBorder(_title));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    JButton addButton = new JButton(GDLEditorImageUtil.ADD_ICON);
    addButton.setContentAreaFilled(false);
    addButton.setPreferredSize(new Dimension(16, 16));
    addButton.setBorderPainted(false);//from  w w w .ja  v  a 2s.  co m
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String value = JOptionPane.showInputDialog(EditorManager.getActiveEditorWindow(), _title, "");
            if (value != null) {
                DefaultListModel dlm = ((DefaultListModel) getJList().getModel());
                dlm.addElement(value);
                updateListModel(dlm);
            }
        }
    });
    JButton deleteButton = new JButton(GDLEditorImageUtil.DELETE_ICON);
    deleteButton.setContentAreaFilled(false);
    deleteButton.setPreferredSize(new Dimension(16, 16));
    deleteButton.setBorderPainted(false);
    deleteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int index = getJList().getSelectedIndex();
            if (index >= 0) {
                DefaultListModel dlm = ((DefaultListModel) getJList().getModel());
                dlm.removeElementAt(index);
                updateListModel(dlm);
            }
        }
    });
    buttonPanel.add(addButton);
    buttonPanel.add(deleteButton);
    this.add(buttonPanel, BorderLayout.WEST);
    this.add(getJList(), BorderLayout.CENTER);
}

From source file:burlov.ultracipher.swing.MainPanel.java

public MainPanel(Translator translator) {
    editDataPanel = new EditDataPanel(translator);
    translator.addToComponent(searchField);
    listPopup.add(getNewEntryAction());/*www  .  ja v  a  2  s  .  c o m*/
    listPopup.add(getDeleteEntryAction());

    setLayout(new BorderLayout());
    add(splitPane);

    /*
       * Suchpanel initialisieren
     */
    JPanel panel = new JPanel(new BorderLayout());
    JPanel searchPanel = new JPanel(new BorderLayout());
    searchPanel.add(new JLabel(new ImageIcon(getClass().getResource("find.png"))), BorderLayout.WEST);
    searchPanel.add(searchField, BorderLayout.CENTER);
    searchField.setToolTipText("Search");
    panel.add(searchPanel, BorderLayout.NORTH);
    panel.add(new JScrollPane(searchResults), BorderLayout.CENTER);
    splitPane.setLeftComponent(panel);

    /*
       * Anzeigepanel initialisieren
     */
    panel = new JPanel(new BorderLayout());
    panel.add(editDataPanel, BorderLayout.CENTER);
    panel.add(new PassGeneratorPanel(), BorderLayout.SOUTH);
    splitPane.setRightComponent(panel);

    searchResults.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            showDeletePopup(e);
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            showDeletePopup(e);
        }

        private void showDeletePopup(MouseEvent e) {
            if (!e.isPopupTrigger()) {
                return;
            }
            int index = searchResults.locationToIndex(e.getPoint());
            if (index > -1) {
                searchResults.setSelectedIndex(index);
            }
            listPopup.show(e.getComponent(), e.getX(), e.getY());
        }
    });
    searchResults.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            editDataPanel.editData((DataEntry) searchResults.getSelectedValue(), false);
        }
    });
    searchField.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            initResultList();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            initResultList();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            initResultList();
        }
    });

    editDataPanel.addNameChangeListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            int index = searchResultModel.indexOf(editDataPanel.getData());
            if (index >= 0) {
                searchResultModel.set(index, editDataPanel.getData());
            }
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            int index = searchResultModel.indexOf(editDataPanel.getData());
            if (index >= 0) {
                searchResultModel.set(index, editDataPanel.getData());
            }
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            int index = searchResultModel.indexOf(editDataPanel.getData());
            if (index >= 0) {
                searchResultModel.set(index, editDataPanel.getData());
            }
        }
    });
    searchField.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                showTextPopup(e);
            } else {
                //               searchField.selectAll();
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            showTextPopup(e);
        }
    });
    //      searchField.addFocusListener(new FocusListener() {
    //         @Override
    //         public void focusLost(FocusEvent e) {
    //            System.out.println("MainPanel.MainPanel().new FocusListener() {...}.focusLost()");
    //         }
    //         
    //         @Override
    //         public void focusGained(FocusEvent e) {
    //            System.out.println("MainPanel.MainPanel().new FocusListener() {...}.focusGained()");
    //            //searchField.selectAll();
    //         }
    //      });
}

From source file:QandE.SwingApp2.java

void createGUI(JFrame f) {
    startButton = new JButton("Start");
    stopButton = new JButton("Stop");
    stopButton.setEnabled(false);//from  w ww. j av a  2 s.  co  m
    label = new JLabel("Press Start.", JLabel.CENTER);

    Container c = f.getContentPane();
    //Use the content pane's default BorderLayout layout manager.
    c.add(startButton, BorderLayout.WEST);
    c.add(stopButton, BorderLayout.EAST);
    c.add(label, BorderLayout.SOUTH);
}

From source file:ua.utility.fkindexgenerator.UIUtils.java

/**
 *
 * @param labels/*from   w w w .ja  va  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(2, 1));
    entryPanel.add(buildLabelGridPanel(labels), BorderLayout.WEST);
    entryPanel.add(buildComponentGridPanel(components), BorderLayout.CENTER);

    retval.add(entryPanel);

    return retval;
}