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:com.eviware.soapui.impl.wsdl.panels.teststeps.WsdlTestRequestDesktopPanel.java

private Component buildLogPanel() {
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.RIGHT);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    logArea = new JTextArea();
    logArea.setEditable(false);//  www. j  ava  2 s .  c o  m
    logArea.setToolTipText("Request Log");

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JScrollPane(logArea), BorderLayout.CENTER);

    tabbedPane.addTab("Assertions", buildAssertionsPanel());
    tabbedPane.addTab("Request Log", panel);
    return UISupport.createTabPanel(tabbedPane, true);
}

From source file:layout.TabDemo.java

public void addComponentToPane(Container pane) {
    JTabbedPane tabbedPane = new JTabbedPane();

    //Create the "cards".
    JPanel card1 = new JPanel() {
        //Make the panel wider than it really needs, so
        //the window's wide enough for the tabs to stay
        //in one row.
        public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            size.width += extraWindowWidth;
            return size;
        }//from   w  ww .j  a  v a2 s . c o m
    };
    card1.add(new JButton("Button 1"));
    card1.add(new JButton("Button 2"));
    card1.add(new JButton("Button 3"));

    JPanel card2 = new JPanel();
    card2.add(new JTextField("TextField", 20));

    tabbedPane.addTab(BUTTONPANEL, card1);
    tabbedPane.addTab(TEXTPANEL, card2);

    pane.add(tabbedPane, BorderLayout.CENTER);
}

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

public COSMOSACDialog() {
    super("JCOSMO Simple");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    db = COSMOSACDataBase.getInstance();

    COSMOSAC models[] = new COSMOSAC[5];
    models[0] = new COSMOSAC();
    models[1] = new COSMOPAC();
    models[2] = new COSMOSAC_SVP();
    models[3] = new COSMOSAC_G();
    models[4] = new PCMSAC();
    modelBox = new JComboBox(models);
    modelBox.addActionListener(this);

    JPanel north = new JPanel(new GridLayout(0, 2));
    add(north, BorderLayout.NORTH);
    JPanel northAba1 = new JPanel(new GridLayout(0, 4));
    JPanel northAba2 = new JPanel(new GridLayout(0, 2));

    //Where the GUI is created:
    JMenuBar menuBar;//from  w  ww .  j  a v  a 2  s.  c o  m
    JMenu file, help;
    JMenuItem menuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    // the file menu
    file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);
    menuBar.add(file);
    menuItem = new JMenuItem("Quit", KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
    menuItem.setActionCommand(QUIT);
    menuItem.addActionListener(this);
    file.add(menuItem);

    // the help menu
    help = new JMenu("Help");
    file.setMnemonic(KeyEvent.VK_H);
    menuBar.add(help);
    menuItem = new JMenuItem("About", KeyEvent.VK_A);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    menuItem.setActionCommand(ABOUT);
    menuItem.addActionListener(this);
    help.add(menuItem);

    setJMenuBar(menuBar);

    listModel = new DefaultListModel();
    list = new JList(listModel);
    list.setBorder(BorderFactory.createTitledBorder("compounds"));
    list.setVisibleRowCount(2);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton addButton = new JButton("Add");
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new AddCompoundDialog(COSMOSACDialog.this);
        }
    });

    removeButton = new JButton("Remove");
    removeButton.addActionListener(this);
    visibRemove(false);

    JButton calcButton = new JButton("Calculate");
    calcButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildChart();
            rebuildSigmaProfiles();
        }
    });

    JButton refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildSigmaProfiles();
        }
    });

    ignoreSGButton = new JCheckBox("Ignore SG");
    ignoreSGButton.setToolTipText("Toogles the ignore flag for the Staverman-Guggenheim term");
    ignoreSGButton.addActionListener(this);

    JPanel but = new JPanel(new GridLayout(0, 1));
    but.add(addButton, BorderLayout.EAST);
    but.add(removeButton, BorderLayout.EAST);
    but.add(modelBox);
    north.add(listScrollPane);
    north.add(but);

    northAba1.add(new JLabel("Temperature [K]"));
    northAba1.add(temperature = new JTextField(10));
    temperature.setText("298");

    northAba1.add(new JLabel("Sigma HB"));
    northAba1.add(sigmaHB = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB2"));
    northAba1.add(sigmaHB2 = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB3"));
    northAba1.add(sigmaHB3 = new JTextField(10));

    northAba1.add(new JLabel("Charge HB"));
    northAba1.add(chargeHB = new JTextField(10));

    northAba1.add(new JLabel("Sigma Disp"));
    northAba1.add(sigmaDisp = new JTextField(10));
    northAba1.add(new JLabel("Charge Disp"));
    northAba1.add(chargeDisp = new JTextField(10));

    northAba1.add(new JLabel("Beta"));
    northAba1.add(beta = new JTextField(10));
    northAba1.add(new JLabel("fpol"));
    northAba1.add(fpol = new JTextField(10));
    northAba1.add(new JLabel("Anorm"));
    northAba1.add(anorm = new JTextField(10));

    northAba1.add(ignoreSGButton);
    northAba1.add(calcButton);
    northAba2.add(new JLabel(""));
    northAba2.add(refreshButton);

    //      chart = new JLineChart();
    //      add(chart, BorderLayout.CENTER);
    //      chart.setTitle("Gamma Plot");
    //      chart.setSubtitle("");
    //      chart.setXAxisLabel("Mole Fraction, x_1");
    //      chart.setYAxisLabel("ln gamma, gE/RT");
    //      chart.setSource(getTitle());
    //      chart.setLegendPosition(LegendPosition.BOTTOM);
    //      chart.setShapesVisible(true);

    JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction, x_1", "ln gamma, gE/RT", null,
            PlotOrientation.VERTICAL, true, true, false);
    plot = (XYPlot) chart.getPlot();
    plot.getDomainAxis().setAutoRange(false);
    plot.getDomainAxis().setRange(new Range(0.0, 1.0));

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer();
    r.setUseFillPaint(true);
    r.setBaseFillPaint(Color.white);
    r.setBaseShapesVisible(true);

    JFreeChart sigmaProfileChart = ChartFactory.createXYLineChart(null, "sigma", "P^x", null,
            PlotOrientation.VERTICAL, true, true, false);
    sigmaProfilePlot = sigmaProfileChart.getXYPlot();
    sigmaProfilePlot.getDomainAxis().setAutoRange(false);
    sigmaProfilePlot.getDomainAxis().setRange(new Range(-0.025, 0.025));

    //      sigmaProfilePlot.setBackgroundPaint(Color.lightGray);
    //      sigmaProfilePlot.setDomainGridlinePaint(Color.white);
    //      sigmaProfilePlot.setRangeGridlinePaint(Color.white);

    JFreeChart chartSegGamma = ChartFactory.createXYLineChart(null, "sigma", "Segment Gamma", null,
            PlotOrientation.VERTICAL, true, true, false);
    plotSegGamma = (XYPlot) chartSegGamma.getPlot();

    JPanel south = new JPanel();
    south.setLayout(new FlowLayout());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(lnGammaInf1Label = new JLabel());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(lnGammaInf2Label = new JLabel());
    south.add(Box.createHorizontalStrut(20));
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(gammaInf1Label = new JLabel());
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(gammaInf2Label = new JLabel());

    JPanel aba1 = new JPanel(new BorderLayout());
    aba1.add(northAba1, BorderLayout.NORTH);
    JPanel chartsPanel = new JPanel(new GridLayout(0, 2));
    aba1.add(chartsPanel, BorderLayout.CENTER);
    chartsPanel.add(new ChartPanel(chart));
    chartsPanel.add(new ChartPanel(chartSegGamma));
    aba1.add(south, BorderLayout.SOUTH);

    JPanel aba2 = new JPanel(new BorderLayout());
    aba2.add(northAba2, BorderLayout.NORTH);
    aba2.add(chartPanel = new ChartPanel(sigmaProfileChart), BorderLayout.CENTER);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("gamma", aba1);
    tabbedPane.addTab("sigma", aba2);
    add(tabbedPane, BorderLayout.CENTER);

    //      cosmosac.setAEffPrime(6.596176570595075);
    //      cosmosac.setCoord(11.614599507917934);
    //      cosmosac.setVnorm(56.36966406129967);
    //      cosmosac.setAnorm(41.56058649432742);
    //      cosmosac.setCHB(65330.19484947528);
    //      cosmosac.setSigmaHB(0.008292411048046008);

    //Display the window.
    setSize(800, 600);
    setLocationRelativeTo(null);
    modelBox.setSelectedIndex(0);
    setVisible(true);

    // test for a mixture
    //      addList("WATER");
    //      addList("H3O+1");
    //      addList("OH-1");
    //      addList("CL-1");
    //      addList("OXYGEN");
    //      addList("sec-butylamine");
    //      addList("hydrogen-fluoride");
    //      addList("ACETONE");
    //      addList("METHANOL");
    //      addList("ACETONE.opt");
    //      addList("METHANOL.opt");
    //      addList("METHYL-ETHYL-KETONE");
    //      addList("ETHANOL");
    //      addList("N-HEPTANE");
    //      addList("PROPIONIC-ACID");
    //      addList("EMIM");
    //      addList("NTF2");
    //      addList("DCA");
    //      addList("N-OCTANE");
    addList("ETHYLENE CARBONATE");
    addList("BENZENE");
    addList("TOLUENE");
    removeButton.setEnabled(true);
}

From source file:jchrest.gui.VisualSearchPane.java

public VisualSearchPane(Chrest model, Scenes scenes) {
    super();/* w w  w  .j a  v  a2 s .  c om*/

    _model = model;
    _scenes = scenes;
    //TODO: fix this when perceiver functionality working correctly.
    //_model.getPerceiver().setScene (_scenes.get (0));
    _model.setClocks(0);
    _sceneDisplay = new SceneDisplay(_scenes.get(0));
    _domainSelector = new JComboBox(new String[] { "Generic", "Chess" });
    _domainSelector.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            int index = _domainSelector.getSelectedIndex();
            if (index == 0) {
                _model.setDomain(new GenericDomain(_model, null, 3));
            } else { // if (index == 1) 
                //TODO: fix this when perceiver functionality working correctly.
                //_model.setDomain (new ChessDomain (_model));
            }
        }
    });

    JTabbedPane jtb = new JTabbedPane();
    jtb.addTab("Train", trainPanel());
    jtb.addTab("Recall", recallPanel());
    jtb.addTab("Log", logPanel());
    jtb.addTab("Analyse", analysePanel());

    setLayout(new BorderLayout());
    add(jtb);
}

From source file:com.moteiv.trawler.Trawler.java

public Trawler(String[] args) {
    init(args);/* w w  w .j  a  v a  2s  .  c  om*/
    // Install a different look and feel; specifically, the Windows look and feel
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (InstantiationException e) {
    } catch (ClassNotFoundException e) {
    } catch (UnsupportedLookAndFeelException e) {
    } catch (IllegalAccessException e) {
    }
    jf = new JFrame("Trawler");
    jf.setJMenuBar(getMainMenuBar());

    g = new SparseGraph();

    layout = new FRLayout(g);
    indexer = Indexer.newIndexer(g, 0);
    //          layout.initialize(new Dimension(100, 100));
    mif = new MoteInterface(g, Trawler.GROUPID, layout);
    uartDetect = new UartDetect(mif.getMoteIF());
    Thread th = new Thread(uartDetect);
    th.start();
    pr = new myPluggableRenderer();
    vv = new VisualizationViewer(layout, pr);

    vv.init();

    vv.setPickSupport(new ShapePickSupport());
    vv.setBackground(Color.white);
    vv.setToolTipListener(new NodeTips(vv));
    myVertexShapeFunction vsf = new myVertexShapeFunction(uartDetect);
    pr.setVertexShapeFunction(vsf);
    pr.setVertexIconFunction(vsf);//new myVertexShapeFunction());
    m_vs = new VertexLabel();
    java.awt.Font f = new java.awt.Font("Arial", Font.PLAIN, 12);
    pr.setEdgeFontFunction(new ConstantEdgeFontFunction(f));
    pr.setVertexStringer(m_vs);
    m_es = new myEdgeLabel();
    pr.setEdgeStringer(m_es);
    ((AbstractEdgeShapeFunction) pr.getEdgeShapeFunction()).setControlOffsetIncrement(-50.f);
    //   pr.setVertexColorFunction(new myVertexColorFunction(Color.RED.darker().darker(), Color.RED, 500l));
    pr.setEdgeStrokeFunction(new EdgeWeightStrokeFunction());
    pr.setEdgeLabelClosenessFunction(new ConstantDirectionalEdgeValue(0.5, 0.5));
    pr.setEdgePaintFunction(new myEdgeColorFunction());

    scrollPane = new GraphZoomScrollPane(vv);
    jf.getContentPane().setLayout(new BoxLayout(jf.getContentPane(), BoxLayout.LINE_AXIS));
    JTabbedPane pane = new JTabbedPane();
    pane.addTab("Network Topology", scrollPane);
    pane.addTab("Sensor readings", createOscopePanel(mif.getMoteIF(), "ADC Readings", -33, -456, 300, 4100,
            "Time (seconds)", "ADC counts"));
    pane.addTab("Link Quality", createOscopePanel(mif.getMoteIF(), "LinkQualityPanel", -33, -15, 300, 135,
            "Time (seconds)", "Link Quality Indicator"));
    ImageIcon trawlerIcon = new ImageIcon(Trawler.class.getResource("images/trawler-icon.gif"));
    Image imageTrawler = trawlerIcon.getImage();
    jf.getContentPane().add(pane);
    controlBoxFrame = new JFrame("Vizualization Control");
    controlBoxFrame.getContentPane().add(getControls());
    controlBoxFrame.setIconImage(imageTrawler);
    controlBoxFrame.pack();
    //   jf.getContentPane().add(getControls());
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    layout.initialize(vv.getSize());
    layout.resize(vv.getSize());
    layout.update();

    loadPrefs();
    GraphIO.loadGraph(g, layout, mif, Trawler.NODEFILE);

    // need this mouse model to keep the mouse clicks 
    // aligned with the nodes
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    gm.setMode(ModalGraphMouse.Mode.PICKING);
    vv.setGraphMouse(gm);
    jf.setIconImage(imageTrawler);
    jf.pack();

    jf.show();
    controlBoxFrame.setVisible(true);
    timer = new Timer();
    timer.schedule(new UpdateTask(), 500, 500);

}

From source file:com.eviware.soapui.impl.wsdl.panels.mock.WsdlMockServiceDesktopPanel.java

private JComponent buildContent() {
    JTabbedPane tabs = new JTabbedPane();
    inspectorPanel = JInspectorPanelFactory.build(buildOperationList());

    tabs.addTab("Operations", inspectorPanel.getComponent());
    addTabs(tabs, inspectorPanel);//from  w w w  .ja  v  a 2 s. c  o  m

    if (StringUtils.hasContent(getModelItem().getDescription())
            && getModelItem().getSettings().getBoolean(UISettings.SHOW_DESCRIPTIONS)) {
        inspectorPanel.setCurrentInspector("Description");
    }

    return UISupport.createTabPanel(tabs, true);
}

From source file:Main.java

public JComponent makeUI() {
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPane.setUI(new javax.swing.plaf.basic.BasicTabbedPaneUI() {
        @Override/*from  ww w.j ava2s .c  o m*/
        protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
            return 32;
        }

        @Override
        protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex,
                Rectangle iconRect, Rectangle textRect) {
            if (tabIndex == 0) {
                rects[tabIndex].height = 30 + 1;
                rects[tabIndex].y = 32 - rects[tabIndex].height + 1;
            } else if (tabIndex == 1) {
                rects[tabIndex].height = 26 + 1;
                rects[tabIndex].y = 32 - rects[tabIndex].height + 1;
            }
            super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
        }
    });
    tabbedPane.addTab("000", new JLabel("ok"));
    tabbedPane.addTab("111", new JScrollPane(new JTable()));
    tabbedPane.addTab("222", new JSplitPane());

    return tabbedPane;
}

From source file:mekhq.gui.FinancesTab.java

@Override
public void initTab() {
    resourceMap = ResourceBundle.getBundle("mekhq.resources.FinancesTab", new EncodeControl()); //$NON-NLS-1$

    GridBagConstraints gridBagConstraints;

    setLayout(new GridBagLayout());
    ChartPanel financeAmountPanel = (ChartPanel) createGraphPanel(GraphType.BALANCE_AMOUNT);
    ChartPanel financeMonthlyPanel = (ChartPanel) createGraphPanel(GraphType.MONTHLY_FINANCES);

    financeModel = new FinanceTableModel();
    financeTable = new JTable(financeModel);
    financeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    financeTable.addMouseListener(new FinanceTableMouseAdapter(getCampaignGui(), financeTable, financeModel));
    financeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    TableColumn column = null;/*from w ww .j a v  a2s.c  o  m*/
    for (int i = 0; i < FinanceTableModel.N_COL; i++) {
        column = financeTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(financeModel.getColumnWidth(i));
        column.setCellRenderer(financeModel.getRenderer());
    }
    financeTable.setIntercellSpacing(new Dimension(0, 0));
    financeTable.setShowGrid(false);

    loanModel = new LoanTableModel();
    loanTable = new JTable(loanModel);
    loanTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    loanTable.addMouseListener(new LoanTableMouseAdapter(getCampaignGui(), loanTable, loanModel));
    loanTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    column = null;
    for (int i = 0; i < LoanTableModel.N_COL; i++) {
        column = loanTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(loanModel.getColumnWidth(i));
        column.setCellRenderer(loanModel.getRenderer());
    }
    loanTable.setIntercellSpacing(new Dimension(0, 0));
    loanTable.setShowGrid(false);
    JScrollPane scrollLoanTable = new JScrollPane(loanTable);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    JPanel panBalance = new JPanel(new GridBagLayout());
    panBalance.add(new JScrollPane(financeTable), gridBagConstraints);
    panBalance.setMinimumSize(new java.awt.Dimension(350, 100));
    panBalance.setBorder(BorderFactory.createTitledBorder("Balance Sheet"));
    JPanel panLoan = new JPanel(new GridBagLayout());
    panLoan.add(scrollLoanTable, gridBagConstraints);

    JTabbedPane financeTab = new JTabbedPane();
    financeTab.setMinimumSize(new java.awt.Dimension(450, 300));
    financeTab.setPreferredSize(new java.awt.Dimension(450, 300));

    JSplitPane splitFinances = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panBalance, financeTab);
    splitFinances.setOneTouchExpandable(true);
    splitFinances.setContinuousLayout(true);
    splitFinances.setResizeWeight(1.0);
    splitFinances.setName("splitFinances");

    financeTab.addTab(resourceMap.getString("activeLoans.text"), panLoan);
    financeTab.addTab(resourceMap.getString("cbillsBalanceTime.text"), financeAmountPanel);
    financeTab.addTab(resourceMap.getString("monthlyRevenueExpenditures.text"), financeMonthlyPanel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(splitFinances, gridBagConstraints);

    JPanel panelFinanceRight = new JPanel(new BorderLayout());

    JPanel pnlFinanceBtns = new JPanel(new GridLayout(2, 2));
    btnAddFunds = new JButton("Add Funds (GM)");
    btnAddFunds.addActionListener(ev -> addFundsActionPerformed());
    btnAddFunds.setEnabled(getCampaign().isGM());
    pnlFinanceBtns.add(btnAddFunds);
    JButton btnGetLoan = new JButton("Get Loan");
    btnGetLoan.addActionListener(e -> showNewLoanDialog());
    pnlFinanceBtns.add(btnGetLoan);

    btnManageAssets = new JButton("Manage Assets (GM)");
    btnManageAssets.addActionListener(e -> manageAssets());
    btnManageAssets.setEnabled(getCampaign().isGM());
    pnlFinanceBtns.add(btnManageAssets);

    panelFinanceRight.add(pnlFinanceBtns, BorderLayout.NORTH);

    areaNetWorth = new JTextArea();
    areaNetWorth.setLineWrap(true);
    areaNetWorth.setWrapStyleWord(true);
    areaNetWorth.setFont(new Font("Courier New", Font.PLAIN, 12));
    areaNetWorth.setText(getCampaign().getFinancialReport());
    areaNetWorth.setEditable(false);

    JScrollPane descriptionScroll = new JScrollPane(areaNetWorth);
    panelFinanceRight.add(descriptionScroll, BorderLayout.CENTER);
    areaNetWorth.setCaretPosition(0);
    descriptionScroll.setMinimumSize(new Dimension(300, 200));

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.weighty = 1.0;
    add(panelFinanceRight, gridBagConstraints);
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildMain() {
    final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);

    tabbedPane.setUI(new CustomTabbedPaneUI());

    st = new StatusTab(configuration);
    tt = new TracesTab(configuration, this);
    gt = new GeneralTab(configuration, this);
    nt = new NavigationShareTab(configuration, this);
    tr = new TranscodingTab(configuration, this);
    ht = new HelpTab();

    tabbedPane.addTab(Messages.getString("LooksFrame.18"), st.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.19"), tt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.20"), gt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.22"), nt.build());
    if (!configuration.isDisableTranscoding()) {
        tabbedPane.addTab(Messages.getString("LooksFrame.21"), tr.build());
    } else {/*from w w w .  java  2 s . c om*/
        tr.build();
    }
    tabbedPane.addTab(Messages.getString("LooksFrame.24"), new HelpTab().build());
    tabbedPane.addTab(Messages.getString("LooksFrame.25"), new AboutTab().build());

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int selectedIndex = tabbedPane.getSelectedIndex();

            if (HELP_PAGES[selectedIndex] != null) {
                PMS.setHelpPage(HELP_PAGES[selectedIndex]);

                // Update the contents of the help tab itself
                ht.updateContents();
            }
        }
    });

    tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5));

    /*
     * Set the orientation of the tabbedPane.
     * Note: Do not use applyComponentOrientation() here because it
     * messes with the layout of several tabs.
     */
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    tabbedPane.setComponentOrientation(orientation);

    return tabbedPane;
}

From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java

BamInternalFrame(BamFileRef ref) {
    super(ref.bamFile.getName(), true, false, true, true);
    this.ref = ref;
    JPanel mainPane = new JPanel(new BorderLayout(5, 5));
    setContentPane(mainPane);/*from w w w . j a  v a2  s  .  co  m*/
    JTabbedPane tabbedPane = new JTabbedPane();
    mainPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel pane = new JPanel(new BorderLayout(5, 5));
    tabbedPane.addTab("BAM", pane);

    this.tableModel = new BamTableModel();
    this.jTable = createTable(tableModel);
    this.jTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    this.jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JScrollPane scroll1 = new JScrollPane(this.jTable);

    this.infoTableModel = new FlagTableModel();
    JTable tInfo = createTable(this.infoTableModel);

    this.genotypeTableModel = new SAMTagAndValueModel();
    JTable tGen = createTable(this.genotypeTableModel);

    this.groupTableModel = new ReadGroupTableModel();
    JTable tGrp = createTable(this.groupTableModel);

    JPanel splitH = new JPanel(new GridLayout(1, 0, 5, 5));
    splitH.add(new JScrollPane(tInfo));
    splitH.add(new JScrollPane(tGen));
    splitH.add(new JScrollPane(tGrp));

    JSplitPane splitVert = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll1, splitH);

    this.jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            int row = jTable.getSelectedRow();
            SAMRecord ctx;
            if (row == -1 || (ctx = tableModel.getElementAt(row)) == null) {
                infoTableModel.setContext(null);
                genotypeTableModel.setContext(null);
                groupTableModel.setContext(null);
            } else {
                infoTableModel.setContext(ctx);
                genotypeTableModel.setContext(ctx);
                groupTableModel.setContext(ctx);
            }

        }
    });

    pane.add(splitVert);

    //header as text
    pane = new JPanel(new BorderLayout(5, 5));
    tabbedPane.addTab("Header", pane);
    JTextArea area = new JTextArea(String.valueOf(ref.header.getTextHeader()));
    area.setCaretPosition(0);
    area.setEditable(false);
    pane.add(new JScrollPane(area), BorderLayout.CENTER);

    //dict
    pane = new JPanel(new BorderLayout(5, 5));
    tabbedPane.addTab("Reference", pane);
    JTable dictTable = createTable(new SAMSequenceDictionaryTableModel(ref.header.getSequenceDictionary()));
    dictTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    pane.add(new JScrollPane(dictTable), BorderLayout.CENTER);

    this.selList = new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            listSelectionChanged();
        }
    };

    this.addInternalFrameListener(new InternalFrameAdapter() {
        @Override
        public void internalFrameActivated(InternalFrameEvent e) {
            jTable.getSelectionModel().addListSelectionListener(selList);
        }

        @Override
        public void internalFrameDeactivated(InternalFrameEvent e) {
            jTable.getSelectionModel().removeListSelectionListener(selList);
        }
    });
}