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.en.tealEye.guiMain.MainAppFrame.java

protected JFrame buildApplicationFrame() {
    jFrame.setTitle(Application.APPLICATION_NAME + " " + Application.APPLICATION_VERSION);
    jFrame.setLayout(new BorderLayout());
    jFrame.setSize(1024, 768);/*from  w w  w  .j  av a2s  . c  o  m*/
    jFrame.getContentPane().add(constructDesktopEnvironment(), BorderLayout.CENTER);
    jFrame.getContentPane().add(constructMainMenu(), BorderLayout.NORTH);
    jFrame.getContentPane().add(constructFloatingMenuEnvironment(), BorderLayout.WEST);
    jFrame.getContentPane().add(constructTaskbarEnvironment(), BorderLayout.SOUTH);
    desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
    jFrame.addWindowListener(windowController);
    jFrame.addKeyListener(new MainController(h));
    jFrame.setVisible(true);
    jFrame.validate();
    jFrame.requestFocus();
    return jFrame;
}

From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java

public SettingsPanel(final Project prj, Color bgColor) {
    this.prj = prj;
    this.projectConf = prj.getComponent(AliProjectConfiguration.class);

    previewAndConnection = new JPanel(new GridBagLayout());
    previewAndConnection.setOpaque(false);
    GridBagConstraints c2 = new GridBagConstraints();
    c2.gridx = 0;//  w  w  w.j ava 2  s  .co  m
    c2.gridy = 1;
    c2.gridwidth = 2;
    c2.weighty = 1;
    c2.fill = GridBagConstraints.VERTICAL;
    JPanel filler = new JPanel();
    filler.setOpaque(false);
    previewAndConnection.add(filler, c2);

    passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    passwordPanel.setBackground(bgColor);
    JLabel label = new JLabel("Password");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    passwordPanel.add(label);
    final JPasswordField password = new JPasswordField(24);
    passwordPanel.add(password);
    JButton connect = new JButton("Login");
    passwordPanel.add(connect);
    final JLabel message = new JLabel();
    passwordPanel.add(message);
    ActionListener connectionAction = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(),
                        projectConf.getUsername(), password.getText());
            } catch (AuthenticationFailed e) {
                message.setText(e.getMessage());
                return;
            }
            projectConf.ALM_PASSWORD = password.getText();
            projectConf.fireChanged();
        }
    };
    password.addActionListener(connectionAction);
    connect.addActionListener(connectionAction);

    restService = prj.getComponent(RestService.class);
    restService.addServerTypeListener(this);

    location = createTextPane(bgColor);
    domain = createTextPane(bgColor);
    project = createTextPane(bgColor);
    username = createTextPane(bgColor);

    final JPanel panel = new JPanel(new BorderLayout());
    panel.setBackground(bgColor);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    final JTextPane textPane = new JTextPane();
    textPane.setEditorKit(new HTMLEditorKit());
    textPane.setText(
            "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>");
    textPane.setEditable(false);
    textPane.addHyperlinkListener(this);
    textPane.setBackground(bgColor);
    textPane.setCaret(new NonAdjustingCaret());
    panel.add(textPane, BorderLayout.CENTER);

    JPanel content = new JPanel(new BorderLayout());
    content.setBackground(bgColor);
    content.add(panel, BorderLayout.NORTH);
    content.add(previewAndConnection, BorderLayout.WEST);

    preview = new JPanel(new GridBagLayout()) {
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            // make enough room for the connection status message
            dim.width = Math.max(dim.width, 300);
            return dim;
        }

        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
    };
    connectedTo(restService.getServerTypeIfAvailable());
    preview.setBackground(bgColor);

    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.WEST;
    preview.add(location, c);
    c.gridwidth = 1;
    c.gridy++;
    preview.add(domain, c);
    c.gridy++;
    preview.add(project, c);
    c.gridy++;
    preview.add(username, c);
    c.gridx++;
    c.gridy--;
    c.gridheight = 2;
    c.weightx = 0;
    c.anchor = GridBagConstraints.SOUTHEAST;
    final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png"));
    reload.setListener(new LinkListener() {
        public void linkSelected(LinkLabel linkLabel, Object o) {
            projectConf.fireChanged();
        }
    }, null);
    preview.add(reload, c);

    JPanel previewNorth = new JPanel(new BorderLayout());
    previewNorth.setBackground(bgColor);
    previewNorth.add(preview, BorderLayout.NORTH);

    addToGridBagPanel(0, 0, previewAndConnection, previewNorth);

    setBackground(bgColor);
    setLayout(new BorderLayout());
    add(content, BorderLayout.CENTER);

    onChanged();
    ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this);
    projectConf.addListener(this);
}

From source file:net.pandoragames.far.ui.swing.FileListPanel.java

private void init(SwingConfig config, ComponentRepository componentRepository) {

    this.setLayout(new BorderLayout());

    this.setBorder(
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));

    tableModel = componentRepository.getTableModel();
    componentRepository.getResetDispatcher().addResetable(tableModel);
    componentRepository.getSearchBaseListener().addResetable(tableModel);
    componentRepository.getUndoListener().setTableModel(tableModel);

    JTable fileListTable = componentRepository.getFileSetTable();
    int totalWidth = fileListTable.getPreferredSize().width;
    fileListTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    fileListTable.setColumnSelectionAllowed(true);
    fileListTable.getTableHeader().addMouseListener(new TableHeaderMouseListener());
    fileListTable.getTableHeader().getColumnModel().getColumn(0)
            .setHeaderRenderer(new TableHeaderCheckBoxColumnRenderer());
    fileListPopupMenu = new FileListPopupMenu(fileListTable, tableModel, componentRepository, config);
    fileListTable.setComponentPopupMenu(fileListPopupMenu);
    fileListTable.addMouseListener(new FileViewOpener(fileListTable, componentRepository.getRootWindow(),
            config, componentRepository));
    fileListTable.getColumnModel().getColumn(0).setPreferredWidth(20);
    fileListTable.getColumnModel().getColumn(0).setMaxWidth(20);
    fileListTable.getColumnModel().getColumn(1).setCellRenderer(new TargetFileListTableCellRenderer());
    fileListTable.getColumnModel().getColumn(1).setPreferredWidth(2 * totalWidth / 5);
    fileListTable.getColumnModel().getColumn(2).setCellRenderer(new PathColumnRenderer());
    fileListTable.getColumnModel().getColumn(3).setCellRenderer(new InfoColumnRenderer(config));
    JScrollPane scrollPane = new JScrollPane(fileListTable);
    this.add(scrollPane, BorderLayout.CENTER);

    SelectCounter fileCounter = new SelectCounter();
    fileCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    fileCounter.setForeground(Color.GRAY);
    ErrorCounter errorCounter = new ErrorCounter();
    errorCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    JPanel counterLine = new JPanel();
    counterLine.setLayout(new BorderLayout());
    counterLine.add(fileCounter, BorderLayout.WEST);
    counterLine.add(errorCounter, BorderLayout.EAST);

    JProgressBar progressBar = new JProgressBar();
    progressBar.setEnabled(false);//from  www.  j  a va2 s . co  m
    progressBar.setMaximumSize(new Dimension(100, 20));
    progressBar.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    componentRepository.getProgressBarUpdater().setProgressBar(progressBar);
    JPanel progressBarPanel = new JPanel();
    progressBarPanel.add(progressBar);
    counterLine.add(progressBarPanel, BorderLayout.CENTER);

    counterLine.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    this.add(counterLine, BorderLayout.SOUTH);

    tableModel.addTableModelListener(new ColumnCountListener(fileCounter));
    tableModel.addTableModelListener(errorCounter);
    componentRepository.getResetDispatcher().addResetable(fileCounter);
    componentRepository.getSearchBaseListener().addResetable(fileCounter);
    componentRepository.getOperationCallBackListener().addComponentStartReseted(fileCounter,
            OperationType.FIND);
    componentRepository.getResetDispatcher().addResetable(errorCounter);
    componentRepository.getSearchBaseListener().addResetable(errorCounter);

    viewAction = new ActionView(componentRepository, config);
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java

private void init() {
    this.setMinimumSize(new Dimension(200, 100));
    this.setLayout(new BorderLayout());

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);
    panel.setLayout(new BorderLayout());

    panel.add(createControls(), BorderLayout.WEST);
    panel.add(createGraphicPanel(), BorderLayout.CENTER);
    JScrollPane scroll = new JScrollPane(panel);
    scroll.getVerticalScrollBar().setUnitIncrement(UIAgent.VERTICAL_UNIT_SCROLL);
    this.add(scroll);
}

From source file:gdt.jgui.console.JItemPanel.java

/**
 * Create the item panel./*  w ww. ja v  a 2s  . c  o m*/
 * @param console the main console.
 * @param locator$ the item's locator.
 * @return the item panel.
 */
public JItemPanel instantiate(JMainConsole console, String locator$) {
    try {
        this.console = console;
        this.locator$ = locator$;
        this.removeAll();
        Properties locator = Locator.toProperties(locator$);
        if (Locator.LOCATOR_TRUE.equals(locator.getProperty(Locator.LOCATOR_CHECKABLE))) {
            checkbox = new JCheckBox();
            add(checkbox);
            if (Locator.LOCATOR_TRUE.equals(locator.getProperty(Locator.LOCATOR_CHECKED)))
                if (checkbox != null)
                    checkbox.setSelected(true);
        }
        title = new JLabel(title$, JLabel.LEFT);
        //title.setIcon(null);
        title$ = locator.getProperty(Locator.LOCATOR_TITLE);
        if (title$ != null) {
            title.setText(title$);
            title.setOpaque(true);
            title.addMouseListener(new MousePopupListener());
            title.setAlignmentX(Component.LEFT_ALIGNMENT);
            add(title, BorderLayout.WEST);
            icon$ = locator.getProperty(Locator.LOCATOR_ICON);

            if (icon$ != null) {
                byte[] ba = Base64.decodeBase64(icon$);
                ImageIcon icon = new ImageIcon(ba);
                Image image = icon.getImage().getScaledInstance(24, 24, 0);
                icon.setImage(image);
                title.setIcon(icon);
            }
        } else
            LOGGER.info("title is null");
    } catch (Exception e) {
        LOGGER.severe(e.toString());
    }
    return this;
}

From source file:com.compomics.pladipus.controller.setup.InstallPladipus.java

/**
 * Queries the user for the valid user login and password
 *
 * @throws IOException/*  w  ww  .j a  va  2  s .co m*/
 */
public boolean validateUser() throws IOException {

    JPanel panel = new JPanel(new BorderLayout(5, 5));

    JPanel label = new JPanel(new GridLayout(0, 1, 2, 2));
    label.add(new JLabel("Username", SwingConstants.RIGHT));
    label.add(new JLabel("Password", SwingConstants.RIGHT));
    panel.add(label, BorderLayout.WEST);

    JPanel controls = new JPanel(new GridLayout(0, 1, 2, 2));
    JTextField username = new JTextField();
    controls.add(username);
    JPasswordField password = new JPasswordField();
    controls.add(password);

    panel.add(controls, BorderLayout.CENTER);

    int showConfirmDialog = JOptionPane.showConfirmDialog(null, panel, "Pladipus Login",
            JOptionPane.OK_CANCEL_OPTION);

    if (showConfirmDialog == JOptionPane.CANCEL_OPTION) {
        return false;
    }

    String user = username.getText();
    String pass = new String(password.getPassword());

    if (login(user, pass)) {
        writeWorkerBash(user, pass);
        return true;
    } else {
        throw new SecurityException("User credentials are incorrect!");
    }
}

From source file:org.zaproxy.zap.extension.httppanel.HttpPanel.java

private void initUi() {

    allOptions = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));

    componentOptions = new JPanel(new BorderLayout(0, 0));
    moreOptionsComponent = new JPanel(new BorderLayout(0, 0));

    toolBarComponents = new JToolBar();
    toolBarComponents.setFloatable(false);
    toolBarComponents.setBorder(BorderFactory.createEmptyBorder());
    toolBarComponents.setRollover(true);

    toolBarMoreOptions = new JToolBar();
    toolBarMoreOptions.setFloatable(false);
    toolBarMoreOptions.setBorder(BorderFactory.createEmptyBorder());
    toolBarMoreOptions.setRollover(true);

    endAllOptions = new JPanel();

    JPanel panel1 = new JPanel(new BorderLayout(0, 0));

    JPanel panelFlow = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));

    panelFlow.add(allOptions);//ww  w  .  j av a  2  s  .c o m
    panelFlow.add(componentOptions);
    panelFlow.add(toolBarComponents);
    panelFlow.add(moreOptionsComponent);
    panelFlow.add(toolBarMoreOptions);
    panel1.add(panelFlow, BorderLayout.WEST);

    panelFlow = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    panelFlow.add(endAllOptions);

    panel1.add(panelFlow, BorderLayout.EAST);

    panelHeader.add(panel1, BorderLayout.NORTH);

    //getPanelContent().add(new EmptyComponent(), "");

    initComponents();

    setMessage(null);
}

From source file:edu.clemson.cs.nestbed.client.gui.MessageMonitorFrame.java

private JPanel buildMessageDataPanel() {
    Class msgClass = messageSymbol.getMessageClass();
    List<Method> methodList = getPropertyMethodList(msgClass);

    JPanel panel = new JPanel();
    panel.setBorder(new TitledBorder("Message Data"));
    panel.setLayout(new BorderLayout());

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BorderLayout());

    innerPanel.add(buildLabelPanel(methodList), BorderLayout.WEST);
    innerPanel.add(buildFieldPanel(methodList), BorderLayout.CENTER);

    panel.add(innerPanel, BorderLayout.CENTER);

    return panel;
}

From source file:marytts.tools.voiceimport.DatabaseImportMain.java

protected void setupGUI() {
    // A scroll pane containing one labelled checkbox per component,
    // and a "run selected components" button below.
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridC = new GridBagConstraints();
    getContentPane().setLayout(gridBagLayout);

    JPanel checkboxPane = new JPanel();
    checkboxPane.setLayout(new BoxLayout(checkboxPane, BoxLayout.Y_AXIS));
    //checkboxPane.setPreferredSize(new Dimension(300, 300));
    int compIndex = 0;
    for (int j = 0; j < groups2Comps.length; j++) {
        String[] nextGroup = groups2Comps[j];
        JPanel groupPane = new JPanel();
        groupPane.setLayout(new BoxLayout(groupPane, BoxLayout.Y_AXIS));
        groupPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(nextGroup[0]),
                BorderFactory.createEmptyBorder(1, 1, 1, 1)));
        for (int i = 1; i < nextGroup.length; i++) {
            JButton configButton = new JButton();
            Icon configIcon = new ImageIcon(DatabaseImportMain.class.getResource("configure.png"), "Configure");
            configButton.setIcon(configIcon);
            configButton.setPreferredSize(new Dimension(configIcon.getIconWidth(), configIcon.getIconHeight()));
            configButton.addActionListener(new ConfigButtonActionListener(nextGroup[i]));
            configButton.setBorderPainted(false);
            //System.out.println("Adding checkbox for "+components[i].getClass().getName());
            checkboxes[compIndex] = new JCheckBox(nextGroup[i]);
            checkboxes[compIndex].setFocusable(true);
            //checkboxes[i].setPreferredSize(new Dimension(200, 30));
            JPanel line = new JPanel();
            line.setLayout(new BorderLayout(5, 0));
            line.add(configButton, BorderLayout.WEST);
            line.add(checkboxes[compIndex], BorderLayout.CENTER);
            groupPane.add(line);/*from w w  w . j  a v a 2s. c  o m*/
            compIndex++;
        }
        checkboxPane.add(groupPane);
    }
    gridC.gridx = 0;
    gridC.gridy = 0;
    gridC.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane = new JScrollPane(checkboxPane);
    scrollPane.setPreferredSize(new Dimension(450, 300));
    gridBagLayout.setConstraints(scrollPane, gridC);
    getContentPane().add(scrollPane);

    JButton helpButton = new JButton("Help");
    helpButton.setMnemonic(KeyEvent.VK_H);
    helpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            displayHelpGUI();
        }
    });
    JButton settingsButton = new JButton("Settings");
    settingsButton.setMnemonic(KeyEvent.VK_S);
    settingsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            currentComponent = "Global properties";
            displaySettingsGUI();
        }
    });
    runButton = new JButton("Run");
    runButton.setMnemonic(KeyEvent.VK_R);
    runButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            runSelectedComponents();
        }
    });

    JButton quitAndSaveButton = new JButton("Quit");
    quitAndSaveButton.setMnemonic(KeyEvent.VK_Q);
    quitAndSaveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            try {
                askIfSave();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
            System.exit(0);
        }
    });

    gridC.gridy = 1;
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());
    //buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS));
    //runButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(runButton);
    //helpButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(helpButton);
    //settingsButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(settingsButton);
    //buttonPanel.add(Box.createHorizontalGlue());
    //quitAndSaveButton.setAlignmentX(JButton.RIGHT_ALIGNMENT);
    buttonPanel.add(quitAndSaveButton);
    gridBagLayout.setConstraints(buttonPanel, gridC);
    getContentPane().add(buttonPanel);

    //getContentPane().setPreferredSize(new Dimension(300, 300));
    // End program when closing window:
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            try {
                askIfSave();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
            System.exit(0);
        }
    });
}

From source file:edu.harvard.mcz.imagecapture.WhatsThisImageDialog.java

/**
 * This method initializes jContentPane/*from   w w w.j a  v  a2s. c  o  m*/
 * 
 * @return javax.swing.JPanel
 */
private JPanel getJContentPane() {
    if (jContentPane == null) {
        jContentPane = new JPanel();
        jContentPane.setLayout(new BorderLayout());
        jContentPane.add(getJPanel(), BorderLayout.WEST);
        jContentPane.add(getImagePanel(), BorderLayout.CENTER);
    }
    return jContentPane;
}