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:ProxyTester.java

public static void main(String[] args) {
    JTabbedPane tabbedPane = new JTabbedPane();
    for (String name : imageNames) {
        JLabel label = new JLabel(new ImageProxy(name));
        tabbedPane.add(name, label);
    }/*w  w w . j  a  v  a2 s.  c o  m*/

    JFrame frame = new JFrame();
    frame.add(tabbedPane);

    frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:edu.ku.brc.specify.ui.AppBase.java

/**
 * Creates a modal dialog displaying the the error and specify log files. 
 *///from   w w w. j a v a2s  .c o m
public static void displaySpecifyLogFiles() {
    File spLogFile = getFullLogFilePath(AppBase.SPECIFY_LOG); //$NON-NLS-1$
    File errLogFile = getFullLogFilePath(AppBase.ERRORSYS_LOG); //$NON-NLS-1$

    JTabbedPane tabPane = new JTabbedPane();
    tabPane.add(getResourceString("Specify.ERROR"), getLogFilePanel(errLogFile, true)); //$NON-NLS-1$
    tabPane.add("Specify", getLogFilePanel(spLogFile, true)); //$NON-NLS-1$

    String title = getResourceString("Specify.LOG_FILES_TITLE");//$NON-NLS-1$
    CustomDialog dialog = new CustomDialog((JFrame) UIRegistry.getTopWindow(), title, true, CustomDialog.OK_BTN,
            tabPane);
    String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$
    dialog.setOkLabel(okLabel);
    dialog.createUI();
    dialog.setSize(800, 600);
    UIHelper.centerWindow(dialog);
    dialog.setVisible(true);
}

From source file:org.jfree.graphics2d.demo.SwingUIToSVGDemo.java

private JComponent createContent() {
    JPanel content = new JPanel(new BorderLayout());
    JTabbedPane tabs = new JTabbedPane();
    tabs.add("Tab 1", new JButton("First Tab"));
    tabs.add("Tab 2", new JButton("Second Tab"));
    JButton button = new JButton("Save to SVG");
    button.addActionListener(this);
    content.add(tabs);/*from   w w w  . j av a 2s.c o m*/
    content.add(button, BorderLayout.SOUTH);
    return content;
}

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

private JPanel createContentPane() {
    JPanel jpanel = new JPanel(new BorderLayout());
    JTabbedPane jtabbedpane = new JTabbedPane();
    jtabbedpane.add("Alignment", createTab1Content());
    jtabbedpane.add("Rotation", createTab2Content());
    jpanel.add(jtabbedpane);/*w w w.  j  a  v a2  s.com*/
    return jpanel;
}

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

/**
 * Creates a new demo instance./*from   ww w. j  av  a2s.co  m*/
 *
 * @param title  the frame title.
 */
public TimeSeriesDemo13(final String title) {

    super(title);

    final XYDataset dataset1 = createDataset(26);
    final JFreeChart chart1 = createChart(dataset1);
    final ChartPanel chartPanel1 = new ChartPanel(chart1);

    final XYDataset dataset2 = createDataset(1);
    final JFreeChart chart2 = createChart(dataset2);
    final ChartPanel chartPanel2 = new ChartPanel(chart2);

    final JTabbedPane tabs = new JTabbedPane();
    tabs.add("Chart 1", chartPanel1);
    tabs.add("Chart 2", chartPanel2);
    final JPanel content = new JPanel(new BorderLayout());
    content.setPreferredSize(new java.awt.Dimension(500, 270));
    content.add(tabs);
    setContentPane(content);

}

From source file:org.jfree.demo.DrawStringDemo.java

/**
 * Creates the content pane for the demo frame.
 *
 * @return The content pane./*  w  ww . j a  v a2  s.  com*/
 */
private JPanel createContentPane() {
    final JPanel content = new JPanel(new BorderLayout());
    final JTabbedPane tabs = new JTabbedPane();
    tabs.add("Alignment", createTab1Content());
    tabs.add("Rotation", createTab2Content());
    content.add(tabs);
    return content;
}

From source file:org.jfree.demo.DrawStringDemo.java

/**
 * Creates the content pane for the demo frame.
 *
 * @return The content pane.//  w  ww  .j ava  2s.c o  m
 */
private JPanel createContentPane() {

    final JPanel content = new JPanel(new BorderLayout());
    final JTabbedPane tabs = new JTabbedPane();

    tabs.add("Alignment", createTab1Content());
    tabs.add("Rotation", createTab2Content());

    content.add(tabs);
    return content;
}

From source file:Main.java

public Main() {
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());
    final JTabbedPane tb = new JTabbedPane();
    JButton btn = new JButton("push me !!!");
    btn.addActionListener(e -> {//from w w w.  j av  a2s  .  c  o  m
        tb.setEnabledAt(1, true);
        tb.setEnabledAt(2, true);
        tb.setEnabledAt(3, true);
        tb.setEnabledAt(4, true);
    });
    JPanel pnl = new JPanel();
    pnl.add(btn);
    tb.add("Tab1", pnl);
    tb.add("Tab2", new JTextArea(10, 20));
    tb.add("Tab3", new JTextArea(10, 20));
    tb.add("Tab4", new JTextArea(10, 20));
    tb.add("Tab5", new JTextArea(10, 20));
    jp.add(tb, BorderLayout.CENTER);
    tb.setEnabledAt(1, false);
    tb.setEnabledAt(2, false);
    tb.setEnabledAt(3, false);
    tb.setEnabledAt(4, false);
    JFrame frame = new JFrame();
    frame.setLayout(new BorderLayout());
    frame.add(jp, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

From source file:moller.javapeg.program.gui.frames.ImageRepositoryStatisticsViewer.java

private JTabbedPane createStatiticsPanel() {

    JTabbedPane tabbedPane = new JTabbedPane();

    tabbedPane.add(createCameraModelStatistics(), 0);
    tabbedPane.add(createYearStatistics(), 1);
    tabbedPane.add(createDatesStatistics(), 2);
    tabbedPane.add(createHourStatistics(), 3);
    tabbedPane.add(createMinuteStatistics(), 4);
    tabbedPane.add(createSecondStatistics(), 5);
    tabbedPane.add(createImageSizeStatistics(), 6);
    tabbedPane.add(createISOStatistics(), 7);
    tabbedPane.add(createExposureTimeStatistics(), 8);
    tabbedPane.add(createFNumberStatistics(), 9);
    tabbedPane.add(createWeekDayStatistics(), 10);

    return tabbedPane;
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.EvolutionMonitor.java

private void init(Renderer<? super T, JComponent> renderer) {
    // Make sure all JFreeChart charts are created with the legacy theme
    // (grey surround and white data area).
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());

    JTabbedPane tabs = new JTabbedPane();
    monitorComponent = new JPanel(new BorderLayout());
    monitorComponent.add(tabs, BorderLayout.CENTER);

    FittestCandidateView<T> candidateView = new FittestCandidateView<T>(renderer);
    tabs.add("Fittest Individual", candidateView);
    views.add(new SwingIslandEvolutionObserver<T>(candidateView, 300, TimeUnit.MILLISECONDS));

    PopulationFitnessView fitnessView = new PopulationFitnessView(islands);
    tabs.add(islands ? "Global Population" : "Population Fitness", fitnessView);
    views.add(fitnessView);/*  w  w  w .ja  v a2 s  . com*/

    if (islands) {
        IslandsView islandsView = new IslandsView();
        tabs.add("Island Populations", islandsView);
        views.add(new SwingIslandEvolutionObserver<Object>(islandsView, 300, TimeUnit.MILLISECONDS));
    }

    JVMView jvmView = new JVMView();
    tabs.add("JVM Memory", jvmView);

    StatusBar statusBar = new StatusBar(islands);
    monitorComponent.add(statusBar, BorderLayout.SOUTH);
    views.add(new SwingIslandEvolutionObserver<Object>(statusBar, 300, TimeUnit.MILLISECONDS));
}