Example usage for javax.swing JTabbedPane addTab

List of usage examples for javax.swing JTabbedPane addTab

Introduction

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

Prototype

public void addTab(String title, Component component) 

Source Link

Document

Adds a component represented by a title and no icon.

Usage

From source file:eu.delving.stats.ChartHelper.java

public JComponent getPresencePanel() {
    ChartPanel[] panels = new ChartPanel[presenceCharts.length];
    int index = 0;
    for (JFreeChart chart : presenceCharts) {
        panels[index] = wrap(chart);//from ww  w .j av a 2  s . c  o m
        index++;
    }
    if (panels.length > 1) {
        JTabbedPane tabs = new JTabbedPane();
        index = 0;
        for (ChartPanel panel : panels)
            tabs.addTab(String.format("Chart %d", index++), panel);
        return tabs;
    } else {
        return panels[0];
    }
}

From source file:net.sf.housekeeper.swing.MainFrame.java

/**
 * Builds the components of the frame and adds them to the content pane.
 * /*from  w  w  w. java 2 s .  c  om*/
 * @return The created components. Is not null.
 */
private Component buildComponents() {
    final JTabbedPane tabbedPane = new JTabbedPane();
    final String supplyTabName = LocalisationManager.INSTANCE.getText("domain.supply");
    tabbedPane.addTab(supplyTabName, new SupplyPanel(view));
    return tabbedPane;
}

From source file:org.gdms.usm.view.ProgressFrame.java

public ProgressFrame(Step s, boolean modifyThresholds) {
    super("Progress");
    simulation = s;//w  w w  .  j a  va  2 s. c  o m
    s.registerStepListener(this);
    stepSeconds = new LinkedList<Integer>();

    s.getManager().setModifyThresholds(modifyThresholds);
    s.getManager().setAdvisor(this);

    JPanel statusPanel = new JPanel(new BorderLayout());
    JPanel globalPanel = new JPanel(new SpringLayout());

    //Time elapsed panel
    JPanel timePanel = new JPanel(new BorderLayout(5, 5));
    final JLabel timeLabel = new JLabel("00:00:00", SwingConstants.CENTER);
    timeLabel.setFont(new Font("Serif", Font.BOLD, 45));
    timePanel.add(timeLabel, BorderLayout.SOUTH);
    JLabel elapsed = new JLabel("Time Elapsed :", SwingConstants.CENTER);
    timePanel.add(elapsed, BorderLayout.NORTH);
    statusPanel.add(timePanel, BorderLayout.NORTH);

    ActionListener timerListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            totalSeconds++;
            int hours = totalSeconds / 3600;
            String hourss;
            if (hours < 10) {
                hourss = "0" + hours;
            } else {
                hourss = "" + hours;
            }
            int minutes = (totalSeconds % 3600) / 60;
            String minutess;
            if (minutes < 10) {
                minutess = "0" + minutes;
            } else {
                minutess = "" + minutes;
            }
            int seconds = totalSeconds % 60;
            String secondss;
            if (seconds < 10) {
                secondss = "0" + seconds;
            } else {
                secondss = seconds + "";
            }
            timeLabel.setText(hourss + ":" + minutess + ":" + secondss);
        }
    };
    timer = new Timer(1000, timerListener);
    timer.start();

    //Turn progress panel
    JPanel turnPanel = new JPanel(new BorderLayout(5, 5));
    JLabel turnLabel = new JLabel("Current Step :", SwingConstants.CENTER);
    turnPanel.add(turnLabel, BorderLayout.NORTH);
    currentTurn = new JLabel("Init", SwingConstants.CENTER);
    currentTurn.setFont(new Font("Serif", Font.BOLD, 30));
    turnPanel.add(currentTurn, BorderLayout.SOUTH);
    globalPanel.add(turnPanel);

    //Movers panel
    JPanel moversPanel = new JPanel(new BorderLayout(5, 5));
    JLabel moversLabel = new JLabel("Last movers count :", SwingConstants.CENTER);
    moversPanel.add(moversLabel, BorderLayout.NORTH);
    lastMoversCount = new JLabel("Init", SwingConstants.CENTER);
    lastMoversCount.setFont(new Font("Serif", Font.BOLD, 30));
    moversPanel.add(lastMoversCount, BorderLayout.SOUTH);
    globalPanel.add(moversPanel);

    //Initial population panel
    JPanel initPopPanel = new JPanel(new BorderLayout(5, 5));
    JLabel initialPopulationLabel = new JLabel("Initial population :", SwingConstants.CENTER);
    initPopPanel.add(initialPopulationLabel, BorderLayout.NORTH);
    initialPopulationCount = new JLabel("Init", SwingConstants.CENTER);
    initialPopulationCount.setFont(new Font("Serif", Font.BOLD, 30));
    initPopPanel.add(initialPopulationCount, BorderLayout.SOUTH);
    globalPanel.add(initPopPanel);

    //Current population panel
    JPanel curPopPanel = new JPanel(new BorderLayout(5, 5));
    JLabel currentPopulationLabel = new JLabel("Current population :", SwingConstants.CENTER);
    curPopPanel.add(currentPopulationLabel, BorderLayout.NORTH);
    currentPopulation = new JLabel("Init", SwingConstants.CENTER);
    currentPopulation.setFont(new Font("Serif", Font.BOLD, 30));
    curPopPanel.add(currentPopulation, BorderLayout.SOUTH);
    globalPanel.add(curPopPanel);

    //Dead panel
    JPanel deadPanel = new JPanel(new BorderLayout(5, 5));
    JLabel deadLabel = new JLabel("Last death toll :", SwingConstants.CENTER);
    deadPanel.add(deadLabel, BorderLayout.NORTH);
    lastDeathToll = new JLabel("Init", SwingConstants.CENTER);
    lastDeathToll.setFont(new Font("Serif", Font.BOLD, 30));
    deadPanel.add(lastDeathToll, BorderLayout.SOUTH);
    globalPanel.add(deadPanel);

    //Newborn panel
    JPanel newbornPanel = new JPanel(new BorderLayout(5, 5));
    JLabel newbornLabel = new JLabel("Last newborn count :", SwingConstants.CENTER);
    newbornPanel.add(newbornLabel, BorderLayout.NORTH);
    lastNewbornCount = new JLabel("Init", SwingConstants.CENTER);
    lastNewbornCount.setFont(new Font("Serif", Font.BOLD, 30));
    newbornPanel.add(lastNewbornCount, BorderLayout.SOUTH);
    globalPanel.add(newbornPanel);

    SpringUtilities.makeCompactGrid(globalPanel, 3, 2, 5, 5, 20, 10);
    statusPanel.add(globalPanel, BorderLayout.SOUTH);

    add(statusPanel, BorderLayout.WEST);

    //Graph tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    timeChart = new XYSeries("Step time", true, false);
    tabbedPane.addTab("Step time", createChartPanel("Step time", timeChart));
    currentPopulationChart = new XYSeries("Population", true, false);
    tabbedPane.addTab("Population", createChartPanel("Population", currentPopulationChart));
    deathTollChart = new XYSeries("Deaths", true, false);
    tabbedPane.addTab("Deaths", createChartPanel("Deaths", deathTollChart));
    newbornCountChart = new XYSeries("Newborn", true, false);
    tabbedPane.addTab("Newborn", createChartPanel("Newborn", newbornCountChart));
    moversCountChart = new XYSeries("Movers", true, false);
    tabbedPane.addTab("Movers", createChartPanel("Movers", moversCountChart));
    add(tabbedPane, BorderLayout.EAST);

    getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10));
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
}

From source file:br.ufrgs.enq.jcosmo.test.VLEdiagramsGAMESS.java

public void biEq() throws Exception {
    JTabbedPane tabbedPane = new JTabbedPane();

    //      tabbedPane.addTab("Ehtyl-Acetate x Water, T=298.15",calcAcetoneWater());
    tabbedPane.addTab("Acetic Acid x Octanol, T=293.15", calcAcAcidOctanol());
    tabbedPane.addTab("Ethanol x Water, T=343.15", calcEthanolWater());

    add(tabbedPane, BorderLayout.CENTER);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 500);/* w w  w .  j a v  a 2s . c  om*/
}

From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java

private Component createTabs() {
    final JTabbedPane p = new PersistentTabPane(getClass().getName() + ".bottomFields", //$NON-NLS-1$
            SwingConstants.BOTTOM);
    p.addTab(M.getString("NAME"), createMainTab()); //$NON-NLS-1$
    p.addTab(M.getString("attachments.title"), //$NON-NLS-1$
            _attachmentBox);//  w w  w .j  av  a  2  s  . co m
    p.addTab(M.getString("STATISTICS"), //$NON-NLS-1$
            createStatisticTab());
    p.addTab(M.getString("comment_border_title"), //$NON-NLS-1$
            createCommentTab());
    p.setBorder(BorderFactory.createEmptyBorder());
    return createTitledPanel(M.getString("border_title"), p); //$NON-NLS-1$
}

From source file:org.drugis.addis.gui.builder.NetworkMetaAnalysisView.java

@Override
public JComponent buildPanel() {
    final JTabbedPane tabbedPane = new AddisTabbedPane();
    tabbedPane.addTab(OVERVIEW_TAB_TITLE, buildOverviewTab());
    tabbedPane.addTab(CONSISTENCY_TAB_TITLE, buildConsistencyTab());
    tabbedPane.addTab(INCONSISTENCY_TAB_TITLE, buildInconsistencyTab());
    tabbedPane.addTab(NODE_SPLIT_TAB_TITLE, buildNodeSplitTab());
    tabbedPane.addTab(MEMORY_USAGE_TAB_TITLE, buildMemoryUsageTab());
    return tabbedPane;
}

From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java

public OnlineSimulationPane(IVisualizationCallback mainWindow) {
    super();/*from   www  . ja  va  2 s  .c om*/
    this.mainWindow = mainWindow;

    simKernel = new SimKernel();
    simKernel.setGUIListener(this);

    File ALGORITHMS_DIRECTORY = new File(
            IGUIModule.CURRENT_DIR + SystemUtils.getDirectorySeparator() + "workspace");
    ALGORITHMS_DIRECTORY = ALGORITHMS_DIRECTORY.isDirectory() ? ALGORITHMS_DIRECTORY : IGUIModule.CURRENT_DIR;

    eventGeneratorPanel = new RunnableSelector(SimKernel.getEventGeneratorLabel(), "File",
            simKernel.getEventGeneratorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel());
    eventProcessorPanel = new RunnableSelector(SimKernel.getEventProcessorLabel(), "File",
            simKernel.getEventProcessorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel());

    simulationConfigurationPanel = new ParameterValueDescriptionPanel();
    simulationConfigurationPanel.setParameters(simKernel.getSimulationParameters());

    JTabbedPane configPane = new JTabbedPane();
    configPane.addTab(SimKernel.getEventGeneratorLabel(), eventGeneratorPanel);
    configPane.addTab(SimKernel.getEventProcessorLabel(), eventProcessorPanel);

    JPanel topPane = new JPanel(new MigLayout("insets 0 0 0 0", "[][grow][]", "[][grow]"));
    topPane.add(new JLabel("Simulation parameters"), "spanx 3, wrap");
    topPane.add(simulationConfigurationPanel, "spanx 3, grow, wrap");

    splitPaneConfiguration = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPaneConfiguration.setTopComponent(topPane);
    splitPaneConfiguration.setBottomComponent(configPane);

    splitPaneConfiguration.setResizeWeight(0.5);
    splitPaneConfiguration.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener());
    splitPaneConfiguration
            .setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Simulation execution"));

    JPanel pan_execution = new JPanel(new MigLayout("fill, insets 0 0 0 0"));
    pan_execution.add(splitPaneConfiguration, "grow");

    btn_updateReport = new JButton("Update");
    btn_updateReport.setToolTipText("Update the simulation report");
    btn_updateReport.addActionListener(this);

    simReport = new JPanel();
    simReport.setLayout(new BorderLayout());
    simReport.add(btn_updateReport, BorderLayout.NORTH);

    addTab("Simulation input parameters", pan_execution);
    simulationControlPanel = configureSimulationControlPanel();
    addTab("Simulation control", simulationControlPanel);
    addTab("Simulation report", simReport);
    simReportTab = 2;

    simKernel.reset();

    if (mainWindow.getDesign() != null)
        simKernel.setNetPlan(mainWindow.getDesign());
}

From source file:br.ufrgs.enq.jcosmo.test.VLEdiagrams.java

public void biEq() throws Exception {
    JTabbedPane tabbedPane = new JTabbedPane();
    JPanel aba1 = calcEthTol();//  www.j  a  va2 s  . c  om
    JPanel aba2 = calcMethanolMethilAcetate();
    JPanel aba3 = calcEthTolMOPAC();
    JPanel aba4 = calcMethanolMethilAcetateMOPAC();
    tabbedPane.addTab("Ethanol x Toluene, T=60C", aba1);
    tabbedPane.addTab("Ethanol x Toluene, T=60C, MOPAC", aba3);
    tabbedPane.addTab("Methanol x Methil-Acetate, T=25C", aba2);
    tabbedPane.addTab("Methanol x Methil-Acetate, T=25C, MOPAC", aba4);
    add(tabbedPane, BorderLayout.CENTER);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 500);
}

From source file:au.org.ala.delta.editor.ui.ItemEditor.java

/**
 * Creates the user interface components of this dialog.
 *///w  w  w.  ja v a  2 s .  co m
private void createUI() {

    JPanel content = new JPanel();
    JLabel lblTaxonNumber = new JLabel("Taxon Number:");
    lblTaxonNumber.setName("taxonNumberLabel");

    spinner = new JSpinner();
    spinner.setModel(new SpinnerNumberModel(1, 1, 1, 1));

    btnSelect = new JToggleButton("Select");
    btnSelect.setName("selectTaxonNumberButton");

    lblEditTaxonName = new JLabel(editTaxonLabelText);

    rtfEditor = new RtfEditor();
    editorScroller = new JScrollPane(rtfEditor);

    chckbxTreatAsVariant = new JCheckBox("Treat as Variant");
    chckbxTreatAsVariant.setName("treatAsVariantCheckbox");

    JPanel panel = new JPanel();

    btnDone = new JButton("Done");
    btnDone.setName("doneEditingTaxonButton");

    taxonSelectionList = new ItemList();

    GroupLayout groupLayout = new GroupLayout(content);
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
                    .createSequentialGroup()
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addGroup(groupLayout.createSequentialGroup()
                                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
                                            .addComponent(spinner).addComponent(lblTaxonNumber,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE))
                                    .addGap(18).addComponent(btnSelect))
                            .addComponent(chckbxTreatAsVariant))
                    .addGap(23)
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblEditTaxonName)
                            .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 703, Short.MAX_VALUE)))
                    .addGroup(groupLayout.createSequentialGroup()
                            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(groupLayout.createSequentialGroup()
                                            .addGap(0, 759, Short.MAX_VALUE).addComponent(btnDone).addGap(5))
                                    .addComponent(panel, GroupLayout.DEFAULT_SIZE, 850, Short.MAX_VALUE))
                            .addGap(1)))
            .addGap(19)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblTaxonNumber)
                    .addComponent(lblEditTaxonName))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup()
                            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnSelect))
                            .addPreferredGap(ComponentPlacement.RELATED, 90, Short.MAX_VALUE)
                            .addComponent(chckbxTreatAsVariant))
                    .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE))
            .addGap(18).addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnDone)).addGap(17)));
    panel.setLayout(new BorderLayout(0, 0));

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    imageDetails = new ImageDetailsPanel();
    imageDetails.setEnabled(false);
    tabbedPane.addTab("Images", imageDetails);
    panel.add(tabbedPane);
    content.setLayout(groupLayout);

    setPreferredSize(new Dimension(827, 500));
    setMinimumSize(new Dimension(748, 444));

    RtfToolBar toolbar = new RtfToolBar(this);
    toolbar.addEditor(rtfEditor);
    getContentPane().add(toolbar, BorderLayout.NORTH);
    getContentPane().add(content, BorderLayout.CENTER);
}

From source file:com.joey.software.MoorFLSI.RepeatImageTextReader.java

public void createJPanel() {
    setLayout(new BorderLayout());
    add(currentValue, BorderLayout.NORTH);
    add(image, BorderLayout.CENTER);

    currentValue.addChangeListener(new ChangeListener() {

        @Override/*from  w w  w .jav a 2s  . c  o m*/
        public void stateChanged(ChangeEvent e) {
            setCurrentImage((Integer) currentValue.getValue());
        }
    });

    // Create the text output panel
    JPanel outputPanel = new JPanel(new BorderLayout());
    JScrollPane scrollPane = new JScrollPane(dataField);
    outputPanel.add(scrollPane, BorderLayout.CENTER);

    JTabbedPane tabPanel = new JTabbedPane();
    tabPanel.addTab("Graph", chartPanel);
    tabPanel.addTab("Data", outputPanel);
    staticsHolderFrame.getContentPane().setLayout(new BorderLayout());
    staticsHolderFrame.getContentPane().removeAll();
    staticsHolderFrame.getContentPane().add(tabPanel, BorderLayout.CENTER);
    staticsHolderFrame.getContentPane().add(outputImages, BorderLayout.SOUTH);

    // Add region panel to image
    image.getImage().setControler(ROIPanel.TYPE_RECTANGLE);
    image.getImage().setAllowMultipleROI(false);
    image.getImage().addROIPanelListner(new ROIPanelListner() {

        @Override
        public void regionAdded(Shape region) {

            updateData();
        }

        @Override
        public void regionChanged() {
            // TODO Auto-generated method stub

        }

        @Override
        public void regionRemoved(Shape region) {
            // TODO Auto-generated method stub

        }
    });

    outputImages.addActionListener(new ActionListener() {

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