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:org.rdv.ui.ConsoleDialog.java

public ConsoleDialog(JDialog owner) {
    super(owner);

    setName("consoleDialog");

    setDefaultCloseOperation(AboutDialog.DISPOSE_ON_CLOSE);

    JPanel container = new JPanel();
    container.setLayout(new BorderLayout());
    container.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    setContentPane(container);//ww  w . j a v a2  s.  com

    InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = container.getActionMap();

    Action disposeAction = new AbstractAction() {
        /** serialized version identifier */
        private static final long serialVersionUID = 4380189911762232261L;

        public void actionPerformed(ActionEvent ae) {
            dispose();
        }
    };

    Action copyAction = new AbstractAction() {

        /** serialized version identifier */
        private static final long serialVersionUID = 2596081241883913660L;

        public void actionPerformed(ActionEvent e) {
            textArea.selectAll();
            textArea.copy();
        }
    };

    //    Action scrollLockAction = new AbstractAction() {
    //      /** serialized version identifier */
    //      private static final long serialVersionUID = -8089076016097529064L;
    //
    //      public void actionPerformed(ActionEvent e) {
    //        //toggle scroll lock
    //        scrollLock_=!scrollLock_;
    //      }
    //    };

    disposeAction.putValue(Action.NAME, "OK");
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "dispose");
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "dispose");
    actionMap.put("dispose", disposeAction);
    copyAction.putValue(Action.NAME, "Copy");
    actionMap.put("copy", copyAction);
    //    actionMap.put("scroll lock", scrollLockAction);
    //    scrollLockAction.putValue(Action.NAME, "Scroll Lock");

    textArea = new JTextArea();
    textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    textArea.setBackground(Color.WHITE);
    textArea.setForeground(Color.BLACK);
    textArea.setEditable(false);
    textArea.setLineWrap(false);

    Iterator<String> msgIt = messageBuffer.getMessages().iterator();

    //add all the messages in the buffer to this point
    while (msgIt.hasNext()) {
        addMessage(msgIt.next());
    }

    JScrollPane scrollPane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new Dimension(640, 480));
    container.add(scrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JButton okButton = new JButton(disposeAction);
    buttonPanel.add(okButton, BorderLayout.EAST);

    JPanel leftBtnsPanel = new JPanel();
    leftBtnsPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    buttonPanel.add(leftBtnsPanel, BorderLayout.WEST);

    JButton copyButton = new JButton(copyAction);
    leftBtnsPanel.add(copyButton);

    //    JButton scrollLockButton = new JButton(scrollLockAction);
    //    leftBtnsPanel.add(scrollLockButton);

    container.add(buttonPanel, BorderLayout.SOUTH);

    // inject resources from the properties for this component
    ResourceMap resourceMap = RDV.getInstance().getContext().getResourceMap(getClass());
    resourceMap.injectComponents(this);

    pack();
    okButton.requestFocusInWindow();
    setLocationByPlatform(true);
    setVisible(true);

    messageBuffer.addObserver(this);
}

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);//from w w  w.  j a va 2 s . co 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:net.itransformers.topologyviewer.dialogs.snmpDiscovery.DiscoveryManagerDialogV2.java

public DiscoveryManagerDialogV2(JFrame frame, File projectDir) {
    this.frame = frame;
    this.projectDir = projectDir;
    setTitle("Discovery Manager");
    setBounds(100, 100, 960, 364);/* w  w  w  .  j a  va  2 s  .co m*/
    getContentPane().setLayout(new BorderLayout());
    {

        JPanel buttonPane = new JPanel();
        getContentPane().add(buttonPane, BorderLayout.NORTH);
        {
            buttonPane.setLayout(new BorderLayout(0, 0));
            {
                JPanel panel = new JPanel();
                buttonPane.add(panel);
                panel.setLayout(null);
                {
                    depthComboBox = new JComboBox();
                    depthComboBox.setModel(
                            new DefaultComboBoxModel(new Integer[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }));
                    depthComboBox.setBounds(46, 11, 70, 20);
                    panel.add(depthComboBox);
                }

                JLabel lblMode = new JLabel("Depth:");
                lblMode.setBounds(6, 14, 46, 14);
                panel.add(lblMode);

                JLabel lblAddress = new JLabel("Address:");
                lblAddress.setBounds(172, 14, 56, 14);
                panel.add(lblAddress);

                addressTextField = new JTextField();
                addressTextField.setBounds(230, 11, 113, 20);
                panel.add(addressTextField);
                addressTextField.setColumns(10);

                JLabel lblLabel = new JLabel("Label:");
                lblLabel.setBounds(360, 14, 56, 14);
                panel.add(lblLabel);

                labelTextField = new JTextField();
                labelTextField.setBounds(400, 11, 113, 20);
                panel.add(labelTextField);
                labelTextField.setColumns(10);

                autoLabelCheckBox = new JCheckBox("auto-label");
                autoLabelCheckBox.setBounds(520, 11, 113, 20);
                autoLabelCheckBox.setSelected(true);
                panel.add(autoLabelCheckBox);
                postDiscoveryCheckBox = new JCheckBox("Post Discovery");
                postDiscoveryCheckBox.setBounds(620, 11, 153, 20);
                postDiscoveryCheckBox.setSelected(true);
                panel.add(postDiscoveryCheckBox);

            }
        }
        {
            JPanel panel = new JPanel();
            buttonPane.add(panel, BorderLayout.EAST);
            final JButton stopStartButton = new JButton("Start");
            panel.add(stopStartButton);
            stopStartButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    if ("Start".equals(stopStartButton.getText())) {
                        onStartDiscoveryPre(stopStartButton);
                        onStartDiscovery();
                        onStartDiscoveryPost(stopStartButton);
                    } else {
                        onStopDiscoveryPre(stopStartButton);
                        onStopDiscovery();
                        onStopDiscoveryPost(stopStartButton);

                    }
                }
            });
            stopStartButton.setActionCommand("Start");
            getRootPane().setDefaultButton(stopStartButton);
            {
                pauseResumeButton.setEnabled(false);
                panel.add(pauseResumeButton);
                pauseResumeButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        if ("Pause".equals(pauseResumeButton.getText())) {
                            pauseResumeButton.setEnabled(false);
                            onPauseDiscovery();
                            pauseResumeButton.setText("Resume");
                            pauseResumeButton.setEnabled(true);
                        } else {
                            pauseResumeButton.setEnabled(false);
                            onResumeDiscovery();
                            pauseResumeButton.setText("Pause");
                            pauseResumeButton.setEnabled(true);
                        }
                    }
                });
            }
        }
    }
    {
        lblDiscoveredDevices = new JTextArea();
        JScrollPane scrolltxt = new JScrollPane(lblDiscoveredDevices);
        lblDiscoveredDevices.append("Discovery process output");
        getContentPane().add(scrolltxt, BorderLayout.CENTER);
    }
    {
        JPanel statusPanel = new JPanel();
        getContentPane().add(statusPanel, BorderLayout.SOUTH);
        statusPanel.setLayout(new BorderLayout(0, 0));
        {
            JPanel panel = new JPanel();
            statusPanel.add(panel);
            panel.setLayout(new BorderLayout(0, 0));
            //panel.setSize(100:100);
            {
                loggerConsole = new JTextArea();
                JScrollPane scrolltxt = new JScrollPane(loggerConsole);
                loggerConsole.append("Discovery logger console");
                panel.add(scrolltxt, BorderLayout.CENTER);
            }
        }
    }
    {
        Logger logger = Logger.getRootLogger();
        logger.setLevel(Level.INFO);
        logger.addAppender(new AppenderSkeleton() {
            @Override
            protected void append(final LoggingEvent loggingEvent) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        loggerConsole.append(loggingEvent.getMessage().toString());
                        loggerConsole.append("\n");
                    }
                });
            }

            @Override
            public void close() {
            }

            @Override
            public boolean requiresLayout() {
                return false;
            }
        });
    }
}

From source file:org.intermine.install.swing.source.PropertyComponentCreator.java

/**
 * Creates the wrapper and components for file and directory properties.
 * This is a panel containing a text component and a button to open a file
 * browser.//from w ww. j  ava2s.c  o  m
 * 
 * @param propertyName The name of the property.
 * @param descriptor The descriptor of the property.
 * @param initialValue The initial value for the field.
 * 
 * @return The wrapper around the display components.
 */
protected static PropertyComponentWrapper createFileComponent(String propertyName,
        PropertyDescriptor descriptor, String initialValue) {

    switch (descriptor.getType()) {
    case FILE:
    case DIRECTORY:
        // ok.
        break;

    default:
        throw new IllegalArgumentException(
                "Only FILE and DIRECTORY types can be handled by createFileComponent");
    }

    File initialFile = null;
    if (initialValue != null) {
        initialFile = new File(initialValue);
    }

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

    JTextField text = new JTextField(initialValue);
    panel.add(text, BorderLayout.CENTER);
    panel.add(new JButton(new FileComponentBrowseAction(text, descriptor, initialFile)), BorderLayout.EAST);

    return new PropertyComponentWrapper(propertyName, descriptor, text, panel);
}

From source file:org.mn.z80util.testbench.MZ80TestBench.java

private void createAndShowGUI() {

    // See above/*from w  w  w  .  ja  va2 s .com*/
    if (!SwingUtilities.isEventDispatchThread()) {
        System.err.println("Attempting to construct the GUI from outside "
                + "of event dispatch thread! This is an error. Please check " + "your code modifications.");
        System.exit(1);
    }

    /* Initializes the GUI frame */
    GUI = new JFrame("Mikko's Z80 Testbench - (C) Mikko Nummelin, 2009");
    GUI.setLayout(new BorderLayout());
    GUI.setIconImage(LogoFactory.createLogo());
    GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    leftPanel = new JPanel();
    leftPanel.setLayout(new GridLayout(3, 1));

    // The first processor information
    firstProcessorPanel = new JPanel();
    firstProcessorPanel.setLayout(new GridLayout(2, 1));
    firstProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 1"));
    firstProcessorPanel.add(new JLabel(processor1.getClass().getName()));
    firstProcessorStatus = new JLabel("-");
    firstProcessorPanel.add(firstProcessorStatus);
    leftPanel.add(firstProcessorPanel);

    // The second processor information
    secondProcessorPanel = new JPanel();
    secondProcessorPanel.setLayout(new GridLayout(2, 1));
    secondProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 2"));
    secondProcessorPanel.add(new JLabel(processor2.getClass().getName()));
    secondProcessorStatus = new JLabel("-");
    secondProcessorPanel.add(secondProcessorStatus);
    leftPanel.add(secondProcessorPanel);

    // The progress bar panel
    progressBarPanel = new JPanel();
    progressBarPanel.setLayout(new GridLayout(3, 1));
    progressBarPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
    progressBar = new JProgressBar(0, 0x6bf);
    progressBarPanel.add(progressBar);
    statusMessage = new JLabel("-");
    progressBarPanel.add(statusMessage);
    executedCommand = new JLabel("-");
    progressBarPanel.add(executedCommand);
    leftPanel.add(progressBarPanel);

    GUI.add(leftPanel, BorderLayout.WEST);

    // The action button panel
    actionPanel = new JPanel();
    okCancelButton = new JButton("Cancel");
    okCancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    actionPanel.add(okCancelButton);
    GUI.add(actionPanel, BorderLayout.SOUTH);

    // The image panel
    imagePanel = new JPanel();
    java.net.URL imgURL = getClass().getResource("/Z80-pinout.png");
    img = new ImageIcon(imgURL);
    imagePanel.add(new JLabel(img));
    GUI.add(imagePanel, BorderLayout.EAST);

    GUI.pack();
    GUI.setResizable(false);
    GUI.setVisible(true);
}

From source file:press.gfw.Windows.java

private void initBorder() {

    // /*from  w  ww .  j  av a2 s  . c om*/
    add(new JLabel(), BorderLayout.EAST);

    add(new JLabel(), BorderLayout.NORTH);

    add(new JLabel(), BorderLayout.WEST);

}

From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java

public SettleTicketDialog(Ticket ticket) {
    super();//from w w w  . j  a  va 2 s  .c  o m
    this.ticket = ticket;

    if (ticket.getOrderType().isConsolidateItemsInReceipt()) {
        ticket.consolidateTicketItems();
    }

    setTitle(Messages.getString("SettleTicketDialog.6")); //$NON-NLS-1$
    getContentPane().setLayout(new BorderLayout());

    JPanel centerPanel = new JPanel(new BorderLayout(5, 5));
    centerPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 0));

    ticketViewerTable = new TicketViewerTable(ticket);
    ticketScrollPane = new PosScrollPane(ticketViewerTable);

    centerPanel.add(createTicketInfoPanel(), BorderLayout.NORTH);
    centerPanel.add(ticketScrollPane, BorderLayout.CENTER);
    centerPanel.add(createTotalViewerPanel(), BorderLayout.SOUTH);

    paymentView = new PaymentView(this);
    paymentView.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    getContentPane().add(centerPanel, BorderLayout.CENTER);
    getContentPane().add(paymentView, BorderLayout.EAST);

    paymentView.updateView();
    paymentView.setDefaultFocus();
    updateView();
}

From source file:com.floreantpos.ui.views.payment.GroupSettleTicketDialog.java

public GroupSettleTicketDialog(List<Ticket> tickets) {
    super();//from www  . ja va  2 s  .  c  o m
    this.tickets = tickets;

    for (Ticket ticket : tickets) {
        if (ticket.getOrderType().isConsolidateItemsInReceipt()) {
            ticket.consolidateTicketItems();
        }
    }

    setTitle(Messages.getString("SettleTicketDialog.6")); //$NON-NLS-1$
    getContentPane().setLayout(new BorderLayout());

    ticketDetailView = new TicketDetailView();
    ticketScrollPane = new PosScrollPane(ticketDetailView);

    JPanel centerPanel = new JPanel(new BorderLayout(5, 5));
    centerPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 0));

    centerPanel.add(createTicketInfoPanel(), BorderLayout.NORTH);
    centerPanel.add(ticketScrollPane, BorderLayout.CENTER);
    centerPanel.add(createTotalViewerPanel(), BorderLayout.SOUTH);

    paymentView = new GroupPaymentView(this);
    paymentView.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    getContentPane().add(centerPanel, BorderLayout.CENTER);
    getContentPane().add(paymentView, BorderLayout.EAST);

    setSize(Application.getPosWindow().getSize());
    updateView();
    paymentView.updateView();
    paymentView.setDefaultFocus();

}

From source file:org.springframework.richclient.application.statusbar.support.DefaultStatusBar.java

protected JComponent createControl() {
    statusBar = new JPanel(new BorderLayout());

    messageLabel = createMessageLabel();

    progressMonitor = createStatusBarProgressMonitor();

    statusBar.add(messageLabel);//from   ww w.ja  v a 2 s  .c  o m
    statusBar.add(progressMonitor.getControl(), BorderLayout.EAST);

    progressMonitor.getControl().setPreferredSize(new Dimension(200, 17));

    statusBar.setBorder(new ShadowBorder());

    return statusBar;
}

From source file:org.ut.biolab.medsavant.client.view.genetics.SpreadsheetPage.java

@Override
public JPanel getView() {
    try {//  w  ww  .  jav a2s  .  c om
        if (view == null) {

            view = new JPanel();
            view.setLayout(new BorderLayout());
            view.add(new WaitPanel("Preparing Spreadsheet..."));

            Runnable prepareViewInBackground = new Runnable() {

                @Override
                public void run() {
                    try {
                        LOG.debug("Running thread prepareViewINBackground!");
                        final JPanel tmpView = new JPanel();
                        tmpView.setLayout(new BorderLayout());

                        tablePanel = new TablePanel(pageName);
                        SplitScreenPanel ssp = new SplitScreenPanel(tablePanel);

                        inspectorPanel = new ComprehensiveInspector(true, true, true, true, true, true, true,
                                true, true, ssp);

                        inspectorPanel.addSelectionListener(new Listener<Object>() {
                            @Override
                            public void handleEvent(Object event) {
                                clearSelection();
                            }
                        });

                        TablePanel.addVariantSelectionChangedListener(new Listener<VariantRecord>() {
                            @Override
                            public void handleEvent(final VariantRecord r) {
                                inspectorPanel.setVariantRecord(r);
                            }
                        });
                        LOG.debug("Constructing detailView");

                        tmpView.add(ssp, BorderLayout.CENTER);

                        final PeekingPanelContainer ppc = new PeekingPanelContainer(tmpView);
                        detailView = ppc.addPeekingPanel("Inspector", BorderLayout.EAST, inspectorPanel, false,
                                ComprehensiveInspector.INSPECTOR_WIDTH);

                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                view.removeAll();
                                view.add(ppc, BorderLayout.CENTER);
                                view.updateUI();
                            }
                        });

                    } catch (Exception ex) {
                        LOG.error(ex);
                        System.out.println("Caught spreadsheet loading error: " + ex);
                        ex.printStackTrace();
                        view.removeAll();
                        WaitPanel p = new WaitPanel("Error loading Spreadsheet");
                        p.setComplete();
                        view.add(p);

                    }
                }
            };

            viewPreparationThread = new Thread(prepareViewInBackground);
            viewPreparationThread.start();

        }

        return view;

    } catch (Exception ex) {
        ClientMiscUtils.reportError("Error generating genome view: %s", ex);
    }
    return view;
}