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:ca.phon.app.project.ProjectWindow.java

private MultiActionButton createSessionButton() {
    MultiActionButton retVal = new MultiActionButton();

    ImageIcon newIcn = IconManager.getInstance().getIcon("mimetypes/text-xml", IconSize.SMALL);

    String s1 = "Session";
    String s2 = "Enter session name and press enter.  Press escape to cancel.";

    retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1));
    retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    retVal.getTopLabel().setFont(FontPreferences.getTitleFont());
    retVal.getTopLabel().setIcon(newIcn);
    retVal.setAlwaysDisplayActions(true);

    retVal.setOpaque(false);//www.ja  v a  2s  .co m

    ImageIcon cancelIcn = IconManager.getInstance().getIcon("actions/button_cancel", IconSize.SMALL);
    ImageIcon cancelIcnL = cancelIcn;

    PhonUIAction btnSwapAct = new PhonUIAction(this, "onSwapNewAndCreateSession", retVal);
    btnSwapAct.putValue(Action.ACTION_COMMAND_KEY, "CANCEL_CREATE_ITEM");
    btnSwapAct.putValue(Action.NAME, "Cancel create");
    btnSwapAct.putValue(Action.SHORT_DESCRIPTION, "Cancel create");
    btnSwapAct.putValue(Action.SMALL_ICON, cancelIcn);
    btnSwapAct.putValue(Action.LARGE_ICON_KEY, cancelIcnL);
    retVal.addAction(btnSwapAct);

    JPanel sessionNamePanel = new JPanel(new BorderLayout());
    sessionNamePanel.setOpaque(false);

    final JTextField sessionNameField = new JTextField();
    sessionNameField.setDocument(new NameDocument());
    sessionNameField.setText("Session Name");
    sessionNamePanel.add(sessionNameField, BorderLayout.CENTER);

    ActionMap actionMap = retVal.getActionMap();
    actionMap.put(btnSwapAct.getValue(Action.ACTION_COMMAND_KEY), btnSwapAct);
    InputMap inputMap = retVal.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);

    inputMap.put(ks, btnSwapAct.getValue(Action.ACTION_COMMAND_KEY));

    retVal.setActionMap(actionMap);
    retVal.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);

    PhonUIAction createNewSessionAct = new PhonUIAction(this, "onCreateSession", sessionNameField);
    createNewSessionAct.putValue(Action.SHORT_DESCRIPTION, "Create new session in selected corpus");
    createNewSessionAct.putValue(Action.SMALL_ICON,
            IconManager.getInstance().getIcon("actions/list-add", IconSize.SMALL));

    JButton createBtn = new JButton(createNewSessionAct);
    sessionNamePanel.add(createBtn, BorderLayout.EAST);

    sessionNameField.setAction(createNewSessionAct);

    // swap bottom component in new project button
    retVal.setBottomLabelText(WorkspaceTextStyler.toDescText(s2));
    retVal.add(sessionNamePanel, BorderLayout.CENTER);

    retVal.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {

        }

        @Override
        public void focusGained(FocusEvent e) {
            sessionNameField.requestFocus();
        }
    });

    return retVal;
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphActionsPane() {
    JPanel buttonPanel = new JPanel(new BorderLayout());
    JPanel displayPane = new JPanel();
    displayPane.add(displayButton);/*from  www  .  java2  s  . c  o m*/
    displayButton.addActionListener(this);
    buttonPanel.add(displayPane, BorderLayout.WEST);

    JPanel savePane = new JPanel();
    savePane.add(saveGraph);
    savePane.add(saveTable);
    savePane.add(saveHeaders);
    saveGraph.addActionListener(this);
    saveTable.addActionListener(this);
    syncWithName.addActionListener(this);
    buttonPanel.add(savePane, BorderLayout.EAST);

    return buttonPanel;
}

From source file:net.sourceforge.pmd.util.designer.Designer.java

private JPanel createXPathQueryPanel() {
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    xpathQueryArea.setBorder(BorderFactory.createLineBorder(Color.black));
    makeTextComponentUndoable(xpathQueryArea);
    JScrollPane scrollPane = new JScrollPane(xpathQueryArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    final JButton b = createGoButton();

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    topPanel.add(new JLabel("XPath Query (if any):"), BorderLayout.WEST);
    topPanel.add(createXPathVersionPanel(), BorderLayout.EAST);

    p.add(topPanel, BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    p.add(b, BorderLayout.SOUTH);

    return p;/* ww w. j  a va 2  s.c o m*/
}

From source file:op.controlling.PnlControlling.java

private JPanel createContentPanel4Orga() {
    JPanel pnlContent = new JPanel(new VerticalLayout());

    /***/*from ww  w  .j  av  a  2s .c o  m*/
     *      ______     ___        _   _       _ _   _
     *     | __ ) \   / / \   ___| |_(_)_   _(_) |_(_) ___  ___
     *     |  _ \\ \ / / _ \ / __| __| \ \ / / | __| |/ _ \/ __|
     *     | |_) |\ V / ___ \ (__| |_| |\ V /| | |_| |  __/\__ \
     *     |____/  \_/_/   \_\___|\__|_| \_/ |_|\__|_|\___||___/
     *
     */
    JPanel pnlBV = new JPanel(new BorderLayout());
    final JButton btnBVActivities = GUITools.createHyperlinkButton("opde.controlling.orga.bvactivities", null,
            null);
    int bvWeeksBack;
    try {
        bvWeeksBack = Integer.parseInt(OPDE.getProps().getProperty("opde.controlling::bvactivitiesWeeksBack"));
    } catch (NumberFormatException nfe) {
        bvWeeksBack = 7;
    }
    final JTextField txtBVWeeksBack = GUITools.createIntegerTextField(1, 52, bvWeeksBack);
    txtBVWeeksBack.setToolTipText(SYSTools.xx("misc.msg.weeksback"));
    btnBVActivities.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::bvactivitiesWeeksBack", txtBVWeeksBack.getText(),
                            OPDE.getLogin().getUser());
                    SYSFilesTools.print(NReportTools.getBVActivites(
                            new LocalDate().minusWeeks(Integer.parseInt(txtBVWeeksBack.getText())),
                            progressClosure), false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlBV.add(btnBVActivities, BorderLayout.WEST);
    pnlBV.add(txtBVWeeksBack, BorderLayout.EAST);
    pnlContent.add(pnlBV);

    /***
     *                                _       _       _
     *       ___ ___  _ __ ___  _ __ | | __ _(_)_ __ | |_ ___
     *      / __/ _ \| '_ ` _ \| '_ \| |/ _` | | '_ \| __/ __|
     *     | (_| (_) | | | | | | |_) | | (_| | | | | | |_\__ \
     *      \___\___/|_| |_| |_| .__/|_|\__,_|_|_| |_|\__|___/
     *                         |_|
     */
    JPanel pnlComplaints = new JPanel(new BorderLayout());
    final JButton btnComplaints = GUITools.createHyperlinkButton("opde.controlling.orga.complaints", null,
            null);
    int complaintsMonthBack;
    try {
        complaintsMonthBack = Integer
                .parseInt(OPDE.getProps().getProperty("opde.controlling::complaintsMonthBack"));
    } catch (NumberFormatException nfe) {
        complaintsMonthBack = 7;
    }
    final JTextField txtComplaintsMonthsBack = GUITools.createIntegerTextField(1, 12, complaintsMonthBack);
    txtComplaintsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback"));

    btnComplaints.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::complaintsMonthBack",
                            txtComplaintsMonthsBack.getText(), OPDE.getLogin().getUser());

                    int monthsback = Integer.parseInt(txtComplaintsMonthsBack.getText());

                    String content = QProcessTools.getComplaintsAnalysis(monthsback, progressClosure);
                    content += NReportTools.getComplaints(
                            new LocalDate().minusMonths(monthsback).dayOfMonth().withMinimumValue(),
                            progressClosure);

                    SYSFilesTools.print(content, false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlComplaints.add(btnComplaints, BorderLayout.WEST);
    pnlComplaints.add(txtComplaintsMonthsBack, BorderLayout.EAST);
    pnlContent.add(pnlComplaints);

    // ResInfoTypeTools.TYPE_NURSING_INSURANCE
    JPanel pnlInsuranceGrade = new JPanel(new BorderLayout());
    final JButton btnIG = GUITools.createHyperlinkButton("misc.msg.InsuranceGrades", null, null);

    btnIG.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    String content = SYSConst.html_h1("misc.msg.InsuranceGrades");

                    String ul = "";
                    for (Resident resident : ResidentTools.getAllActive()) {
                        if (resident.getAdminonly() == ResidentTools.NORMAL) {

                            ul += SYSConst.html_li(SYSConst.html_bold(ResidentTools.getLabelText(resident)));

                            ResInfo insurance = ResInfoTools.getLastResinfo(resident,
                                    ResInfoTypeTools.TYPE_NURSING_INSURANCE);

                            String ins = "";
                            if (insurance == null) {
                                ins = SYSTools.xx("misc.msg.noentryyet");
                            } else {
                                Properties props = load(insurance.getProperties());
                                String grade = SYSTools.xx("ninsurance.grade." + props.getProperty("grade"));
                                ins = grade + (props.getProperty("grade").equals("assigned")
                                        ? ": " + props.getProperty("result")
                                        : "");
                            }

                            ul += SYSConst.html_ul(SYSConst.html_li(ins));
                        }
                    }

                    content += SYSConst.html_ul(ul);

                    SYSFilesTools.print(content, false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlInsuranceGrade.add(btnIG, BorderLayout.WEST);
    pnlContent.add(pnlInsuranceGrade);

    return pnlContent;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphActionsPane() {
    JPanel buttonPanel = new JPanel(new BorderLayout());
    JPanel displayPane = new JPanel();
    displayPane.add(displayButton);//from  www. ja  va 2 s .com
    displayButton.addActionListener(this);
    buttonPanel.add(displayPane, BorderLayout.WEST);

    JPanel savePane = new JPanel();
    savePane.add(saveGraph);
    saveGraph.addActionListener(this);
    syncWithName.addActionListener(this);
    buttonPanel.add(savePane, BorderLayout.EAST);

    return buttonPanel;
}

From source file:org.rdv.viz.image.ImageViz.java

private void addRoboticControls() {
    if (flexTPSStream == null) {
        return;// ww  w . java  2 s  .  c o m
    }

    if (flexTPSStream.canIris()) {
        topControls.add(irisControls, BorderLayout.NORTH);
    } else {
        topControls.remove(irisControls);
    }

    if (flexTPSStream.canFocus()) {
        topControls.add(focusControls, BorderLayout.CENTER);
    } else {
        topControls.remove(focusControls);
    }

    if (flexTPSStream.canZoom()) {
        topControls.add(zoomControls, BorderLayout.SOUTH);
    } else {
        topControls.remove(zoomControls);
    }

    if (flexTPSStream.canTilt() && flexTPSStream.canPan()) {
        panel.add(tiltControls, BorderLayout.EAST);
        panel.add(panControls, BorderLayout.SOUTH);
    } else {
        panel.remove(tiltControls);
        panel.remove(panControls);
    }

    panel.revalidate();

    imagePanel.removeMouseListener(roboticMouseClickListener);
    imagePanel.addMouseListener(roboticMouseClickListener);
}

From source file:gda.gui.BatonPanel.java

private JPanel getMessageSendPnl() {
    if (jPanel2 == null) {
        jPanel2 = new JPanel();
        BorderLayout jPanel2Layout = new BorderLayout();
        jPanel2.setLayout(jPanel2Layout);
        jPanel2.add(getTxtMessage(), BorderLayout.CENTER);
        jPanel2.add(getBtnSend(), BorderLayout.EAST);
    }/*  ww  w  .  ja va2s  .c  om*/
    return jPanel2;
}

From source file:org.rdv.ui.MainPanel.java

private void initMenuBar() {
    Application application = RDV.getInstance();
    ApplicationContext context = application.getContext();

    ResourceMap resourceMap = context.getResourceMap();
    String platform = resourceMap.getString("platform");
    boolean isMac = (platform != null && platform.equals("osx"));

    ActionFactory actionFactory = ActionFactory.getInstance();

    Actions actions = Actions.getInstance();
    ActionMap actionMap = context.getActionMap(actions);

    menuBar = new JMenuBar();

    JMenuItem menuItem;//from   w w w . j  a v a  2s  .c o  m

    JMenu fileMenu = new JMenu(fileAction);

    menuItem = new JMenuItem(connectAction);
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(disconnectAction);
    fileMenu.add(menuItem);

    fileMenu.addSeparator();

    menuItem = new JMenuItem(loginAction);
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(logoutAction);
    fileMenu.add(menuItem);

    fileMenu.addMenuListener(new MenuListener() {
        public void menuCanceled(MenuEvent arg0) {
        }

        public void menuDeselected(MenuEvent arg0) {
        }

        public void menuSelected(MenuEvent arg0) {
            if (AuthenticationManager.getInstance().getAuthentication() == null) {
                loginAction.setEnabled(true);
                logoutAction.setEnabled(false);
            } else {
                loginAction.setEnabled(false);
                logoutAction.setEnabled(true);
            }
        }
    });

    fileMenu.addSeparator();

    menuItem = new JMenuItem(loadAction);
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(saveAction);
    fileMenu.add(menuItem);

    fileMenu.addSeparator();

    fileMenu.add(new JMenuItem(actionMap.get("addLocalChannel")));

    fileMenu.addSeparator();

    JMenu importSubMenu = new JMenu(importAction);

    menuItem = new JMenuItem(actionFactory.getDataImportAction());
    importSubMenu.add(menuItem);

    menuItem = new JMenuItem(actionFactory.getOpenSeesDataImportAction());
    importSubMenu.add(menuItem);

    importSubMenu.add(new JMenuItem(actionMap.get("importJPEGs")));

    fileMenu.add(importSubMenu);

    JMenu exportSubMenu = new JMenu(exportAction);

    menuItem = new JMenuItem(actionFactory.getDataExportAction());
    exportSubMenu.add(menuItem);

    menuItem = new JMenuItem(exportVideoAction);
    exportSubMenu.add(menuItem);

    fileMenu.add(exportSubMenu);

    fileMenu.addSeparator();

    menuItem = new DataViewerCheckBoxMenuItem(actionFactory.getOfflineAction());
    fileMenu.add(menuItem);

    if (!isMac) {
        menuItem = new JMenuItem(exitAction);
        fileMenu.add(menuItem);
    }

    menuBar.add(fileMenu);

    JMenu controlMenu = new JMenu(controlAction);

    menuItem = new SelectableCheckBoxMenuItem(realTimeAction);
    controlMenu.add(menuItem);

    menuItem = new SelectableCheckBoxMenuItem(playAction);
    controlMenu.add(menuItem);

    menuItem = new SelectableCheckBoxMenuItem(pauseAction);
    controlMenu.add(menuItem);

    controlMenu.addMenuListener(new MenuListener() {
        public void menuCanceled(MenuEvent arg0) {
        }

        public void menuDeselected(MenuEvent arg0) {
        }

        public void menuSelected(MenuEvent arg0) {
            int state = rbnb.getState();
            realTimeAction.setSelected(state == Player.STATE_MONITORING);
            playAction.setSelected(state == Player.STATE_PLAYING);
            pauseAction.setSelected(state == Player.STATE_STOPPED);
        }
    });

    controlMenu.addSeparator();

    menuItem = new JMenuItem(beginningAction);
    controlMenu.add(menuItem);

    menuItem = new JMenuItem(endAction);
    controlMenu.add(menuItem);

    menuItem = new JMenuItem(gotoTimeAction);
    controlMenu.add(menuItem);

    menuBar.add(controlMenu);

    controlMenu.addSeparator();

    menuItem = new JMenuItem(updateChannelListAction);
    controlMenu.add(menuItem);

    controlMenu.addSeparator();

    menuItem = new JCheckBoxMenuItem(dropDataAction);
    controlMenu.add(menuItem);

    JMenu viewMenu = new JMenu(viewAction);

    menuItem = new JCheckBoxMenuItem(showChannelListAction);
    menuItem.setSelected(true);
    viewMenu.add(menuItem);

    menuItem = new JCheckBoxMenuItem(showMetadataPanelAction);
    menuItem.setSelected(true);
    viewMenu.add(menuItem);

    menuItem = new JCheckBoxMenuItem(showControlPanelAction);
    menuItem.setSelected(true);
    viewMenu.add(menuItem);

    menuItem = new JCheckBoxMenuItem(showAudioPlayerPanelAction);
    menuItem.setSelected(false);
    viewMenu.add(menuItem);

    menuItem = new JCheckBoxMenuItem(showMarkerPanelAction);
    menuItem.setSelected(true);
    viewMenu.add(menuItem);

    viewMenu.addSeparator();

    menuItem = new JCheckBoxMenuItem(showHiddenChannelsAction);
    menuItem.setSelected(false);
    viewMenu.add(menuItem);

    menuItem = new JCheckBoxMenuItem(hideEmptyTimeAction);
    menuItem.setSelected(false);
    viewMenu.add(menuItem);

    viewMenu.addSeparator();

    menuItem = new JCheckBoxMenuItem(fullScreenAction);
    menuItem.setSelected(false);
    viewMenu.add(menuItem);

    menuBar.add(viewMenu);

    JMenu windowMenu = new JMenu(windowAction);

    List<Extension> extensions = dataPanelManager.getExtensions();
    for (final Extension extension : extensions) {
        Action action = new DataViewerAction("Add " + extension.getName(), "", KeyEvent.VK_J) {
            /** serialization version identifier */
            private static final long serialVersionUID = 36998228704476723L;

            public void actionPerformed(ActionEvent ae) {
                try {
                    dataPanelManager.createDataPanel(extension);
                } catch (Exception e) {
                    log.error("Unable to open data panel provided by extension " + extension.getName() + " ("
                            + extension.getID() + ").");
                    e.printStackTrace();
                }
            }
        };

        menuItem = new JMenuItem(action);
        windowMenu.add(menuItem);
    }

    windowMenu.addSeparator();

    menuItem = new JMenuItem(closeAllDataPanelsAction);
    windowMenu.add(menuItem);

    windowMenu.addSeparator();
    JMenu dataPanelSubMenu = new JMenu(dataPanelAction);

    ButtonGroup dataPanelLayoutGroup = new ButtonGroup();

    menuItem = new JRadioButtonMenuItem(dataPanelHorizontalLayoutAction);
    dataPanelSubMenu.add(menuItem);
    dataPanelLayoutGroup.add(menuItem);

    menuItem = new JRadioButtonMenuItem(dataPanelVerticalLayoutAction);
    menuItem.setSelected(true);
    dataPanelSubMenu.add(menuItem);
    dataPanelLayoutGroup.add(menuItem);
    windowMenu.add(dataPanelSubMenu);

    menuBar.add(windowMenu);

    JMenu helpMenu = new JMenu(helpAction);

    menuItem = new JMenuItem(usersGuideAction);
    helpMenu.add(menuItem);

    menuItem = new JMenuItem(supportAction);
    helpMenu.add(menuItem);

    menuItem = new JMenuItem(releaseNotesAction);
    helpMenu.add(menuItem);

    if (!isMac) {
        helpMenu.addSeparator();

        menuItem = new JMenuItem(aboutAction);
        helpMenu.add(menuItem);
    }

    menuBar.add(helpMenu);

    menuBar.add(Box.createHorizontalGlue());
    throbberStop = DataViewer.getIcon("icons/throbber.png");
    throbberAnim = DataViewer.getIcon("icons/throbber_anim.gif");
    throbber = new JLabel(throbberStop);
    throbber.setBorder(new EmptyBorder(0, 0, 0, 4));
    menuBar.add(throbber, BorderLayout.EAST);

    if (isMac) {
        registerMacOSXEvents();
    }

    frame.setJMenuBar(menuBar);
}

From source file:com.xilinx.virtex7.MainScreen.java

private Container createContentPane() {
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.setOpaque(true);/*w w  w .  ja va  2  s  .c  o  m*/

    mainPanel = new JPanel(new BorderLayout());

    mainPanel.setBounds(0, 0, minWidth, minHeight);
    testPanel = new JPanel(new BorderLayout());
    ttabs = new JTabbedPane();
    ttabs.add("DATAPATH 0&1", testAndStats());

    if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV
            || mode == LandingPage.APPLICATION_MODE || mode == LandingPage.APPLICATION_MODE_P2P) // condition for placing dynamic tabs. a kcah
        ttabs.add("DATAPATH 2&3", testAndStatsSecondTab());
    else
        testAndStatsSecondTab();

    testPanel.add(ttabs, BorderLayout.CENTER);
    testPanel.add(messageBox(), BorderLayout.PAGE_END);

    mainPanel.add(testPanel, BorderLayout.LINE_START);

    //Make the center component big, since that's the
    //typical usage of BorderLayout.
    tabs = new JTabbedPane();

    mainPanel.add(tabs, BorderLayout.CENTER);

    tabs.add("System Monitor", pciInfo());
    tabs.add("Performance Plots", plotPanel());

    mainPanel.setOpaque(true);

    try {
        imagePanel = new ImageBackgroundPanel(blockDiagram, false);
    } catch (Exception e) {
    }
    /*imagePanel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Design Block Diagram"),
                BorderFactory.createEmptyBorder(5,5,5,5)));*/
    imagePanel.setBackground(Color.WHITE);
    imagePanel.setSize(minWidth, minHeight);

    imagePanel.setLocation(0, 0);
    imagePanel.setOpaque(true);

    final JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(minWidth, minHeight));
    layeredPane.add(mainPanel, JLayeredPane.DEFAULT_LAYER, 0);
    layeredPane.add(imagePanel, JLayeredPane.DEFAULT_LAYER, 0);
    layeredPane.addComponentListener(new ComponentListener() {

        @Override
        public void componentResized(ComponentEvent ce) {
            mainPanel.setBounds(0, 0, Math.max(minWidth, layeredPane.getWidth()),
                    Math.max(minHeight, layeredPane.getHeight()));
            if (layeredPane.getWidth() > 1024) {
                tplotPanel.setPreferredSize(new Dimension(300, 100));
            } else {
                tplotPanel.setPreferredSize(new Dimension(200, 100));
            }
            imagePanel.setSize(mainPanel.getWidth(), mainPanel.getHeight());
            imagePanel.setLocation(0, 0);
            mainPanel.repaint();
        }

        @Override
        public void componentMoved(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void componentShown(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void componentHidden(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    // on top, but invisible initially
    imagePanel.setVisible(false);

    JPanel bpanel = new JPanel(new BorderLayout());

    final JButton button = new JButton(
            "<html><b>B<br>L<br>O<br>C<br>K<br> <br>D<br>I<br>A<br>G<br>R<br>A<br>M<br></b></html>");
    button.setToolTipText("Click here to see the block diagram");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            adjustSelectionPanel();
        }
    });

    bpanel.add(button, BorderLayout.CENTER);

    contentPane.add(layeredPane, BorderLayout.CENTER);
    contentPane.add(button, BorderLayout.EAST);
    JPanel panel = new JPanel(new BorderLayout());

    JLabel mLabel = new JLabel(modeText, JLabel.CENTER);
    mLabel.setFont(new Font(modeText, Font.BOLD, 15));
    panel.add(mLabel, BorderLayout.PAGE_START);

    JPanel ledPanel = new JPanel(new BorderLayout());

    JPanel iledPanel = new JPanel();
    iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS));

    led_ddr3_1 = new JLabel("DDR3 0", new ImageIcon(led1), JLabel.CENTER);
    led_ddr3_2 = new JLabel("DDR3 1", new ImageIcon(led1), JLabel.CENTER);
    led_phy0 = new JLabel("PHY 0", new ImageIcon(led1), JLabel.CENTER);
    led_phy1 = new JLabel("PHY 1", new ImageIcon(led1), JLabel.CENTER);
    led_phy2 = new JLabel("PHY 2", new ImageIcon(led1), JLabel.CENTER);
    led_phy3 = new JLabel("PHY 3", new ImageIcon(led1), JLabel.CENTER);

    JPanel le1 = new JPanel(new BorderLayout());
    le1.add(led_ddr3_1, BorderLayout.CENTER);

    JPanel le2 = new JPanel(new BorderLayout());
    le2.add(led_ddr3_2, BorderLayout.CENTER);

    JPanel le3 = new JPanel(new BorderLayout());
    le3.add(led_phy0, BorderLayout.CENTER);

    JPanel le4 = new JPanel(new BorderLayout());
    le4.add(led_phy1, BorderLayout.CENTER);

    JPanel le5 = new JPanel(new BorderLayout());
    le5.add(led_phy2, BorderLayout.CENTER);

    JPanel le6 = new JPanel(new BorderLayout());
    le6.add(led_phy3, BorderLayout.CENTER);

    iledPanel.add(le1);
    iledPanel.add(le2);
    iledPanel.add(le3);
    iledPanel.add(le4);
    iledPanel.add(le5);
    iledPanel.add(le6);

    if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {
        startAll_tooltip = "This will start tests on all data paths";
        startAlltests = new JButton("Start All");
        startAlltests.setToolTipText(startAll_tooltip);
        startAlltests.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                if (startAlltests.getText().equals("Start All")) {
                    startAll_tooltip = "This will stop tests on all data paths";
                    startAlltests.setToolTipText(startAll_tooltip);
                    // check whether any tests are already started
                    String message = "";
                    if (testStarted || testStarted1)
                        message = "Test(s) on Path 0&1 are running. Cannot do Start All";
                    if (testStarted2 || testStarted3) {
                        if (message.length() > 0) // test 1 and 0 are also running
                            message = "Test(s) on Path 0&1 and 2&3 are running. Cannot do Start All";
                        else
                            message = "Test(s) on Path 2&3 are running. Cannot do Start All";
                    }
                    if (message.length() > 0) {
                        JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE);
                    } else {
                        String ledsMsg = checkLedsState();
                        // condition to check the ddr and py leds are enable or not
                        if (ledsMsg.length() == 0) {
                            startAlltests.setEnabled(false);
                            startAlltests.setText("Stop All");

                            startTest.doClick();
                            stest.doClick();
                            s3test.doClick();
                            s4test.doClick();

                            // disable all buttons
                            startTest.setEnabled(false);
                            stest.setEnabled(false);
                            s3test.setEnabled(false);
                            s4test.setEnabled(false);

                            startAlltests.setEnabled(true);
                        } else {// shows alert when leds are disabled                                
                            JOptionPane.showMessageDialog(null, ledsMsg, "Error", JOptionPane.ERROR_MESSAGE);
                        }

                    }
                } else {
                    startAlltests.setEnabled(false);
                    startAll_tooltip = "This will start tests on all data paths";
                    startAlltests.setToolTipText(startAll_tooltip);
                    /*
                    startTest.setEnabled(true);
                    stest.setEnabled(true);
                    s3test.setEnabled(true);
                    s4test.setEnabled(true);
                            
                    s3test.doClick();
                    s4test.doClick();
                    startTest.doClick();
                    stest.doClick();
                    */
                    SwingWorker worker = new SwingWorker<Void, Void>() {
                        @Override
                        protected Void doInBackground() throws Exception {
                            try {
                                stopTest4();
                                s4test.setEnabled(false);
                                stopTest3();
                                s3test.setEnabled(false);
                                stopTest2();
                                stest.setEnabled(false);
                                stopTest1();
                                startTest.setEnabled(false);

                                startAlltests.setText("Start All");
                                startAlltests.setEnabled(true);
                                startTest.setEnabled(true);
                                stest.setEnabled(true);
                                s3test.setEnabled(true);
                                s4test.setEnabled(true);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            return null;
                        }

                    };
                    worker.execute();
                }
            }
        });
        iledPanel.add(startAlltests);
    }
    ledPanel.add(iledPanel, BorderLayout.CENTER);

    //tstats.add(ledPanel);
    panel.add(ledPanel, BorderLayout.CENTER);
    contentPane.add(panel, BorderLayout.PAGE_START);
    return contentPane;
}

From source file:org.jab.docsearch.DocSearch.java

/**
 * Constructor/*  w  ww. j  a  v a 2s  . c  om*/
 */
public DocSearch() {
    super(I18n.getString("ds.windowtitle"));

    // get logger
    logger = Logger.getLogger(getClass().getName());

    //
    File testCDFi = new File(cdRomDefaultHome);
    Properties sys = new Properties(System.getProperties());
    if (testCDFi.exists()) {
        sys.setProperty("disableLuceneLocks", "true");
        logger.info("DocSearch() Disabling Lucene Locks for CDROM indexes");
    } else {
        sys.setProperty("disableLuceneLocks", "false");
    }

    //
    checkCDROMDir();
    defaultHndlr = getBrowserFile();
    loadSettings();

    //
    pPanel = new ProgressPanel("", 100L);
    pPanel.init();

    phrase = new JRadioButton(I18n.getString("label.phrase"));
    searchField = new JComboBox();
    searchIn = new JComboBox(searchOptsLabels);
    JLabel searchTypeLabel = new JLabel(I18n.getString("label.search_type"));
    JLabel searchInLabel = new JLabel(I18n.getString("label.search_in"));
    keywords = new JRadioButton(I18n.getString("label.keyword"));
    //
    searchLabel = new JLabel(I18n.getString("label.search_for"));
    searchButton = new JButton(I18n.getString("button.search"));
    searchButton.setActionCommand("ac_search");
    searchButton.setMnemonic(KeyEvent.VK_A);
    // TODO alt text to resource
    htmlTag = "<img src=\"" + fEnv.getIconURL(FileType.HTML.getIcon())
            + "\" border=\"0\" alt=\"Web Page Document\">";
    wordTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_WORD.getIcon())
            + "\" border=\"0\" alt=\"MS Word Document\">";
    excelTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_EXCEL.getIcon())
            + "\" border=\"0\" alt=\"MS Excel Document\">";
    pdfTag = "<img src=\"" + fEnv.getIconURL(FileType.PDF.getIcon()) + "\" border=\"0\" alt=\"PDF Document\">";
    textTag = "<img src=\"" + fEnv.getIconURL(FileType.TEXT.getIcon())
            + "\" border=\"0\" alt=\"Text Document\">";
    rtfTag = "<img src=\"" + fEnv.getIconURL(FileType.RTF.getIcon()) + "\" border=\"0\" alt=\"RTF Document\">";
    ooImpressTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_IMPRESS.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Impress Document\">";
    ooWriterTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_WRITER.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Writer Document\">";
    ooCalcTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_CALC.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Calc Document\">";
    ooDrawTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_DRAW.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Draw Document\">";
    openDocumentTextTag = "<img src=\"" + fEnv.getIconURL(FileType.OPENDOCUMENT_TEXT.getIcon())
            + "\" border=\"0\" alt=\"OpenDocument Text Document\">";
    //
    idx = new Index(this);
    colors = new String[2];
    colors[0] = "ffeffa";
    colors[1] = "fdffda";
    if (env.isWebStart()) {
        startPageString = getClass().getResource("/" + FileEnvironment.FILENAME_START_PAGE_WS).toString();
        helpPageString = getClass().getResource("/" + FileEnvironment.FILENAME_HELP_PAGE_WS).toString();
        if (startPageString != null) {
            logger.debug("DocSearch() Start Page is: " + startPageString);
            hasStartPage = true;
        } else {
            logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString);
        }
    } else {
        startPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_START_PAGE);
        helpPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_HELP_PAGE);
        File startPageFile = new File(startPageString);
        if (startPageFile.exists()) {
            logger.debug("DocSearch() Start Page is: " + startPageString);
            hasStartPage = true;
        } else {
            logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString);
        }
    }

    defaultSaveFolder = FileUtils.addFolder(fEnv.getWorkingDirectory(), "saved_searches");
    searchField.setEditable(true);
    searchField.addItem("");

    bg = new ButtonGroup();
    bg.add(phrase);
    bg.add(keywords);
    keywords.setSelected(true);

    keywords.setToolTipText(I18n.getString("tooltip.keyword"));
    phrase.setToolTipText(I18n.getString("tooltip.phrase"));

    int iconInt = 2;
    searchField.setPreferredSize(new Dimension(370, 22));

    // application icon
    Image iconImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/ds.gif"));
    this.setIconImage(iconImage);

    // menu bar
    JMenuBar menuBar = createMenuBar();
    // add menu to frame
    setJMenuBar(menuBar);

    // tool bar
    JToolBar toolbar = createToolBar();

    editorPane = new JEditorPane("text/html", lastSearch);
    editorPane.setEditable(false);
    editorPane.addHyperlinkListener(new Hyperactive());
    if (hasStartPage) {
        try {
            editorPane.setContentType("text/html");
            if (setPage("home")) {
                logger.info("DocSearch() loaded start page: " + startPageString);
            }
        } catch (Exception e) {
            editorPane.setText(lastSearch);
        }
    } else {
        logger.warn("DocSearch() no start page loaded");
    }

    scrollPane = new JScrollPane(editorPane);
    scrollPane.setPreferredSize(new Dimension(1024, 720));
    scrollPane.setMinimumSize(new Dimension(900, 670));
    scrollPane.setMaximumSize(new Dimension(1980, 1980));

    // create panels
    // add printing stuff
    vista = new JComponentVista(editorPane, new PageFormat());

    JPanel topPanel = new JPanel();
    topPanel.add(searchLabel);
    topPanel.add(searchField);
    topPanel.add(searchButton);

    JPanel bottomPanel = new JPanel();
    bottomPanel.add(searchTypeLabel);
    bottomPanel.add(keywords);
    bottomPanel.add(phrase);
    bottomPanel.add(searchInLabel);
    bottomPanel.add(searchIn);

    // GUI items for advanced searching
    useDate = new JCheckBox(I18n.getString("label.use_date_property"));
    fromField = new JTextField(11);
    JLabel fromLabel = new JLabel(I18n.getString("label.from"));
    JLabel toLabel = new JLabel(I18n.getString("label.to"));
    toField = new JTextField(11);
    cbl = new CheckBoxListener();
    authorPanel = new JPanel();
    useAuthor = new JCheckBox(I18n.getString("label.use_auth_property"));
    authorField = new JTextField(31);
    JLabel authorLabel = new JLabel(I18n.getString("label.author"));
    authorPanel.add(useAuthor);
    authorPanel.add(authorLabel);
    authorPanel.add(authorField);

    // combine stuff
    JPanel datePanel = new JPanel();
    datePanel.add(useDate);
    datePanel.add(fromLabel);
    datePanel.add(fromField);
    datePanel.add(toLabel);
    datePanel.add(toField);

    JPanel metaPanel = new JPanel();
    metaPanel.setLayout(new BorderLayout());
    metaPanel.setBorder(new TitledBorder(I18n.getString("label.date_and_author")));
    metaPanel.add(datePanel, BorderLayout.NORTH);
    metaPanel.add(authorPanel, BorderLayout.SOUTH);

    useDate.addActionListener(cbl);
    useAuthor.addActionListener(cbl);

    fromField.setText(DateTimeUtils.getLastYear());
    toField.setText(DateTimeUtils.getToday());
    authorField.setText(System.getProperty("user.name"));

    JPanel[] panels = new JPanel[numPanels];
    for (int i = 0; i < numPanels; i++) {
        panels[i] = new JPanel();
    }

    // add giu to panels
    panels[0].setLayout(new BorderLayout());
    panels[0].add(topPanel, BorderLayout.NORTH);
    panels[0].add(bottomPanel, BorderLayout.SOUTH);
    panels[0].setBorder(new TitledBorder(I18n.getString("label.search_critera")));
    searchButton.addActionListener(this);

    JPanel fileTypePanel = new JPanel();
    useType = new JCheckBox(I18n.getString("label.use_filetype_property"));
    useType.addActionListener(cbl);
    fileType = new JComboBox(fileTypesToFindLabel);
    JLabel fileTypeLabel = new JLabel(I18n.getString("label.find_only_these_filetypes"));
    fileTypePanel.add(useType);
    fileTypePanel.add(fileTypeLabel);
    fileTypePanel.add(fileType);

    JPanel sizePanel = new JPanel();
    useSize = new JCheckBox(I18n.getString("label.use_filesize_property"));
    useSize.addActionListener(cbl);
    // TODO l18n kbytes
    JLabel sizeFromLabel = new JLabel(I18n.getString("label.from") + " KByte");
    JLabel sizeToLabel = new JLabel(I18n.getString("label.to") + " KByte");
    sizeFromField = new JTextField(10);
    sizeFromField.setText("0");
    sizeToField = new JTextField(10);
    sizeToField.setText("100");
    sizePanel.add(useSize);
    sizePanel.add(sizeFromLabel);
    sizePanel.add(sizeFromField);
    sizePanel.add(sizeToLabel);
    sizePanel.add(sizeToField);

    JPanel sizeAndTypePanel = new JPanel();
    sizeAndTypePanel.setLayout(new BorderLayout());
    sizeAndTypePanel.setBorder(new TitledBorder(I18n.getString("label.filetype_and_size")));
    sizeAndTypePanel.add(fileTypePanel, BorderLayout.NORTH);
    sizeAndTypePanel.add(sizePanel, BorderLayout.SOUTH);

    // set up the tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(I18n.getString("label.general"), null, panels[0],
            I18n.getString("tooltip.general_search_criteria"));
    tabbedPane.addTab(I18n.getString("label.date_and_author"), null, metaPanel,
            I18n.getString("tooltip.date_auth_options"));
    tabbedPane.addTab(I18n.getString("label.filetype_and_size"), null, sizeAndTypePanel,
            I18n.getString("tooltip.filetype_and_size_options"));

    // gridbag
    getContentPane().setLayout(new GridLayout(1, numPanels + iconInt + 1));
    GridBagLayout gridbaglayout = new GridBagLayout();
    GridBagConstraints gridbagconstraints = new GridBagConstraints();
    getContentPane().setLayout(gridbaglayout);

    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = 0;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 0.0D;
    gridbaglayout.setConstraints(toolbar, gridbagconstraints);
    getContentPane().add(toolbar);

    int start = 1;
    for (int i = 0; i < numPanels; i++) {
        if (i == 0) {
            gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
            gridbagconstraints.insets = new Insets(1, 1, 1, 1);
            gridbagconstraints.gridx = 0;
            gridbagconstraints.gridy = i + start;
            gridbagconstraints.gridwidth = 1;
            gridbagconstraints.gridheight = 1;
            gridbagconstraints.weightx = 1.0D;
            gridbagconstraints.weighty = 0.0D;
            gridbaglayout.setConstraints(tabbedPane, gridbagconstraints);
            getContentPane().add(tabbedPane);
        } else {
            gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
            gridbagconstraints.insets = new Insets(1, 1, 1, 1);
            gridbagconstraints.gridx = 0;
            gridbagconstraints.gridy = i + start;
            gridbagconstraints.gridwidth = 1;
            gridbagconstraints.gridheight = 1;
            gridbagconstraints.weightx = 1.0D;
            gridbagconstraints.weighty = 0.0D;
            gridbaglayout.setConstraints(panels[i], gridbagconstraints);
            getContentPane().add(panels[i]);
        }
    }

    // now add the results area
    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = iconInt;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 1.0D;
    gridbaglayout.setConstraints(scrollPane, gridbagconstraints);
    getContentPane().add(scrollPane);
    JPanel statusP = new JPanel();
    statusP.setLayout(new BorderLayout());
    statusP.add(dirLabel, BorderLayout.WEST);
    statusP.add(pPanel, BorderLayout.EAST);

    // now add the status label
    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = numPanels + iconInt;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 0.0D;
    gridbaglayout.setConstraints(statusP, gridbagconstraints);
    getContentPane().add(statusP);

    //
    File testArchDir = new File(fEnv.getArchiveDirectory());
    if (!testArchDir.exists()) {
        boolean madeDir = testArchDir.mkdir();
        if (!madeDir) {
            logger.warn("DocSearch() Error creating directory: " + fEnv.getArchiveDirectory());
        } else {
            logger.info("DocSearch() Directory created: " + fEnv.getArchiveDirectory());
        }
    }
    loadIndexes();

    // DocTypeHandler
    String handlersFiName;
    if (!isCDSearchTool) {
        handlersFiName = FileUtils.addFolder(fEnv.getWorkingDirectory(), DocTypeHandlerUtils.HANDLER_FILE);
    } else {
        handlersFiName = FileUtils.addFolder(cdRomDefaultHome, DocTypeHandlerUtils.HANDLER_FILE);
    }
    DocTypeHandlerUtils dthUtils = new DocTypeHandlerUtils();
    if (!FileUtils.fileExists(handlersFiName)) {
        logger.warn("DocSearch() Handlers file not found at: " + handlersFiName);
        handlerList = dthUtils.getInitialHandler(env);
    } else {
        handlerList = dthUtils.loadHandler(handlersFiName);
    }
}