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.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewPane.java

private void refreshReportController(final ReportController newReportController) {
    for (int i = 0; i < outerReportControllerHolder.getComponentCount(); i++) {
        final Component maybeSplitPane = outerReportControllerHolder.getComponent(i);
        if (maybeSplitPane instanceof JSplitPane) {
            final JSplitPane splitPane = (JSplitPane) maybeSplitPane;
            reportControllerSliderSize = splitPane.getDividerLocation();
            break;
        }/*from   w ww.j  av a  2s  .co m*/
    }

    if (newReportController == null) {
        if (reportControllerComponent != null) {
            // thats relatively easy.
            outerReportControllerHolder.removeAll();
            outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
            outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
            reportControllerComponent = null;
            reportControllerInner = false;
            reportControllerLocation = null;
        }
    } else {
        final JComponent rcp = newReportController.getControlPanel();
        if (rcp == null) {
            if (reportControllerComponent != null) {
                outerReportControllerHolder.removeAll();
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
                reportControllerComponent = null;
                reportControllerInner = false;
                reportControllerLocation = null;
            }
        } else if (reportControllerComponent != rcp
                || reportControllerInner != newReportController.isInnerComponent()
                || ObjectUtilities.equal(reportControllerLocation,
                        newReportController.getControllerLocation()) == false) {
            // if either the controller component or its position (inner vs outer)
            // and border-position has changed, then refresh ..
            this.reportControllerLocation = newReportController.getControllerLocation();
            this.reportControllerInner = newReportController.isInnerComponent();
            this.reportControllerComponent = newReportController.getControlPanel();

            outerReportControllerHolder.removeAll();
            if (reportControllerInner) {
                final JSplitPane innerHolder = new JSplitPane();
                innerHolder.setOpaque(false);
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneScrollPane);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneScrollPane);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneScrollPane);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneScrollPane);
                    innerHolder.setTopComponent(reportControllerComponent);
                }

                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            } else {
                final JPanel reportPaneHolder = new JPanel();
                reportPaneHolder.setOpaque(false);
                reportPaneHolder.setLayout(new BorderLayout());
                reportPaneHolder.add(toolbarHolder, BorderLayout.NORTH);
                reportPaneHolder.add(reportPaneScrollPane, BorderLayout.CENTER);

                final JSplitPane innerHolder = new JSplitPane();
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneHolder);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneHolder);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneHolder);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneHolder);
                    innerHolder.setTopComponent(reportControllerComponent);
                }
                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            }
        }
    }
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createChoicePanel(Choice list, String label) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //list.setSize(fontWidth * 3, fontWidth);
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(list, BorderLayout.CENTER);
    return panel;
}

From source file:org.broad.igv.hic.MainWindow.java

private void initComponents() {
    JPanel mainPanel = new JPanel();
    JPanel toolbarPanel = new JPanel();

    //======== this ========

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    mainPanel.setLayout(new BorderLayout());

    toolbarPanel.setBorder(null);/* www.j  a  va  2  s .  co  m*/
    toolbarPanel.setLayout(new GridLayout());

    JPanel chrSelectionPanel = new JPanel();
    chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder());
    chrSelectionPanel.setMinimumSize(new Dimension(130, 57));
    chrSelectionPanel.setPreferredSize(new Dimension(130, 57));
    chrSelectionPanel.setLayout(new BorderLayout());

    JPanel panel10 = new JPanel();
    panel10.setBackground(new Color(204, 204, 204));
    panel10.setLayout(new BorderLayout());

    JLabel label3 = new JLabel();
    label3.setText("Chromosomes");
    label3.setHorizontalAlignment(SwingConstants.CENTER);
    panel10.add(label3, BorderLayout.CENTER);

    chrSelectionPanel.add(panel10, BorderLayout.PAGE_START);

    JPanel panel9 = new JPanel();
    panel9.setBackground(new Color(238, 238, 238));
    panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS));

    //---- chrBox1 ----
    chrBox1 = new JComboBox();
    chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" }));
    chrBox1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            chrBox1ActionPerformed(e);
        }
    });
    panel9.add(chrBox1);

    //---- chrBox2 ----
    chrBox2 = new JComboBox();
    chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" }));
    chrBox2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            chrBox2ActionPerformed(e);
        }
    });
    panel9.add(chrBox2);

    //---- refreshButton ----
    JideButton refreshButton = new JideButton();
    refreshButton
            .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif")));
    refreshButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            refreshButtonActionPerformed(e);
        }
    });
    panel9.add(refreshButton);

    chrSelectionPanel.add(panel9, BorderLayout.CENTER);

    toolbarPanel.add(chrSelectionPanel);

    //======== displayOptionPanel ========
    JPanel displayOptionPanel = new JPanel();
    JPanel panel1 = new JPanel();
    displayOptionComboBox = new JComboBox();

    displayOptionPanel.setBackground(new Color(238, 238, 238));
    displayOptionPanel.setBorder(LineBorder.createGrayLineBorder());
    displayOptionPanel.setLayout(new BorderLayout());

    //======== panel14 ========

    JPanel panel14 = new JPanel();
    panel14.setBackground(new Color(204, 204, 204));
    panel14.setLayout(new BorderLayout());

    //---- label4 ----
    JLabel label4 = new JLabel();
    label4.setText("Show");
    label4.setHorizontalAlignment(SwingConstants.CENTER);
    panel14.add(label4, BorderLayout.CENTER);

    displayOptionPanel.add(panel14, BorderLayout.PAGE_START);

    //======== panel1 ========

    panel1.setBorder(new EmptyBorder(0, 10, 0, 10));
    panel1.setLayout(new GridLayout(1, 0, 20, 0));

    //---- comboBox1 ----
    displayOptionComboBox
            .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() }));
    displayOptionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            displayOptionComboBoxActionPerformed(e);
        }
    });
    panel1.add(displayOptionComboBox);

    displayOptionPanel.add(panel1, BorderLayout.CENTER);

    toolbarPanel.add(displayOptionPanel);

    //======== colorRangePanel ========

    JPanel colorRangePanel = new JPanel();
    JLabel colorRangeLabel = new JLabel();
    colorRangeSlider = new RangeSlider();
    colorRangePanel.setBorder(LineBorder.createGrayLineBorder());
    colorRangePanel.setMinimumSize(new Dimension(96, 70));
    colorRangePanel.setPreferredSize(new Dimension(202, 70));
    colorRangePanel.setMaximumSize(new Dimension(32769, 70));
    colorRangePanel.setLayout(new BorderLayout());

    //======== panel11 ========

    JPanel colorLabelPanel = new JPanel();
    colorLabelPanel.setBackground(new Color(204, 204, 204));
    colorLabelPanel.setLayout(new BorderLayout());

    //---- colorRangeLabel ----
    colorRangeLabel.setText("Color Range");
    colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER);
    colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared.");
    colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    colorRangeLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider);
                rangeDialog.setVisible(true);
            }
        }

        @Override
        public void mouseClicked(MouseEvent e) {
            ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider);
            rangeDialog.setVisible(true);
        }
    });
    colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER);

    colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START);

    //---- colorRangeSlider ----
    colorRangeSlider.setPaintTicks(true);
    colorRangeSlider.setPaintLabels(true);
    colorRangeSlider.setLowerValue(0);
    colorRangeSlider.setMajorTickSpacing(500);
    colorRangeSlider.setMaximumSize(new Dimension(32767, 52));
    colorRangeSlider.setPreferredSize(new Dimension(200, 52));
    colorRangeSlider.setMinimumSize(new Dimension(36, 52));
    colorRangeSlider.setMaximum(2000);
    colorRangeSlider.setUpperValue(500);
    colorRangeSlider.setMinorTickSpacing(100);
    colorRangeSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            colorRangeSliderStateChanged(e);
        }
    });
    colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END);

    //        JPanel colorRangeTextPanel = new JPanel();
    //        colorRangeTextPanel.setLayout(new FlowLayout());
    //        JTextField minField = new JTextField();
    //        minField.setPreferredSize(new Dimension(50, 15));
    //        colorRangeTextPanel.add(minField);
    //        colorRangeTextPanel.add(new JLabel(" - "));
    //        JTextField maxField = new JTextField();
    //        maxField.setPreferredSize(new Dimension(50, 15));
    //        colorRangeTextPanel.add(maxField);
    //        colorRangeTextPanel.setPreferredSize(new Dimension(200, 52));
    //        colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END);

    toolbarPanel.add(colorRangePanel);

    //======== resolutionPanel ========

    JLabel resolutionLabel = new JLabel();
    JPanel resolutionPanel = new JPanel();

    resolutionPanel.setBorder(LineBorder.createGrayLineBorder());
    resolutionPanel.setLayout(new BorderLayout());

    //======== panel12 ========

    JPanel panel12 = new JPanel();
    panel12.setBackground(new Color(204, 204, 204));
    panel12.setLayout(new BorderLayout());

    //---- resolutionLabel ----
    resolutionLabel.setText("Resolution");
    resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    resolutionLabel.setBackground(new Color(204, 204, 204));
    panel12.add(resolutionLabel, BorderLayout.CENTER);

    resolutionPanel.add(panel12, BorderLayout.PAGE_START);

    //======== panel2 ========

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

    //---- resolutionSlider ----
    resolutionSlider = new JSlider();
    resolutionSlider.setMaximum(8);
    resolutionSlider.setMajorTickSpacing(1);
    resolutionSlider.setPaintTicks(true);
    resolutionSlider.setSnapToTicks(true);
    resolutionSlider.setPaintLabels(true);
    resolutionSlider.setMinorTickSpacing(1);

    Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>();
    Font f = FontManager.getFont(8);
    for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) {
        if ((i + 1) % 2 == 0) {
            final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]);
            tickLabel.setFont(f);
            resolutionLabels.put(i, tickLabel);
        }
    }
    resolutionSlider.setLabelTable(resolutionLabels);
    // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice.
    resolutionSlider.addChangeListener(new ChangeListener() {
        // Change zoom level while staying centered on current location.
        // Centering is relative to the bounds of the data, which might not be the bounds of the window

        public void stateChanged(ChangeEvent e) {
            if (!resolutionSlider.getValueIsAdjusting()) {
                int idx = resolutionSlider.getValue();
                idx = Math.max(0, Math.min(idx, MAX_ZOOM));

                if (hic.zd != null && idx == hic.zd.getZoom()) {
                    // Nothing to do
                    return;
                }

                if (hic.xContext != null) {
                    int centerLocationX = (int) hic.xContext
                            .getChromosomePosition(getHeatmapPanel().getWidth() / 2);
                    int centerLocationY = (int) hic.yContext
                            .getChromosomePosition(getHeatmapPanel().getHeight() / 2);
                    hic.setZoom(idx, centerLocationX, centerLocationY, false);
                }
                //zoomInButton.setEnabled(newZoom < MAX_ZOOM);
                //zoomOutButton.setEnabled(newZoom > 0);
            }
        }
    });
    panel2.add(resolutionSlider);

    resolutionPanel.add(panel2, BorderLayout.CENTER);

    toolbarPanel.add(resolutionPanel);

    mainPanel.add(toolbarPanel, BorderLayout.NORTH);

    //======== hiCPanel ========

    final JPanel hiCPanel = new JPanel();
    hiCPanel.setLayout(new HiCLayout());

    //---- rulerPanel2 ----
    rulerPanel2 = new HiCRulerPanel(hic);
    rulerPanel2.setMaximumSize(new Dimension(4000, 50));
    rulerPanel2.setMinimumSize(new Dimension(1, 50));
    rulerPanel2.setPreferredSize(new Dimension(1, 50));
    rulerPanel2.setBorder(null);

    JPanel panel2_5 = new JPanel();
    panel2_5.setLayout(new BorderLayout());
    panel2_5.add(rulerPanel2, BorderLayout.SOUTH);

    trackPanel = new TrackPanel(hic);
    trackPanel.setMaximumSize(new Dimension(4000, 50));
    trackPanel.setPreferredSize(new Dimension(1, 50));
    trackPanel.setMinimumSize(new Dimension(1, 50));
    trackPanel.setBorder(null);

    //        trackPanelScrollpane = new JScrollPane();
    //        trackPanelScrollpane.getViewport().add(trackPanel);
    //        trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    //        trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    //        trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    //        trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237));
    //        trackPanelScrollpane.setVisible(false);
    //        panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH);
    //
    trackPanel.setVisible(false);
    panel2_5.add(trackPanel, BorderLayout.NORTH);

    hiCPanel.add(panel2_5, BorderLayout.NORTH);

    //---- rulerPanel1 ----
    rulerPanel1 = new HiCRulerPanel(hic);
    rulerPanel1.setMaximumSize(new Dimension(50, 4000));
    rulerPanel1.setPreferredSize(new Dimension(50, 500));
    rulerPanel1.setBorder(null);
    rulerPanel1.setMinimumSize(new Dimension(50, 1));
    hiCPanel.add(rulerPanel1, BorderLayout.WEST);

    //---- heatmapPanel ----
    heatmapPanel = new HeatmapPanel(this, hic);
    heatmapPanel.setBorder(LineBorder.createBlackLineBorder());
    heatmapPanel.setMaximumSize(new Dimension(500, 500));
    heatmapPanel.setMinimumSize(new Dimension(500, 500));
    heatmapPanel.setPreferredSize(new Dimension(500, 500));
    heatmapPanel.setBackground(new Color(238, 238, 238));
    hiCPanel.add(heatmapPanel, BorderLayout.CENTER);

    //======== panel8 ========

    JPanel rightSidePanel = new JPanel();
    rightSidePanel.setMaximumSize(new Dimension(120, 100));
    rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0));
    rightSidePanel.setLayout(null);

    //---- thumbnailPanel ----
    thumbnailPanel = new ThumbnailPanel(this, hic);
    thumbnailPanel.setMaximumSize(new Dimension(100, 100));
    thumbnailPanel.setMinimumSize(new Dimension(100, 100));
    thumbnailPanel.setPreferredSize(new Dimension(100, 100));
    thumbnailPanel.setBorder(LineBorder.createBlackLineBorder());
    thumbnailPanel.setPreferredSize(new Dimension(100, 100));
    thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize()));
    rightSidePanel.add(thumbnailPanel);

    //======== xPlotPanel ========

    xPlotPanel = new JPanel();
    xPlotPanel.setPreferredSize(new Dimension(250, 100));
    xPlotPanel.setLayout(null);

    rightSidePanel.add(xPlotPanel);
    xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228);

    //======== yPlotPanel ========

    yPlotPanel = new JPanel();
    yPlotPanel.setPreferredSize(new Dimension(250, 100));
    yPlotPanel.setLayout(null);

    rightSidePanel.add(yPlotPanel);
    yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228);

    // compute preferred size
    Dimension preferredSize = new Dimension();
    for (int i = 0; i < rightSidePanel.getComponentCount(); i++) {
        Rectangle bounds = rightSidePanel.getComponent(i).getBounds();
        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
    }
    Insets insets = rightSidePanel.getInsets();
    preferredSize.width += insets.right;
    preferredSize.height += insets.bottom;
    rightSidePanel.setMinimumSize(preferredSize);
    rightSidePanel.setPreferredSize(preferredSize);

    hiCPanel.add(rightSidePanel, BorderLayout.EAST);

    mainPanel.add(hiCPanel, BorderLayout.CENTER);

    contentPane.add(mainPanel, BorderLayout.CENTER);

    JMenuBar menuBar = createMenuBar(hiCPanel);
    contentPane.add(menuBar, BorderLayout.NORTH);

    // setup the glass pane to display a wait cursor when visible, and to grab all mouse events
    rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    rootPane.getGlassPane().addMouseListener(new MouseAdapter() {
    });

}

From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java

protected Component createContentPane() {
    // Create the connection panel
    final JPanel queryContentPanel = new JPanel(new BorderLayout());
    queryContentPanel.add(BorderLayout.NORTH, createQueryListPanel());
    queryContentPanel.add(BorderLayout.CENTER, createQueryDetailsPanel());

    // Create the content panel
    final JPanel dialogContent = new JPanel(new BorderLayout());
    dialogContent.add(BorderLayout.WEST, connectionComponent);
    dialogContent.add(BorderLayout.CENTER, queryContentPanel);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(Messages.getString("JdbcDataSourceDialog.DataSource"), dialogContent);
    tabbedPane.addTab(Messages.getString("JdbcDataSourceDialog.GlobalScripting"), createGlobalScriptTab());

    final JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.add(BorderLayout.SOUTH, createPreviewButtonsPanel());
    contentPane.add(BorderLayout.CENTER, tabbedPane);
    contentPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    // Return the center panel
    return contentPane;
}

From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java

private JComponent getWindowPanelContent() {
    if (_datastore != null) {
        setDatastore(_datastore);/*  www . j  a v  a  2s .  c om*/
    }

    final SaveAnalysisJobActionListener saveAnalysisJobActionListener = _saveAnalysisJobActionListenerProvider
            .get();
    _saveButton.addActionListener(saveAnalysisJobActionListener);
    _saveAsButton.addActionListener(saveAnalysisJobActionListener);
    _saveAsButton.setActionCommand(SaveAnalysisJobActionListener.ACTION_COMMAND_SAVE_AS);

    // Run analysis
    _executeButton.addActionListener(execute(_analysisJobBuilder));

    _executionAlternativesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JMenuItem executeNormallyMenutItem = WidgetFactory.createMenuItem("Run normally",
                    IconUtils.ACTION_EXECUTE);
            executeNormallyMenutItem.addActionListener(execute(_analysisJobBuilder));

            final JMenuItem executePreviewMenuItem = WidgetFactory.createMenuItem("Run first N records",
                    IconUtils.ACTION_PREVIEW);
            executePreviewMenuItem.addActionListener(executePreview());

            final JMenuItem executeSingleThreadedMenuItem = WidgetFactory.createMenuItem("Run single-threaded",
                    IconUtils.MODEL_ROW);
            executeSingleThreadedMenuItem.addActionListener(executeSingleThreaded());

            final JPopupMenu menu = new JPopupMenu();
            menu.add(executeNormallyMenutItem);
            menu.addSeparator();
            menu.add(executePreviewMenuItem);
            menu.add(executeSingleThreadedMenuItem);

            final int horizontalPosition = -1 * menu.getPreferredSize().width
                    + _executionAlternativesButton.getWidth();
            menu.show(_executionAlternativesButton, horizontalPosition,
                    _executionAlternativesButton.getHeight());
        }
    });

    final JButton newJobButton = createToolbarButton("New", IconUtils.MENU_NEW);
    newJobButton.addActionListener(_newAnalysisJobActionListenerProvider.get());

    final JButton openJobButton = createToolbarButton("Open", IconUtils.MENU_OPEN);
    openJobButton.addActionListener(_openAnalysisJobActionListenerProvider.get());

    final JToggleButton moreButton = createMoreMenuButton();

    final JButton logoButton = new JButton(imageManager.getImageIcon("images/menu/dc-logo-30.png"));
    logoButton.setToolTipText("About DataCleaner");
    logoButton.setBorder(new EmptyBorder(0, 4, 0, 10));
    logoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            new AboutDialog(getWindowContext()).open();
        }
    });

    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(logoButton);
    toolBar.add(newJobButton);
    toolBar.add(openJobButton);
    toolBar.add(_saveButton);
    toolBar.add(_saveAsButton);
    toolBar.add(DCLabel.bright(" | "));
    toolBar.add(moreButton);

    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(_executeButton);
    toolBar.add(DCLabel.bright("|"));
    toolBar.add(_executionAlternativesButton);

    final JXStatusBar statusBar = WidgetFactory.createStatusBar(_statusLabel);
    statusBar.add(_classicViewButton);
    statusBar.add(_graphViewButton);
    statusBar.add(Box.createHorizontalStrut(10));

    final LicenceAndEditionStatusLabel statusLabel = new LicenceAndEditionStatusLabel(_glassPane);
    statusBar.add(statusLabel);

    final DCPanel toolBarPanel = new DCPanel(WidgetUtils.BG_COLOR_DARK);
    toolBarPanel.setLayout(new BorderLayout());
    toolBarPanel.add(toolBar, BorderLayout.CENTER);

    final DCPanel panel = new DCPersistentSizedPanel(_windowSizePreference);
    panel.setLayout(new BorderLayout());
    panel.add(toolBarPanel, BorderLayout.NORTH);
    panel.add(_leftPanel, BorderLayout.WEST);

    // newPanel.add(_tabbedPane, BorderLayout.NORTH);
    panel.add(_contentContainerPanel, BorderLayout.CENTER);

    panel.add(statusBar, BorderLayout.SOUTH);

    // invoke to trigger enablement/disablement of buttons.
    onSourceColumnsChanged();
    updateStatusLabel();

    WidgetUtils.centerOnScreen(this);
    return panel;
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createTextPanel(TextField textField, String label, String value) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //textField.setSize(fontWidth * 3, fontWidth);
    textField.setText(value);/*  ww w  .ja  va  2  s.  c  o m*/
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(textField, BorderLayout.CENTER);
    return panel;
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createLabelPanel(Label field, String label, String value) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //textField.setSize(fontWidth * 3, fontWidth);
    field.setText(value);/*from  w  ww  .ja va 2s .c  om*/
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(field, BorderLayout.CENTER);
    return panel;
}

From source file:op.controlling.PnlControlling.java

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

    /***//from  w  w w .  j a va 2s .c om
     *      ____  _         __  __
     *     / ___|| |_ __ _ / _|/ _|
     *     \___ \| __/ _` | |_| |_
     *      ___) | || (_| |  _|  _|
     *     |____/ \__\__,_|_| |_|
     *
     */
    JPanel pnlTraining = new JPanel(new BorderLayout());
    final JButton btnTrainings = GUITools.createHyperlinkButton("opde.controlling.staff.training", null, null);
    Pair<LocalDate, LocalDate> minmax = TrainingTools.getMinMax();
    btnTrainings.setEnabled(minmax != null);

    final JComboBox cmbYears = new JComboBox();

    if (minmax == null) {
        cmbYears.setModel(new DefaultComboBoxModel());
    } else {
        ArrayList<Integer> years = new ArrayList<>();

        for (int year = minmax.getSecond().getYear(); year >= minmax.getFirst().getYear(); year--) {
            years.add(year);
        }

        cmbYears.setModel(SYSTools.list2cmb(years));
        cmbYears.setSelectedIndex(0);
    }

    btnTrainings.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSFilesTools.print(
                            TrainingTools.getTraining2Attendees((Integer) cmbYears.getSelectedItem()), false);
                    return null;
                }

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

    return pnlContent;
}

From source file:com.titan.mainframe.MainFrame.java

public MainFrame() {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.toLowerCase().contains("mac")) {
        com.apple.eawt.Application macApp = com.apple.eawt.Application.getApplication();
        macApp.addApplicationListener(this);
    }//from w  ww . j a v  a  2s. c om
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            handleQuit();
        }

        @Override
        public void windowOpened(WindowEvent e) {
            windowOpened = true;
        }
    });
    setTitle("Titan " + Global.version);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    if (TitanSetting.getInstance().width == 0 || TitanSetting.getInstance().height == 0) {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, 1200, 700);
    } else {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, TitanSetting.getInstance().width,
                TitanSetting.getInstance().height);
    }

    setIconImage(new ImageIcon(getClass().getClassLoader().getResource("com/titan/image/titan_icon.png"))
            .getImage());

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    splitPane.setDividerLocation(TitanSetting.getInstance().mainframeDivX);
    contentPane.add(splitPane, BorderLayout.CENTER);

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

    JLabel logoLabel = new JLabel();
    logoLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            mainContentPanel.removeAll();
            mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
            mainContentPanel.updateUI();
        }
    });

    //      try {
    //         BufferedImage b = ImageIO.read(MainFrame.class.getResource("/com/titan/image/titanLogo.png"));
    //         Image i = b.getScaledInstance((int) (b.getWidth() * 0.6), (int) (b.getHeight() * 0.6), Image.SCALE_SMOOTH);
    logoLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/titanLogo.png")));
    //      } catch (IOException e1) {
    //         e1.printStackTrace();
    //      }
    //      logoLabel.setMaximumSize(new Dimension(150, 150));

    JPanel controlPanel = new JPanel();
    controlPanel.setBackground(new Color(239, 249, 255));
    controlPanel.setOpaque(true);
    panel.add(controlPanel, BorderLayout.CENTER);
    controlPanel.setLayout(new BorderLayout());

    JScrollPane computeScrollPane = new JScrollPane();
    tabbedPane.addTab("Compute", computeScrollPane);
    controlPanel.add(tabbedPane, BorderLayout.CENTER);

    serverTree = new JTree();
    serverTree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            //            Object obj = mainContentPanel.getComponent(0);
            //            if (obj instanceof VMMainPanel) {
            //               ((MainPanel) obj).refresh();
            //            }
        }
    });
    serverTree.setModel(computeTreeModel);
    serverTree.setCellRenderer(new ZoneTreeRenderer());
    serverTree.setRootVisible(false);
    computeScrollPane.setViewportView(serverTree);
    updateComputeTree();

    JScrollPane zoneScrollPane = new JScrollPane();
    tabbedPane.addTab("Zone", zoneScrollPane);

    zoneTree = new JTree();
    zoneTree.setModel(zoneTreeModel);
    zoneTree.setCellRenderer(new ZoneTreeRenderer());
    zoneScrollPane.setViewportView(zoneTree);
    updateZoneTree();
    splitPane.setLeftComponent(panel);

    splitPane.setRightComponent(mainContentPanel);
    mainContentPanel.setLayout(new BorderLayout(0, 0));

    welcomePanel = new WelcomePanel();
    mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
    welcomePanel.setLayout(new BorderLayout(0, 0));
    welcomePanel.add(mainScreenLabel, BorderLayout.CENTER);
    mainScreenLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/mainscreen.png")));

    JPanel panel_1 = new JPanel();
    welcomePanel.add(panel_1, BorderLayout.SOUTH);

    JButton licenseButton = new JButton("License");
    licenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InputStream in = MainFrame.class.getResourceAsStream("/com/titan/license.txt");
            try {
                LicenseDialog dialog = new LicenseDialog(MainFrame.this, IOUtils.toString(in));
                CommonLib.centerDialog(dialog);
                dialog.setVisible(true);
            } catch (IOException e1) {
                e1.printStackTrace();
            } finally {
                IOUtils.closeQuietly(in);
            }
        }
    });
    panel_1.add(licenseButton);

    ribbonPanel = new JPanel();
    contentPane.add(ribbonPanel, BorderLayout.NORTH);
    ribbonPanel.setLayout(new BorderLayout(0, 0));

    ribbonTabbedPane = new JTabbedPane(JTabbedPane.TOP);
    ribbonTabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            //            if (!windowOpened) {
            //               return;
            //            }
            String tab = ribbonTabbedPane.getTitleAt(ribbonTabbedPane.getSelectedIndex());
            if (tab.equals("Server")) {
                if (mainServerPanel == null || !mainServerPanel.serverPanel.jprogressBarDialog.isActive()) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            mainContentPanel.removeAll();
                            mainServerPanel = new MainServerPanel(MainFrame.this);
                            mainContentPanel.add(mainServerPanel, BorderLayout.CENTER);
                            mainContentPanel.updateUI();
                        }
                    });
                }
            } else if (tab.equals("VM")) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        mainContentPanel.removeAll();
                        mainContentPanel.add(new VMMainPanel(MainFrame.this), BorderLayout.CENTER);
                        mainContentPanel.updateUI();
                    }
                });
            } else if (tab.equals("Keystone")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new KeystonePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Flavor")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new FlavorPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Storage")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new StoragePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Network")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SDNPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Setting")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SettingPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            }
        }
    });
    ribbonTabbedPane.putClientProperty("type", "ribbonType");
    ribbonTabbedPane.setPreferredSize(new Dimension(1000, 140));
    ribbonPanel.add(ribbonTabbedPane, BorderLayout.CENTER);

    serverPanel = new JRibbonPanel();
    serverPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][grow][]", "[grow][grow][]"));
    ribbonTabbedPane.addTab("Server", null, serverPanel, null);

    logoutButton = new JRibbonBigButton("Logout");
    logoutButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            logout();
        }
    });

    rbnbgbtnAddServer = new JRibbonBigButton();
    rbnbgbtnAddServer.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnAddServer.setText("Add Server");
    serverPanel.add(rbnbgbtnAddServer, "cell 0 0 1 3,growy");

    rbnbgbtnDeleteServer = new JRibbonBigButton();
    rbnbgbtnDeleteServer
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    rbnbgbtnDeleteServer.setText("Delete Server");
    serverPanel.add(rbnbgbtnDeleteServer, "cell 1 0 1 3,growy");
    logoutButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/logout.png")));
    logoutButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logoutButton.setHorizontalTextPosition(SwingConstants.CENTER);
    serverPanel.add(logoutButton, "cell 14 0 1 3,growy");

    vmPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("VM", null, vmPanel, null);
    vmPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][][grow][]", "[grow][grow][]"));

    launchButton = new JRibbonBigButton("Launch");
    launchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new LaunchInstanceDialog(MainFrame.this).setVisible(true);
        }
    });
    launchButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/launch.png")));
    launchButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    launchButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(launchButton, "cell 0 0 1 3,growy");

    pauseButton = new JRibbonButton("Pause");
    pauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova pause");
        }
    });
    pauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    pauseButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_pause.png")));
    vmPanel.add(pauseButton, "cell 2 0,growx");

    stopButton = new JRibbonButton("Stop");
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova stop");
        }
    });
    stopButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/stop.png")));
    stopButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    stopButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(stopButton, "cell 1 0 1 3,growy");

    unpauseButton = new JRibbonButton("Unpause");
    unpauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova unpause");
        }
    });
    unpauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    unpauseButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_play.png")));

    suspendButton = new JRibbonButton("Suspend");
    suspendButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova suspend");
        }
    });
    suspendButton.setHorizontalAlignment(SwingConstants.LEFT);
    suspendButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/disk.png")));
    vmPanel.add(suspendButton, "cell 3 0,growx");

    softRebootButton = new JRibbonButton("Soft reboot");
    softRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova soft-reboot");
        }
    });
    softRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    softRebootButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_rotate_clockwise.png")));

    selectAllVMButton = new JRibbonButton("Select all");
    selectAllVMButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.selectAll();
        }
    });
    vmPanel.add(selectAllVMButton, "cell 4 0,growx");
    vmPanel.add(softRebootButton, "cell 9 0,growx");

    createMacroButton = new JRibbonButton("Create macro");
    createMacroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    createMacroButton.setHorizontalAlignment(SwingConstants.LEFT);

    setGroupNameButton = new JRibbonButton("Set group name");
    setGroupNameButton.setHorizontalAlignment(SwingConstants.LEFT);
    setGroupNameButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.setGroupName();
        }
    });
    vmPanel.add(setGroupNameButton, "cell 10 0");
    vmPanel.add(createMacroButton, "cell 13 0,growx");

    ribbonSeparator_3 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_3, "cell 14 0 1 3,growy");
    vmPanel.add(unpauseButton, "cell 2 1,growx");

    remoteButton = new JRibbonButton("Remote");
    remoteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.remote();
        }
    });
    remoteButton.setHorizontalAlignment(SwingConstants.LEFT);
    remoteButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_osx_terminal.png")));

    unselectAllButton = new JRibbonButton("Unselect all");
    unselectAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.unselectAll();
        }
    });
    vmPanel.add(unselectAllButton, "cell 4 1,growx");
    vmPanel.add(remoteButton, "cell 2 2,growx");

    performanceMeterButton = new JRibbonButton("Performance meter");
    performanceMeterButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_curve.png")));
    performanceMeterButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(performanceMeterButton, "cell 13 1,growx");

    resumeButton = new JRibbonButton("Resume");
    resumeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova resume");
        }
    });
    resumeButton.setHorizontalAlignment(SwingConstants.LEFT);
    resumeButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/drive_disk.png")));
    vmPanel.add(resumeButton, "cell 3 1,growx");

    deleteButton = new JRibbonBigButton("Delete");
    deleteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova delete");
        }
    });
    vmPanel.add(deleteButton, "cell 7 0 1 3,alignx center,growy");
    deleteButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteButton.setHorizontalTextPosition(SwingConstants.CENTER);

    logButton = new JRibbonBigButton("Log");
    logButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.log();
        }
    });
    vmPanel.add(logButton, "cell 6 0 1 3,alignx center,growy");
    logButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/log.png")));
    logButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logButton.setHorizontalTextPosition(SwingConstants.CENTER);

    hardRebootButton = new JRibbonButton("Hard reboot");
    hardRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova hard-reboot");
        }
    });
    hardRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    hardRebootButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_undo.png")));

    ribbonSeparator = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator, "cell 5 0 1 3,alignx center,growy");

    ribbonSeparator_1 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_1, "cell 8 0 1 3,alignx center,growy");
    vmPanel.add(hardRebootButton, "cell 9 1,growx");

    ribbonSeparator_2 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_2, "cell 11 0 1 3,grow");

    macroButton = new JRibbonBigButton("Macro");
    macroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/code.png")));
    macroButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    macroButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(macroButton, "cell 12 0 1 3,growy");

    snapshotButton = new JRibbonButton("Snapshot");
    snapshotButton.setHorizontalAlignment(SwingConstants.LEFT);
    snapshotButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/application_cascade.png")));
    vmPanel.add(snapshotButton, "cell 3 2,growx");

    advanceButton = new JRibbonButton("Advance");
    advanceButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    advanceButton.setHorizontalAlignment(SwingConstants.LEFT);
    advanceButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_view_detail.png")));
    vmPanel.add(advanceButton, "cell 9 2,growx");

    executionMapButton = new JRibbonButton("Execution map");
    executionMapButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_organisation.png")));
    executionMapButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(executionMapButton, "cell 13 2,growx");

    keystonePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Keystone", null, keystonePanel, null);
    keystonePanel.setLayout(new MigLayout("", "[][][][][][][][][][]", "[grow][][][][]"));

    addUserButton = new JRibbonBigButton("Add user");
    addUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addUser();
        }
    });
    addUserButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addUserButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addUser.png")));
    keystonePanel.add(addUserButton, "cell 0 0 1 3,growy");

    editUserButton = new JRibbonButton("Edit user");
    editUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    editUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    keystonePanel.add(editUserButton, "cell 1 0,growx");

    changePasswordButton = new JRibbonButton("Change password");
    keystonePanel.add(changePasswordButton, "cell 2 0");

    ribbonSeparator_4 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_4, "cell 3 0 1 3,growy");

    addRoleButton = new JRibbonBigButton("Add role");
    addRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addRole();
        }
    });
    addRoleButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addRoleButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addRole.png")));
    keystonePanel.add(addRoleButton, "cell 4 0 1 3,growy");

    deleteUserButton = new JRibbonButton("Delete user");
    deleteUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    deleteUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    deleteUserButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));

    editRoleButton = new JRibbonButton("Edit role");
    editRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    editRoleButton.setHorizontalAlignment(SwingConstants.LEFT);
    keystonePanel.add(editRoleButton, "cell 5 0,growx");

    ribbonSeparator_5 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_5, "cell 6 0 1 3,growy");

    createTenantButton = new JRibbonBigButton("Create tenant");
    createTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.createTenant();
        }
    });
    createTenantButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    createTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    createTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(createTenantButton, "cell 7 0 1 3,growy");

    deleteTenantButton = new JRibbonBigButton("Delete tenant");
    deleteTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteTenant();
        }
    });
    deleteTenantButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(deleteTenantButton, "cell 8 0 1 3,growy");
    keystonePanel.add(deleteUserButton, "cell 1 1,growx");

    detailUserButton = new JRibbonButton("Detail user");
    detailUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.showUserDetail();
        }
    });
    detailUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    detailUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    keystonePanel.add(detailUserButton, "cell 1 2,growx");

    btnDeleteRole = new JRibbonButton("Delete role");
    btnDeleteRole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteRole();
        }
    });
    btnDeleteRole.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    keystonePanel.add(btnDeleteRole, "cell 5 1,growx");

    assignRoleButton = new JRibbonButton("Assign role");
    assignRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.assignRole();
        }
    });
    assignRoleButton.setSelectedIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/user_add.png")));
    keystonePanel.add(assignRoleButton, "cell 5 2,growx");

    lblUser = new JRibbonLabel("user");
    keystonePanel.add(lblUser, "cell 0 3 2 1,growx");

    rbnlblRole = new JRibbonLabel("role");
    keystonePanel.add(rbnlblRole, "cell 4 3 2 1,growx");

    rbnlblTenant = new JRibbonLabel();
    rbnlblTenant.setText("tenant");
    keystonePanel.add(rbnlblTenant, "cell 7 3 2 1,growx");

    flavorPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Flavor", null, flavorPanel, null);
    flavorPanel.setLayout(new MigLayout("", "[][]", "[grow][][][]"));

    rbnbgbtnCreateFlavor = new JRibbonBigButton();
    rbnbgbtnCreateFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnCreateFlavor.setText("Create Flavor");
    flavorPanel.add(rbnbgbtnCreateFlavor, "cell 0 0 1 3,growy");

    btnDeleteFlavor = new JRibbonBigButton("Delete Flavor");
    btnDeleteFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    flavorPanel.add(btnDeleteFlavor, "cell 1 0 1 3,growy");

    storagePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Storage", null, storagePanel, null);
    storagePanel.setLayout(new MigLayout("", "[][][][][][]", "[grow][][][]"));

    uploadImageButton = new JRibbonBigButton("Upload");
    uploadImageButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    uploadImageButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    uploadImageButton.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(uploadImageButton, "cell 0 0 1 3, growy");

    btnDelete = new JRibbonButton("Delete");
    btnDelete.setHorizontalAlignment(SwingConstants.LEFT);
    btnDelete.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    storagePanel.add(btnDelete, "cell 1 0,growx");

    ribbonSeparator_6 = new JRibbonSeparator();
    storagePanel.add(ribbonSeparator_6, "cell 2 0 1 3,grow");

    btnCreateVolume = new JRibbonBigButton("Create volume");
    btnCreateVolume.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    btnCreateVolume.setVerticalTextPosition(SwingConstants.BOTTOM);
    btnCreateVolume.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(btnCreateVolume, "cell 3 0 1 3,growy");

    btnDelete_1 = new JRibbonButton("Delete");
    btnDelete_1.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDelete_1.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDelete_1, "cell 4 0,growx");

    btnAttach = new JRibbonButton("Attach to vm");
    btnAttach.setHorizontalAlignment(SwingConstants.LEFT);
    btnAttach.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/attach.png")));
    storagePanel.add(btnAttach, "cell 5 0,growx");

    btnChangeName = new JRibbonButton("Change name");
    btnChangeName.setHorizontalAlignment(SwingConstants.LEFT);
    btnChangeName.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    storagePanel.add(btnChangeName, "cell 1 1,growx");

    btnDetail = new JRibbonButton("Detail");
    btnDetail.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    btnDetail.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDetail, "cell 4 1,growx");

    btnDetachToVm = new JRibbonButton("Detach to vm");
    btnDetachToVm.setHorizontalAlignment(SwingConstants.LEFT);
    btnDetachToVm.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/delete.png")));
    storagePanel.add(btnDetachToVm, "cell 5 1,growx");

    btnPublicprivate = new JRibbonButton("public/private");
    btnPublicprivate.setHorizontalAlignment(SwingConstants.LEFT);
    btnPublicprivate.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/tick.png")));
    storagePanel.add(btnPublicprivate, "cell 1 2,growx");

    btnAddVolumeType = new JRibbonButton("Add volume type");
    btnAddVolumeType.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    btnAddVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnAddVolumeType, "cell 4 2");

    btnDeleteVolumeType = new JRibbonButton("Delete volume type");
    btnDeleteVolumeType
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDeleteVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDeleteVolumeType, "cell 5 2");

    rbnlblImage = new JRibbonLabel();
    rbnlblImage.setText("Image");
    storagePanel.add(rbnlblImage, "cell 0 3 2 1,growx");

    rbnlblVolume = new JRibbonLabel();
    rbnlblVolume.setText("Volume");
    storagePanel.add(rbnlblVolume, "cell 3 3 3 1,growx");

    networkPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Network", null, networkPanel, null);

    settingPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Setting", null, settingPanel, null);
    settingPanel.setLayout(new MigLayout("", "[][][]", "[grow][grow][]"));

    rbnbgbtnSystemSetting = new JRibbonBigButton();
    rbnbgbtnSystemSetting
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/systemSetting.png")));
    rbnbgbtnSystemSetting.setText("System Setting");
    settingPanel.add(rbnbgbtnSystemSetting, "cell 0 0 1 3,growy");

    rbnbgbtnDatabase = new JRibbonBigButton();
    rbnbgbtnDatabase
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/database.png")));
    rbnbgbtnDatabase.setText("Database");
    settingPanel.add(rbnbgbtnDatabase, "cell 1 0 1 3,growy");

    rbnbtnAddGroup = new JRibbonButton();
    rbnbtnAddGroup.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    rbnbtnAddGroup.setText("Add Group");
    settingPanel.add(rbnbtnAddGroup, "cell 2 0");

    rbnbtnEditGroup = new JRibbonButton();
    rbnbtnEditGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    rbnbtnEditGroup.setText("Edit Group");
    settingPanel.add(rbnbtnEditGroup, "cell 2 1");

    rbnbtnDeleteGroup = new JRibbonButton();
    rbnbtnDeleteGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    rbnbtnDeleteGroup.setText("Delete Group");
    settingPanel.add(rbnbtnDeleteGroup, "cell 2 2");

    logoPanel = new JRibbonPanel();
    ribbonPanel.add(logoPanel, BorderLayout.WEST);
    logoPanel.setLayout(new BorderLayout(0, 0));
    logoPanel.add(logoLabel, BorderLayout.CENTER);

    setLocationRelativeTo(null);

    new Thread(new TitanServerUpdateThread()).start();
}

From source file:tvbrowser.ui.mainframe.MainFrame.java

public void updateToolbar() {
    JPanel contentPane = (JPanel) getContentPane();

    if (mToolBarPanel != null) {
        contentPane.remove(mToolBarPanel);
    }//w  w  w .  j  a  v  a 2s.  com

    mToolBarModel = DefaultToolBarModel.getInstance();
    mToolBar = new ToolBar(mToolBarModel);
    mToolBar.setOpaque(false);

    String location = mToolBar.getToolbarLocation();

    if (Settings.propIsToolbarVisible.getBoolean()) {
        if (mToolBarPanel == null) {
            mToolBarPanel = new JPanel(new BorderLayout()) {
                public void updateUI() {
                    super.updateUI();
                    setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, getBackground().darker()));
                }
            };
            addContextMenuMouseListener(mToolBarPanel);
            mSearchField = new SearchField();
        } else {
            mToolBarPanel.removeAll();
        }

        if (location.compareTo(BorderLayout.NORTH) == 0) {
            mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.CENTER);
            if (Settings.propIsSearchFieldVisible.getBoolean()) {
                mToolBarPanel.add(mSearchField, BorderLayout.EAST);
            }
        } else {
            mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.WEST);
            if (Settings.propIsSearchFieldVisible.getBoolean()) {
                mToolBarPanel.add(mSearchField, BorderLayout.SOUTH);
            }
        }

        contentPane.add(mToolBarPanel, location);
    }

    contentPane.invalidate();
    contentPane.updateUI();
}