Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

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

private JPanel createGraphTitlePane() {
    JPanel titleNamePane = new JPanel(new BorderLayout());
    syncWithName.setFont(new Font("SansSerif", Font.PLAIN, 10));
    titleNamePane.add(graphTitle, BorderLayout.CENTER);
    titleNamePane.add(syncWithName, BorderLayout.EAST);

    JPanel titleStylePane = new JPanel();
    titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
            titleFontNameList));//from  w  ww  .  j a  va2s . c  o m
    titleFontNameList.setSelectedIndex(0); // default: sans serif
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
            titleFontSizeList));
    titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[6]); // default: 16
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
            titleFontStyleList));
    titleFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.bold")); // $NON-NLS-1$ // default: bold

    JPanel titlePane = new JPanel(new BorderLayout());
    titlePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_title_group"))); // $NON-NLS-1$
    titlePane.add(titleNamePane, BorderLayout.NORTH);
    titlePane.add(titleStylePane, BorderLayout.SOUTH);
    return titlePane;
}

From source file:org.pentaho.reporting.ui.datasources.mondrian.MondrianDataSourceEditor.java

private JPanel createQueryListPanel() {
    // Create the query list panel
    final RemoveQueryAction queryRemoveAction = new RemoveQueryAction();
    dialogModel.addPropertyChangeListener(queryRemoveAction);

    final JPanel theQueryButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    theQueryButtonsPanel.add(new BorderlessButton(new AddQueryAction()));
    theQueryButtonsPanel.add(new BorderlessButton(queryRemoveAction));

    final JPanel theQueryControlsPanel = new JPanel(new BorderLayout());
    theQueryControlsPanel.add(new JLabel(Messages.getString("MondrianDataSourceEditor.AvailableQueriesLabel")),
            BorderLayout.WEST);//from www .  java 2 s. c  om
    theQueryControlsPanel.add(theQueryButtonsPanel, BorderLayout.EAST);

    final JPanel queryListPanel = new JPanel(new BorderLayout());
    queryListPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
    queryListPanel.add(BorderLayout.NORTH, theQueryControlsPanel);
    queryListPanel.add(BorderLayout.CENTER, new JScrollPane(queryNameList));
    return queryListPanel;
}

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

private JPanel createGraphTitlePane() {
    JPanel titleNamePane = new JPanel(new BorderLayout());
    syncWithName.setFont(FONT_SMALL);// w  w  w  . jav a  2  s .c o m
    titleNamePane.add(graphTitle, BorderLayout.CENTER);
    titleNamePane.add(syncWithName, BorderLayout.EAST);

    JPanel titleStylePane = new JPanel();
    titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
            titleFontNameList));
    titleFontNameList.setSelectedIndex(DEFAULT_TITLE_FONT_NAME);
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
            titleFontSizeList));
    titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[DEFAULT_TITLE_FONT_SIZE]);
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
            titleFontStyleList));
    titleFontStyleList.setSelectedIndex(DEFAULT_TITLE_FONT_STYLE);

    JPanel titlePane = new JPanel(new BorderLayout());
    titlePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_title_group"))); // $NON-NLS-1$
    titlePane.add(titleNamePane, BorderLayout.NORTH);
    titlePane.add(titleStylePane, BorderLayout.SOUTH);
    return titlePane;
}

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

private JPanel createQueryScriptTab() {
    final JPanel queryHeader2 = new JPanel(new BorderLayout());
    queryHeader2.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryScript")), BorderLayout.CENTER);
    queryHeader2.add(new JButton(queryTemplateAction), BorderLayout.EAST);

    final JPanel queryScriptHeader = new JPanel(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
    queryScriptHeader.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryScriptLanguage")));
    queryScriptHeader.add(queryLanguageField);
    queryScriptHeader.add(queryHeader2);

    final JPanel queryScriptContentHolder = new JPanel(new BorderLayout());
    queryScriptContentHolder.add(queryScriptHeader, BorderLayout.NORTH);
    queryScriptContentHolder.add(new RTextScrollPane(700, 300, queryScriptTextArea, true), BorderLayout.CENTER);
    return queryScriptContentHolder;
}

From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryBldrPane.java

/**
 * create the query builder UI./*from   w  w  w  .  j  av  a  2  s. c om*/
 */
protected void createUI() {
    removeAll();

    JMenuItem saveItem = new JMenuItem(UIRegistry.getResourceString("QB_SAVE"));
    Action saveActionListener = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (saveQuery(false)) {
                try {
                    String selId = null;
                    if (selectedQFP != null && selectedQFP.getQueryField() != null) {
                        selId = selectedQFP.getQueryField().getStringId();
                    }
                    final String selectedFldId = selId;
                    setupUI(true);
                    SwingUtilities.invokeLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            if (selectedFldId != null) {
                                for (QueryFieldPanel qfp : queryFieldItems) {
                                    if (qfp.getQueryField() != null
                                            && selectedFldId.equals(qfp.getQueryField().getStringId())) {
                                        selectQFP(qfp);
                                        return;
                                    }
                                }
                                selectQFP(queryFieldItems.get(0));
                            }
                        }

                    });
                } catch (Exception ex) {

                }
                setSaveBtnEnabled(false);
            }
        }
    };
    saveItem.addActionListener(saveActionListener);

    JMenuItem saveAsItem = new JMenuItem(UIRegistry.getResourceString("QB_SAVE_AS"));
    Action saveAsActionListener = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (saveQuery(true)) {
                setSaveBtnEnabled(false);
            }
        }
    };
    saveAsItem.addActionListener(saveAsActionListener);
    JComponent[] itemSample = { saveItem, saveAsItem };
    saveBtn = new DropDownButton(UIRegistry.getResourceString("QB_SAVE"), null, 1,
            java.util.Arrays.asList(itemSample));
    saveBtn.addActionListener(saveActionListener);
    String ACTION_KEY = "SAVE";
    KeyStroke ctrlS = KeyStroke.getKeyStroke(KeyEvent.VK_S,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    InputMap inputMap = saveBtn.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(ctrlS, ACTION_KEY);
    ActionMap actionMap = saveBtn.getActionMap();
    actionMap.put(ACTION_KEY, saveActionListener);
    ACTION_KEY = "SAVE_AS";
    KeyStroke ctrlA = KeyStroke.getKeyStroke(KeyEvent.VK_A,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    inputMap.put(ctrlA, ACTION_KEY);
    actionMap.put(ACTION_KEY, saveAsActionListener);
    saveBtn.setActionMap(actionMap);

    UIHelper.setControlSize(saveBtn);
    //saveBtn.setOverrideBorder(true, BasicBorders.getButtonBorder());

    listBoxPanel = new JPanel(new HorzLayoutManager(2, 2));

    Vector<TableQRI> list = new Vector<TableQRI>();
    for (int k = 0; k < tableTree.getKids(); k++) {
        list.add(tableTree.getKid(k).getTableQRI());
    }

    Collections.sort(list);
    DefaultListModel model = new DefaultListModel();
    for (TableQRI qri : list) {
        model.addElement(qri);
    }

    tableList = new JList(model);
    QryListRenderer qr = new QryListRenderer(IconManager.IconSize.Std16);
    qr.setDisplayKidIndicator(false);
    tableList.setCellRenderer(qr);

    JScrollPane spt = new JScrollPane(tableList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    Dimension pSize = spt.getPreferredSize();
    pSize.height = 200;
    spt.setPreferredSize(pSize);

    JPanel topPanel = new JPanel(new BorderLayout());

    scrollPane = new JScrollPane(listBoxPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    tableList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                int inx = tableList.getSelectedIndex();
                if (inx > -1) {
                    fillNextList(tableList);
                } else {
                    listBoxPanel.removeAll();
                }
            }
        }
    });

    addBtn = new JButton(IconManager.getImage("PlusSign", IconManager.IconSize.Std16));
    addBtn.setEnabled(false);
    addBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            BaseQRI qri = (BaseQRI) listBoxList.get(currentInx).getSelectedValue();
            if (qri.isInUse) {
                return;
            }

            try {
                FieldQRI fieldQRI = buildFieldQRI(qri);
                if (fieldQRI == null) {
                    throw new Exception("null FieldQRI");
                }
                SpQueryField qf = new SpQueryField();
                qf.initialize();
                qf.setFieldName(fieldQRI.getFieldName());
                qf.setStringId(fieldQRI.getStringId());
                query.addReference(qf, "fields");

                if (!isExportMapping) {
                    addQueryFieldItem(fieldQRI, qf, false);
                } else {
                    addNewMapping(fieldQRI, qf, null, false);
                }
            } catch (Exception ex) {
                log.error(ex);
                UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(QueryBldrPane.class, ex);
                return;
            }
        }
    });

    contextPanel = new JPanel(new BorderLayout());
    contextPanel.add(createLabel("Search Context", SwingConstants.CENTER), BorderLayout.NORTH); // I18N
    contextPanel.add(spt, BorderLayout.CENTER);
    contextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));

    JPanel schemaPanel = new JPanel(new BorderLayout());
    schemaPanel.add(scrollPane, BorderLayout.CENTER);

    topPanel.add(contextPanel, BorderLayout.WEST);
    topPanel.add(schemaPanel, BorderLayout.CENTER);
    add(topPanel, BorderLayout.NORTH);

    queryFieldsPanel = new JPanel();
    queryFieldsPanel.setLayout(new NavBoxLayoutManager(0, 2));
    queryFieldsScroll = new JScrollPane(queryFieldsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    queryFieldsScroll.setBorder(null);
    add(queryFieldsScroll);

    //if (!isExportMapping)
    //{
    final JPanel mover = buildMoverPanel(false);
    add(mover, BorderLayout.EAST);
    // }

    String searchLbl = schemaMapping == null ? getResourceString("QB_SEARCH")
            : getResourceString("QB_EXPORT_PREVIEW");
    searchBtn = createButton(searchLbl);
    searchBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            //               int m = ae.getModifiers();
            //               boolean ors = (m & ActionEvent.ALT_MASK) > 0 && (m & ActionEvent.CTRL_MASK) > 0 && (m & ActionEvent.SHIFT_MASK) > 0;
            //               if (ors)
            //               {
            //                  System.out.println("Disjunctional conjoinment desire gesture detected");
            //               }
            //               doSearch(ors);
            doSearch(false);
        }
    });
    distinctChk = createCheckBox(UIRegistry.getResourceString("QB_DISTINCT"));
    distinctChk.setVisible(schemaMapping == null);
    if (schemaMapping == null) {
        distinctChk.setSelected(false);
        distinctChk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                new SwingWorker() {

                    /* (non-Javadoc)
                     * @see edu.ku.brc.helpers.SwingWorker#construct()
                     */
                    @Override
                    public Object construct() {
                        if (distinctChk.isSelected()) {
                            UsageTracker.incrUsageCount("QB.DistinctOn");
                        } else {
                            UsageTracker.incrUsageCount("QB.DistinctOff");
                        }
                        if ((isTreeLevelSelected() || isAggFieldSelected()) && countOnly
                                && distinctChk.isSelected()) {
                            countOnlyChk.setSelected(false);
                            countOnly = false;
                        }
                        query.setCountOnly(countOnly);
                        query.setSelectDistinct(distinctChk.isSelected());
                        setSaveBtnEnabled(thereAreItems());
                        return null;
                    }
                }.start();
            }
        });
    }
    countOnlyChk = createCheckBox(UIRegistry.getResourceString("QB_COUNT_ONLY"));
    countOnlyChk.setSelected(false);
    countOnlyChk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            new SwingWorker() {

                /* (non-Javadoc)
                 * @see edu.ku.brc.helpers.SwingWorker#construct()
                 */
                @Override
                public Object construct() {
                    //Don't allow change while query is running.
                    if (runningResults.get() == null) {
                        countOnly = !countOnly;
                        if (countOnly) {
                            UsageTracker.incrUsageCount("QB.CountOnlyOn");
                        } else {
                            UsageTracker.incrUsageCount("QB.CountOnlyOff");
                        }
                        if ((isTreeLevelSelected() || isAggFieldSelected()) && countOnly
                                && (distinctChk.isSelected() || searchSynonymyChk.isSelected())) {
                            distinctChk.setSelected(false);
                            searchSynonymyChk.setSelected(false);
                        }
                    } else {
                        //This might be awkward and/or klunky...
                        countOnlyChk.setSelected(countOnly);
                    }
                    query.setCountOnly(countOnly);
                    query.setSelectDistinct(distinctChk.isSelected());
                    setSaveBtnEnabled(thereAreItems());
                    return null;
                }
            }.start();
        }
    });

    searchSynonymyChk = createCheckBox(UIRegistry.getResourceString("QB_SRCH_SYNONYMS"));
    searchSynonymyChk.setSelected(searchSynonymy);
    searchSynonymyChk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            new SwingWorker() {

                /* (non-Javadoc)
                 * @see edu.ku.brc.helpers.SwingWorker#construct()
                 */
                @Override
                public Object construct() {
                    searchSynonymy = !searchSynonymy;
                    if (!searchSynonymy) {
                        UsageTracker.incrUsageCount("QB.SearchSynonymyOff");
                    } else {
                        UsageTracker.incrUsageCount("QB.SearchSynonymyOn");
                    }
                    if (isTreeLevelSelected() && countOnly && searchSynonymyChk.isSelected()) {
                        countOnlyChk.setSelected(false);
                        countOnly = false;
                    }
                    query.setSearchSynonymy(searchSynonymy);
                    setSaveBtnEnabled(thereAreItems());
                    return null;
                }
            }.start();
        }
    });

    smushedChk = createCheckBox(UIRegistry.getResourceString("QB_SMUSH_RESULTS"));
    smushedChk.setVisible(isSmushableContext());
    if (isSmushableContext()) {
        smushedChk.setSelected(smushed);
        smushedChk.setToolTipText(
                String.format(UIRegistry.getResourceString("QB_SMUSH_RESULTS_HINT"), getCatalogNumberTitle()));
        smushedChk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                new SwingWorker() {

                    /*
                     * (non-Javadoc)
                     * 
                     * @see edu.ku.brc.helpers.SwingWorker#construct()
                     */
                    @Override
                    public Object construct() {
                        smushed = !smushed;
                        if (!smushed) {
                            UsageTracker.incrUsageCount("QB.SmushedOff");
                        } else {
                            UsageTracker.incrUsageCount("QB.SmushedOn");
                        }
                        query.setSmushed(smushed);
                        setSaveBtnEnabled(thereAreItems());
                        return null;
                    }
                }.start();
            }
        });
    }

    PanelBuilder outer = new PanelBuilder(
            new FormLayout("p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 6dlu, p", "p"));

    CellConstraints cc = new CellConstraints();
    outer.add(smushedChk, cc.xy(1, 1));
    outer.add(searchSynonymyChk, cc.xy(3, 1));
    outer.add(distinctChk, cc.xy(5, 1));
    outer.add(countOnlyChk, cc.xy(7, 1));
    outer.add(searchBtn, cc.xy(9, 1));
    outer.add(saveBtn, cc.xy(11, 1));

    JPanel bottom = new JPanel(new BorderLayout());
    bottom.add(outer.getPanel(), BorderLayout.EAST);

    JButton helpBtn = UIHelper.createHelpIconButton(getHelpBtnContext());
    bottom.add(helpBtn, BorderLayout.WEST);
    add(bottom, BorderLayout.SOUTH);

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}

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

private JPanel createGlobalScriptTab() {
    final JPanel globalHeader2 = new JPanel(new BorderLayout());
    globalHeader2.add(new JLabel(Messages.getString("JdbcDataSourceDialog.GlobalScript")), BorderLayout.CENTER);
    globalHeader2.add(new JButton(globalTemplateAction), BorderLayout.EAST);

    final JPanel globalScriptHeader = new JPanel(
            new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
    globalScriptHeader.add(new JLabel(Messages.getString("JdbcDataSourceDialog.GlobalScriptLanguage")));
    globalScriptHeader.add(globalLanguageField);
    globalScriptHeader.add(globalHeader2);

    final JPanel globalScriptContentHolder = new JPanel(new BorderLayout());
    globalScriptContentHolder.add(globalScriptHeader, BorderLayout.NORTH);
    globalScriptContentHolder.add(new RTextScrollPane(700, 600, globalScriptTextArea, true),
            BorderLayout.CENTER);
    return globalScriptContentHolder;
}

From source file:edu.ucla.stat.SOCR.analyses.gui.Survival.java

protected void setMappingPanel() {
    //////////////System.out.println("Survival mappingPanel = " + mappingPanel);
    listIndex = new int[dataTable.getColumnCount()];
    for (int j = 0; j < listIndex.length; j++)
        listIndex[j] = 1;/*from w  ww  .j a  va 2s.c  o m*/
    bPanel = new JPanel(new BorderLayout());
    mappingInnerPanel = new JPanel(new GridLayout(1, 3));
    mappingPanel.add(mappingInnerPanel, BorderLayout.CENTER);
    mappingInnerPanel.setBackground(Color.WHITE);

    addButton1.addActionListener(this);
    addButton2.addActionListener(this);
    addButton3.addActionListener(this);
    removeButton1.addActionListener(this);
    removeButton2.addActionListener(this);
    removeButton3.addActionListener(this);
    ////////////////System.out.println("Survival mappingPanel = " + mappingPanel);

    lModel1 = new DefaultListModel();
    lModel2 = new DefaultListModel();
    lModel3 = new DefaultListModel();
    lModel4 = new DefaultListModel();

    int cellWidth = 10;

    listAdded = new JList(lModel1);
    listAdded.setSelectedIndex(0);
    listTime = new JList(lModel2);
    listCensor = new JList(lModel3);
    listGroupNames = new JList(lModel4);

    paintTable(listIndex);
    listAdded.setFixedCellWidth(cellWidth);
    listTime.setFixedCellWidth(cellWidth);
    listCensor.setFixedCellWidth(cellWidth);
    listGroupNames.setFixedCellWidth(cellWidth);

    //tools1.setBackground(Color.RED);
    //tools2.setBackground(Color.GREEN);
    //tools3.setBackground(Color.BLUE);

    listAdded.setBackground(Color.WHITE);
    listTime.setBackground(Color.WHITE);
    listCensor.setBackground(Color.WHITE);
    listGroupNames.setBackground(Color.WHITE);

    tools1.add(timeLabel);
    tools2.add(censorLabel);
    tools3.add(groupNameLabel);

    tools1.add(addButton1);
    tools1.add(removeButton1);

    tools2.add(addButton2);
    tools2.add(removeButton2);

    tools3.add(addButton3);
    tools3.add(removeButton3);

    JPanel panelLeft = new JPanel(new GridLayout(3, 1, 50, 50));
    JPanel panelCenter = new JPanel(new GridLayout(3, 1, 50, 50));
    JPanel panelRight = new JPanel(new GridLayout(3, 1, 50, 50));
    //JPanel dummyPanelLeft1 = null;//new JPanel();
    //JPanel dummyPanelBottom = null;//new JPanel();
    //dummyPanelMiddle.setVisible(false);
    //dummyPanelBottom.setVisible(false);

    mappingInnerPanel.add(panelLeft, BorderLayout.WEST);
    mappingInnerPanel.add(panelCenter, BorderLayout.CENTER);
    mappingInnerPanel.add(panelRight, BorderLayout.EAST);

    panelLeft.add(new JScrollPane(listAdded)); // var cadidates.

    panelCenter.add(tools1);
    panelRight.add(new JScrollPane(listTime));

    panelCenter.add(tools2);
    panelRight.add(new JScrollPane(listCensor));

    panelCenter.add(tools3);
    panelRight.add(new JScrollPane(listGroupNames));
}

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;
        }//w w w.j  a va  2  s .  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:org.jcurl.demo.tactics.JCurlShotPlanner.java

@Override
protected void startup() {
    // set the window icon:
    {/*from ww  w  .  ja  va  2  s  .co m*/
        final Image img;
        if (true)
            img = getContext().getResourceMap().getImageIcon("Application.icon").getImage();
        else {
            final ResourceMap r = getContext().getResourceMap();
            if (true)
                try {
                    img = ImageIO.read(this.getClass()
                            .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon")));
                } catch (final IOException e) {
                    throw new RuntimeException("Unhandled", e);
                }
            else
                img = Toolkit.getDefaultToolkit().createImage(this.getClass()
                        .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon")));
        }
        getMainFrame().setIconImage(img);
        // SystemTray tray = SystemTray.getSystemTray();
    }

    // File Filter
    jcxzPat = gui.createFileFilter("fileFilterJcxz", "jcz", "jcx");
    pngPat = gui.createFileFilter("fileFilterPng", "png");
    svgPat = gui.createFileFilter("fileFilterSvg", "svgz", "svg");

    getMainFrame().setJMenuBar(createMenuBar());

    final JComponent c = new JPanel();
    c.setLayout(new BorderLayout());
    tactics.setPreferredSize(new Dimension(400, 600));
    c.add(tactics, BorderLayout.CENTER);
    c.add(url, BorderLayout.NORTH);
    {
        final JPanel b = new JPanel();
        b.setLayout(new BorderLayout());
        final JTabbedPane t = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
        t.add("Rock", broomSwing);
        t.setMnemonicAt(0, 'R');
        t.add("Ice", curlerSwing);
        t.setMnemonicAt(1, 'I');
        t.add("Collission", new JLabel("TODO: Collission settings"));
        t.setMnemonicAt(2, 'C');
        b.add(t, BorderLayout.NORTH);
        if (false)
            b.add(new JLabel("TODO: Bird's eye view"), BorderLayout.CENTER);
        else
            b.add(birdPiccolo, BorderLayout.CENTER);
        c.add(b, BorderLayout.EAST);
    }

    show(c);
    view12Foot();
}

From source file:op.controlling.PnlControlling.java

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

    /***/*from w  ww  . j a va  2 s. c o m*/
     *      ____  _         __  __
     *     / ___|| |_ __ _ / _|/ _|
     *     \___ \| __/ _` | |_| |_
     *      ___) | || (_| |  _|  _|
     *     |____/ \__\__,_|_| |_|
     *
     */
    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;
}