Example usage for javax.swing JTabbedPane add

List of usage examples for javax.swing JTabbedPane add

Introduction

In this page you can find the example usage for javax.swing JTabbedPane add.

Prototype

public void add(Component component, Object constraints) 

Source Link

Document

Adds a component to the tabbed pane.

Usage

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

private void addGenericTab(JTabbedPane tabbedPane) {
    GridBagLayout gridBagLayout = new GridBagLayout();
    JPanel dataPanel = new JPanel(gridBagLayout);
    JPanel genericPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tabbedPane.add("Generic", new JScrollPane(genericPanel));
    genericPanel.add(dataPanel);//from  ww  w . j  a  v a2s  .c  o m

    GridBagConstraints constraints = new GridBagConstraints();

    JLabel schemeNameLabel = new JLabel("Scheme Name");
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.ipadx = 10;
    dataPanel.add(schemeNameLabel, constraints);
    JLabel schemeName = new JLabel(this.trustServiceList.getSchemeName());
    constraints.gridx++;
    dataPanel.add(schemeName, constraints);

    JLabel schemeOperatorNameLabel = new JLabel("Scheme Operator Name");
    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(schemeOperatorNameLabel, constraints);
    JLabel schemeOperatorName = new JLabel(this.trustServiceList.getSchemeOperatorName());
    constraints.gridx++;
    dataPanel.add(schemeOperatorName, constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Type"), constraints);
    constraints.gridx++;
    dataPanel.add(
            new JLabel(this.trustServiceList.getType()
                    .substring(this.trustServiceList.getType().indexOf("TSLType/") + "TSLType/".length())),
            constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Sequence number"), constraints);
    constraints.gridx++;
    dataPanel.add(new JLabel(this.trustServiceList.getSequenceNumber().toString()), constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Issue date"), constraints);
    constraints.gridx++;
    dataPanel.add(new JLabel(this.trustServiceList.getIssueDate().toString()), constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("Next update"), constraints);
    constraints.gridx++;
    dataPanel.add(new JLabel(this.trustServiceList.getNextUpdate().toString()), constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("TSL SHA1 fingerprint"), constraints);
    constraints.gridx++;
    dataPanel.add(new JLabel(getSha1Fingerprint()), constraints);

    constraints.gridy++;
    constraints.gridx = 0;
    dataPanel.add(new JLabel("TSL SHA256 fingerprint"), constraints);
    constraints.gridx++;
    dataPanel.add(new JLabel(getSha256Fingerprint()), constraints);
}

From source file:org.eumetsat.metop.visat.SounderInfoView.java

@Override
protected JComponent createControl() {
    overlayListener = new SounderOverlayListener() {
        @Override/*www .ja  va  2s .  com*/
        public void selectionChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }

        @Override
        public void dataChanged(SounderOverlay overlay) {
            updateUI(overlay);
        }
    };
    internalFrameListener = new InternalFrameAdapter() {
        @Override
        public void internalFrameActivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);

                if (layer != null) {
                    layerChanged(layer);
                } else {
                    final LayerListener layerListener = new AbstractLayerListener() {
                        @Override
                        public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) {
                            final SounderLayer layer = getSounderLayer(view);
                            if (layer != null) {
                                layerChanged(layer);
                                view.getRootLayer().removeListener(this);
                            }
                        }
                    };
                    view.getRootLayer().addListener(layerListener);
                }
            }
        }

        @Override
        public void internalFrameDeactivated(final InternalFrameEvent e) {
            final Container contentPane = e.getInternalFrame().getContentPane();
            if (contentPane instanceof ProductSceneView) {
                final ProductSceneView view = (ProductSceneView) contentPane;
                final SounderLayer layer = getSounderLayer(view);
                if (layer != null) {
                    layer.getOverlay().removeListener(overlayListener);
                }
            }
        }

        @Override
        public void internalFrameClosed(InternalFrameEvent e) {
            if (getSounderLayer() == null) {
                clearUI();
                editor.setModel(null);
            }
        }
    };
    VisatApp.getApp().addInternalFrameListener(internalFrameListener);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("Sounder Info", createInfoComponent());
    tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent());
    tabbedPane.add("Sounder Layer", createSounderLayerComponent());

    final SounderLayer layer = getSounderLayer();
    if (layer != null) {
        layerChanged(layer);
    }

    final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"),
            false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId());
    }

    final JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(tabbedPane, BorderLayout.CENTER);
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(helpButton, BorderLayout.EAST);
    containerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return containerPanel;
}

From source file:gui.QTLResultsPanel.java

/** QTLResultsPanel().
 * //from w w  w.j a  v a 2s  . c o m
 * @param qtlResult = the QTL results to show.
 * @param order = the ordered result data this QTL was created from. 
 */
public QTLResultsPanel(QTLResult qtlResult, OrderedResult order) {
    this.qtlResult = qtlResult;
    this.order = order;

    // Trait listbox
    traitModel = new DefaultListModel<Trait>();
    for (Trait trait : qtlResult.getTraits()) {
        traitModel.addElement(trait);
    }
    traitList = new JList<Trait>(traitModel);
    traitList.addListSelectionListener(this);
    traitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane sp1 = new JScrollPane(traitList);
    sp1.setPreferredSize(new Dimension(125, 50));

    // Details text box
    details = new JTextArea();
    details.setFont(new Font("Monospaced", Font.PLAIN, 11));
    details.setMargin(new Insets(2, 5, 2, 5));
    details.setEditable(false);
    details.setTabSize(6);
    JScrollPane sp4;
    if (AppFrame.tpmmode == AppFrame.TPMMODE_QTL) {
        simpleDetails = new JScrollPane();
        simpleDetails.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simplesplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        simpleright = new JTextArea();
        simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simpleright.setMargin(new Insets(2, 5, 2, 5));
        simpleright.setEditable(false);
        simpleright.setTabSize(6);
        simplesplit.setRightComponent(new JScrollPane(simpleright));

        simplesplit.setLeftComponent(simpleDetails);
        sp4 = new JScrollPane(simplesplit);
    } else {
        // TPM MODE NONSNP
        simpleright = new JTextArea();
        simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simpleright.setMargin(new Insets(2, 5, 2, 5));
        simpleright.setEditable(false);
        sp4 = new JScrollPane(simpleright);
    }

    lodDetails = new JTextArea();
    lodDetails.setFont(new Font("Monospaced", Font.PLAIN, 11));
    lodDetails.setMargin(new Insets(2, 5, 2, 5));
    lodDetails.setEditable(false);
    lodDetails.setTabSize(6);
    JScrollPane sp3 = new JScrollPane(lodDetails);
    JTabbedPane tabs = new JTabbedPane();
    JScrollPane sp2 = new JScrollPane(details);
    tabs.add(sp2, "Full Model");
    tabs.add(sp4, "Simple Model");
    tabs.add(sp3, "LOD Details");

    // The splitpane
    splits = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splits.setTopComponent(new JPanel());
    splits.setBottomComponent(tabs);
    splits.setResizeWeight(0.5);

    // pane2
    JSplitPane splits2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splits2.setLeftComponent(sp1);
    splits2.setRightComponent(splits);

    setLayout(new BorderLayout());
    add(new GradientPanel("QTL Analysis Results"), BorderLayout.NORTH);
    // add(sp1, BorderLayout.WEST);
    // add(splits);
    add(splits2);
    add(toolbar = new QTLResultsToolBar(this), BorderLayout.EAST);
}

From source file:net.sf.jabref.gui.plaintextimport.TextInputDialog.java

private void jbInit() {
    getContentPane().setLayout(new BorderLayout());
    StringBuilder typeStr = new StringBuilder("Plain text import");
    if (entry.getType() != null) {
        typeStr.append(' ').append(Localization.lang("for")).append(' ').append(entry.getType());
    }/* w  w w . j  a v a2  s  .  co m*/

    this.setTitle(typeStr.toString());
    getContentPane().add(panel1, BorderLayout.CENTER);

    initRawPanel();
    initButtonPanel();
    initSourcePanel();

    JTabbedPane tabbed = new JTabbedPane();

    tabbed.add(rawPanel, Localization.lang("Raw source"));
    tabbed.add(sourcePanel, Localization.lang("BibTeX source"));

    // Panel Layout
    panel1.setLayout(new BorderLayout());
    panel1.add(tabbed, BorderLayout.CENTER);
    panel1.add(buttons, BorderLayout.SOUTH);

    // Key bindings:
    ActionMap am = buttons.getActionMap();
    InputMap im = buttons.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
    am.put("close", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
}

From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java

/**
 * Create the frame.//from w w w.j a  va 2 s.c  om
 */
public DashboardPC() {

    myRulePanelMap = new HashMap<String, JPanel>();

    setResizable(false);
    setTitle("Home Life Context");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 583, 478);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    ruleTabContent = new JPanel();
    ruleTabContent.setBackground(SystemColor.control);
    ruleTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    ruleTabContent.setLayout(null);

    nodeTabContent = new JPanel();
    nodeTabContent.setBackground(SystemColor.control);
    nodeTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    nodeTabContent.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 11, 557, 422);
    tabbedPane.add("Rules", ruleTabContent);
    tabbedPane.setEnabledAt(0, true);

    rulesContent = new JPanel();
    int initialWidth = 2 * rulePanel_width + interCellSpace;
    int initialHeight = rulePanel_height;
    rulesContent.setBounds(10, 11, initialWidth, initialHeight);
    //ruleTabContent.add(rulesContent);
    rulesContent.setLayout(new GridLayout(0, 2, interCellSpace, interCellSpace));

    scrollRuleList = new JScrollPane(rulesContent);
    scrollRuleList.setBounds(1, 1, scrollArea_maxWidth, initialHeight);
    ruleTabContent.add(scrollRuleList);

    tabbedPane.add("Nodes", nodeTabContent);
    tabbedPane.setEnabledAt(1, true);
    contentPane.add(tabbedPane);

    /*
    // small rule panel
            
    JPanel panelRule = new JPanel();
    rulesContent.add(panelRule);
    panelRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule.setLayout(null);
            
    JPanel rulePanelServicePhoto = new JPanel();
    rulePanelServicePhoto.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto.setBounds(10, 16, 27, 27);
    panelRule.add(rulePanelServicePhoto);
            
    JLabel ruleLblServiceName = new JLabel("Service friendly name");
    ruleLblServiceName.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName.setForeground(new Color(100, 149, 237));
    ruleLblServiceName.setBounds(47, 11, 212, 18);
    panelRule.add(ruleLblServiceName);
            
    JLabel ruleLblIf = new JLabel("IF");
    ruleLblIf.setForeground(Color.GRAY);
    ruleLblIf.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf.setBounds(10, 49, 27, 35);
    panelRule.add(ruleLblIf);
            
    JLabel ruleLblConditionParam = new JLabel("Condition parameter");
    ruleLblConditionParam.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam.setForeground(Color.GRAY);
    ruleLblConditionParam.setBounds(47, 49, 192, 35);
    panelRule.add(ruleLblConditionParam);
            
    JLabel ruleLblOnDevice = new JLabel("on device name");
    ruleLblOnDevice.setForeground(Color.GRAY);
    ruleLblOnDevice.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice.setBounds(47, 29, 212, 14);
    panelRule.add(ruleLblOnDevice);
            
    // small add rule panel
            
    JPanel panelAddRule = new JPanel();
    rulesContent.add(panelAddRule);
    panelAddRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelAddRule.setLayout(null);
            
    JLabel addRuleLbl = new JLabel("Configure new rule");
    addRuleLbl.setHorizontalAlignment(SwingConstants.CENTER);
    addRuleLbl.setForeground(new Color(169, 169, 169));
    addRuleLbl.setFont(new Font("Arial", Font.BOLD, 13));
    addRuleLbl.setBounds(10, 25, 229, 27);
    panelAddRule.add(addRuleLbl);
            
    JButton addRuleBtn = new JButton("+");
    addRuleBtn.setForeground(new Color(128, 128, 128));
    addRuleBtn.setBounds(100, 57, 41, 23);
    panelAddRule.add(addRuleBtn);
     */
}

From source file:com.net2plan.gui.tools.GUINetworkDesign.java

@Override
public void configure(JPanel contentPane) {
    this.currentNetPlan = new NetPlan();

    BidiMap<NetworkLayer, Integer> mapLayer2VisualizationOrder = new DualHashBidiMap<>();
    Map<NetworkLayer, Boolean> layerVisibilityMap = new HashMap<>();
    for (NetworkLayer layer : currentNetPlan.getNetworkLayers()) {
        mapLayer2VisualizationOrder.put(layer, mapLayer2VisualizationOrder.size());
        layerVisibilityMap.put(layer, true);
    }/*from  ww w  . j  av a2  s . co  m*/
    this.vs = new VisualizationState(currentNetPlan, mapLayer2VisualizationOrder, layerVisibilityMap,
            MAXSIZEUNDOLISTPICK);

    topologyPanel = new TopologyPanel(this, JUNGCanvas.class);

    JPanel leftPane = new JPanel(new BorderLayout());
    JPanel logSection = configureLeftBottomPanel();
    if (logSection == null) {
        leftPane.add(topologyPanel, BorderLayout.CENTER);
    } else {
        JSplitPane splitPaneTopology = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        splitPaneTopology.setTopComponent(topologyPanel);
        splitPaneTopology.setBottomComponent(logSection);
        splitPaneTopology.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener());
        splitPaneTopology.setBorder(new LineBorder(contentPane.getBackground()));
        splitPaneTopology.setOneTouchExpandable(true);
        splitPaneTopology.setDividerSize(7);
        leftPane.add(splitPaneTopology, BorderLayout.CENTER);
    }
    contentPane.add(leftPane, "grow");

    viewEditTopTables = new ViewEditTopologyTablesPane(GUINetworkDesign.this, new BorderLayout());

    reportPane = new ViewReportPane(GUINetworkDesign.this, JSplitPane.VERTICAL_SPLIT);

    setCurrentNetPlanDoNotUpdateVisualization(currentNetPlan);
    Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> res = VisualizationState
            .generateCanvasDefaultVisualizationLayerInfo(getDesign());
    vs.setCanvasLayerVisibilityAndOrder(getDesign(), res.getFirst(), res.getSecond());

    /* Initialize the undo/redo manager, and set its initial design */
    this.undoRedoManager = new UndoRedoManager(this, MAXSIZEUNDOLISTCHANGES);
    this.undoRedoManager.addNetPlanChange();

    onlineSimulationPane = new OnlineSimulationPane(this);
    executionPane = new OfflineExecutionPanel(this);
    whatIfAnalysisPane = new WhatIfAnalysisPane(this);

    // Closing windows
    WindowUtils.clearFloatingWindows();

    final JTabbedPane tabPane = new JTabbedPane();
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.network),
            viewEditTopTables);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.offline), executionPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.online),
            onlineSimulationPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.whatif),
            whatIfAnalysisPane);
    tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.report), reportPane);

    // Installing customized mouse listener
    MouseListener[] ml = tabPane.getListeners(MouseListener.class);

    for (int i = 0; i < ml.length; i++) {
        tabPane.removeMouseListener(ml[i]);
    }

    // Left click works as usual, right click brings up a pop-up menu.
    tabPane.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            JTabbedPane tabPane = (JTabbedPane) e.getSource();

            int tabIndex = tabPane.getUI().tabForCoordinate(tabPane, e.getX(), e.getY());

            if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) {
                if (tabIndex == tabPane.getSelectedIndex()) {
                    if (tabPane.isRequestFocusEnabled()) {
                        tabPane.requestFocus();

                        tabPane.repaint(tabPane.getUI().getTabBounds(tabPane, tabIndex));
                    }
                } else {
                    tabPane.setSelectedIndex(tabIndex);
                }

                if (!tabPane.isEnabled() || SwingUtilities.isRightMouseButton(e)) {
                    final JPopupMenu popupMenu = new JPopupMenu();

                    final JMenuItem popWindow = new JMenuItem("Pop window out");
                    popWindow.addActionListener(e1 -> {
                        final int selectedIndex = tabPane.getSelectedIndex();
                        final String tabName = tabPane.getTitleAt(selectedIndex);
                        final JComponent selectedComponent = (JComponent) tabPane.getSelectedComponent();

                        // Pops up the selected tab.
                        final WindowController.WindowToTab windowToTab = WindowController.WindowToTab
                                .parseString(tabName);

                        if (windowToTab != null) {
                            switch (windowToTab) {
                            case offline:
                                WindowController.buildOfflineWindow(selectedComponent);
                                WindowController.showOfflineWindow(true);
                                break;
                            case online:
                                WindowController.buildOnlineWindow(selectedComponent);
                                WindowController.showOnlineWindow(true);
                                break;
                            case whatif:
                                WindowController.buildWhatifWindow(selectedComponent);
                                WindowController.showWhatifWindow(true);
                                break;
                            case report:
                                WindowController.buildReportWindow(selectedComponent);
                                WindowController.showReportWindow(true);
                                break;
                            default:
                                return;
                            }
                        }

                        tabPane.setSelectedIndex(0);
                    });

                    // Disabling the pop up button for the network state tab.
                    if (WindowController.WindowToTab.parseString(tabPane
                            .getTitleAt(tabPane.getSelectedIndex())) == WindowController.WindowToTab.network) {
                        popWindow.setEnabled(false);
                    }

                    popupMenu.add(popWindow);

                    popupMenu.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    // Building windows
    WindowController.buildTableControlWindow(tabPane);
    WindowController.showTablesWindow(false);

    addAllKeyCombinationActions();
    updateVisualizationAfterNewTopology();
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultPlotEditor.java

/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.//from w ww .ja  va2 s  .  co  m
 * <P>
 * In designing the panel, we need to be aware that subclasses of Plot will
 * need to implement subclasses of PlotPropertyEditPanel - so we need to
 * leave one or two 'slots' where the subclasses can extend the user
 * interface.
 * 
 * @param plot
 *            the plot, which should be changed.
 */
public DefaultPlotEditor(Plot plot) {
    this.plotInsets = plot.getInsets();
    this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint());
    this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke());
    this.outlinePaintSample = new PaintSample(plot.getOutlinePaint());
    // Disabled because makes no sense for us
    // if (plot instanceof CategoryPlot) {
    // this.plotOrientation = ((CategoryPlot) plot).getOrientation();
    // } else if (plot instanceof XYPlot) {
    // this.plotOrientation = ((XYPlot) plot).getOrientation();
    // }
    if (plot instanceof CategoryPlot) {
        CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
        if (renderer instanceof LineAndShapeRenderer) {
            LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getBaseLinesVisible());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    } else if (plot instanceof XYPlot) {
        XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
        if (renderer instanceof StandardXYItemRenderer) {
            StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    }

    setLayout(new BorderLayout());

    this.availableStrokeSamples = new StrokeSample[4];
    this.availableStrokeSamples[0] = new StrokeSample(null);
    this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(1.0f));
    this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(2.0f));
    this.availableStrokeSamples[3] = new StrokeSample(new BasicStroke(3.0f));

    // create a panel for the settings...
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            plot.getPlotType() + localizationResources.getString(":")));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(localizationResources.getString("General")));

    JPanel interior = new JPanel(new LCBLayout(7));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    interior.add(new JLabel(localizationResources.getString("Outline_stroke")));

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (StrokeSample s : this.availableStrokeSamples) {
        model.addElement(s.getStroke());
    }
    this.cbOutlineStroke = new JComboBox(model);
    this.cbOutlineStroke.setSelectedItem(this.outlineStrokeSample.getStroke());
    this.cbOutlineStroke.setRenderer(new StrokeComboboxRenderer());

    interior.add(this.cbOutlineStroke);
    interior.add(new JLabel());

    interior.add(new JLabel(localizationResources.getString("Outline_Paint")));
    JButton button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("OutlinePaint");
    button.addActionListener(this);
    interior.add(this.outlinePaintSample);
    interior.add(button);

    interior.add(new JLabel(localizationResources.getString("Background_paint")));
    button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("BackgroundPaint");
    button.addActionListener(this);
    interior.add(this.backgroundPaintSample);
    interior.add(button);

    // Disabled because makes no sense for us
    // if (this.plotOrientation != null) {
    // boolean isVertical =
    // this.plotOrientation.equals(PlotOrientation.VERTICAL);
    // int index = isVertical ? ORIENTATION_VERTICAL :
    // ORIENTATION_HORIZONTAL;
    // interior.add(new
    // JLabel(localizationResources.getString("Orientation")));
    // this.orientationCombo = new JComboBox(orientationNames);
    // this.orientationCombo.setSelectedIndex(index);
    // this.orientationCombo.setActionCommand("Orientation");
    // this.orientationCombo.addActionListener(this);
    // interior.add(this.orientationCombo);
    // interior.add(new JPanel());
    // }

    if (this.drawLines != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_lines")));
        this.drawLinesCheckBox = new JCheckBox();
        this.drawLinesCheckBox.setSelected(this.drawLines.booleanValue());
        this.drawLinesCheckBox.setActionCommand("DrawLines");
        this.drawLinesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawLinesCheckBox);
    }

    if (this.drawShapes != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_shapes")));
        this.drawShapesCheckBox = new JCheckBox();
        this.drawShapesCheckBox.setSelected(this.drawShapes.booleanValue());
        this.drawShapesCheckBox.setActionCommand("DrawShapes");
        this.drawShapesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawShapesCheckBox);
    }

    general.add(interior, BorderLayout.NORTH);

    JPanel appearance = new JPanel(new BorderLayout());
    appearance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    appearance.add(general, BorderLayout.NORTH);

    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    } else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(domainAxis);
    if (this.domainAxisPropertyPanel != null) {
        this.domainAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Domain_Axis"), this.domainAxisPropertyPanel);
    }

    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    } else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }

    this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis);
    if (this.rangeAxisPropertyPanel != null) {
        this.rangeAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Range_Axis"), this.rangeAxisPropertyPanel);
    }

    tabs.add(localizationResources.getString("Appearance"), appearance);
    panel.add(tabs);

    add(panel);
}

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

private final JPanel buildBottomPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    Dimension size = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT / 10);

    panel.setSize(size);/*from w  ww  . j  a v a2 s .c om*/
    panel.setPreferredSize(size);

    tabbedPane.add("Symbol Profiling", new JScrollPane(profilingSymbolTable));

    tabbedPane.add("Message Profiling", new JScrollPane(profilingMsgTable));

    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            profilingSymbolTable.clearSelection();
            profilingMsgTable.clearSelection();
        }
    });
    panel.add(tabbedPane);

    return panel;
}

From source file:org.jfree.chart.demo.SuperDemo.java

private JComponent createContent() {
    JPanel jpanel = new JPanel(new BorderLayout());
    JTabbedPane jtabbedpane = new JTabbedPane();
    JPanel jpanel1 = new JPanel(new BorderLayout());
    jpanel1.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    JSplitPane jsplitpane = new JSplitPane(1);
    JTree jtree = new JTree(createTreeModel());
    jtree.addTreeSelectionListener(this);
    JScrollPane jscrollpane = new JScrollPane(jtree);
    jscrollpane.setPreferredSize(new Dimension(300, 100));
    jsplitpane.setLeftComponent(jscrollpane);
    jsplitpane.setRightComponent(createChartDisplayPanel());
    jpanel1.add(jsplitpane);//from www .j  a v a 2  s.c  o m
    jtabbedpane.add("Demos", jpanel1);
    MemoryUsageDemo memoryusagedemo = new MemoryUsageDemo(0x493e0);
    (memoryusagedemo.new DataGenerator(1000)).start();//memoryusagedemo, 
    jtabbedpane.add("Memory Usage", memoryusagedemo);
    jtabbedpane.add("Source Code", createSourceCodePanel());
    jtabbedpane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    jpanel.add(jtabbedpane);
    return jpanel;
}

From source file:org.jfree.chart.demo.JFreeChartDemo.java

/**
 * Creates a tabbed pane containing descriptions of the demo charts.
 *
 * @param resources  localised resources.
 *
 * @return a tabbed pane.//from  w  w w . ja v a2  s . co  m
 */
private JTabbedPane createTabbedPane(final ResourceBundle resources) {

    final Font font = new Font("Dialog", Font.PLAIN, 12);
    final JTabbedPane tabs = new JTabbedPane();

    int tab = 1;
    final Vector titles = new Vector(0);
    final String[] tabTitles;
    String title = null;

    while (tab > 0) {
        try {
            title = resources.getString("tabs." + tab);
            if (title != null) {
                titles.add(title);
            } else {
                tab = -1;
            }
            ++tab;
        } catch (Exception ex) {
            tab = -1;
        }
    }

    if (titles.size() == 0) {
        titles.add("Default");
    }

    tab = titles.size();
    this.panels = new JPanel[tab];
    tabTitles = new String[tab];

    --tab;
    for (; tab >= 0; --tab) {
        title = titles.get(tab).toString();
        tabTitles[tab] = title;
    }
    titles.removeAllElements();

    for (int i = 0; i < tabTitles.length; ++i) {
        this.panels[i] = new JPanel();
        this.panels[i].setLayout(new LCBLayout(20));
        this.panels[i].setPreferredSize(new Dimension(360, 20));
        this.panels[i].setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
        tabs.add(tabTitles[i], new JScrollPane(this.panels[i]));
    }

    String description;
    final String buttonText = resources.getString("charts.display");
    JButton b1;

    // Load the CHARTS ...
    String usage = null;
    for (int i = 0; i <= CHART_COMMANDS.length - 1; ++i) {
        try {
            usage = resources.getString(CHART_COMMANDS[i][2] + ".usage");
        } catch (Exception ex) {
            usage = null;
        }

        if ((usage == null) || usage.equalsIgnoreCase("All") || usage.equalsIgnoreCase("Swing")) {

            title = resources.getString(CHART_COMMANDS[i][2] + ".title");
            description = resources.getString(CHART_COMMANDS[i][2] + ".description");
            try {
                tab = Integer.parseInt(resources.getString(CHART_COMMANDS[i][2] + ".tab"));
                --tab;
            } catch (Exception ex) {
                System.err.println("Demo : Error retrieving tab identifier for chart " + CHART_COMMANDS[i][2]);
                System.err.println("Demo : Error = " + ex.getMessage());
                tab = 0;
            }
            if ((tab < 0) || (tab >= this.panels.length)) {
                tab = 0;
            }

            System.out.println("Demo : adding " + CHART_COMMANDS[i][0] + " to panel " + tab);
            this.panels[tab].add(RefineryUtilities.createJLabel(title, font));
            this.panels[tab].add(new DescriptionPanel(new JTextArea(description)));
            b1 = RefineryUtilities.createJButton(buttonText, font);
            b1.setActionCommand(CHART_COMMANDS[i][0]);
            b1.addActionListener(this);
            this.panels[tab].add(b1);
        }
    }

    return tabs;

}