List of usage examples for javax.swing JTabbedPane addTab
public void addTab(String title, Component component)
component
represented by a title
and no icon. From source file:MainClass.java
static void add(JTabbedPane tabbedPane, String label, int mnemonic) { int count = tabbedPane.getTabCount(); JButton button = new JButton(label); tabbedPane.addTab(label, button); tabbedPane.setMnemonicAt(count, mnemonic); }
From source file:MainClass.java
static void addIt(JTabbedPane tabbedPane, String text) { JLabel label = new JLabel(text); JButton button = new JButton(text); JPanel panel = new JPanel(); panel.add(label);//from w w w .j a v a 2 s. c o m panel.add(button); tabbedPane.addTab(text, panel); }
From source file:TabSample.java
static void addIt(JTabbedPane tabbedPane, String text) { JLabel label = new JLabel(text); JButton button = new JButton(text); JPanel panel = new JPanel(); panel.add(label);/* w w w . ja v a2 s . c o m*/ panel.add(button); tabbedPane.addTab(text, panel); tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, new JTextField(text)); }
From source file:MainClass.java
private void makeGUI() { JTabbedPane jtp = new JTabbedPane(); jtp.addTab("Cities", new CitiesPanel()); jtp.addTab("Colors", new ColorsPanel()); jtp.addTab("Flavors", new FlavorsPanel()); add(jtp);/* w w w . jav a2 s. c om*/ }
From source file:org.chocosolver.gui.panels.DepthPanel.java
@Override public void plug(JTabbedPane tabbedpanel) { super.plug(tabbedpanel); tabbedpanel.addTab("Depth", this); }
From source file:org.chocosolver.gui.panels.FreeVarsPanel.java
@Override public void plug(JTabbedPane tabbedpanel) { super.plug(tabbedpanel); tabbedpanel.addTab("free vars", this); }
From source file:Main.java
public JComponent makeUI() { UIManager.put("TabbedPane.tabInsets", new Insets(2, 2, 2, 50)); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("A", new JPanel()); JPanel p = new JPanel(new BorderLayout()); p.add(new JLayer<JTabbedPane>(tabbedPane, new CloseableTabbedPaneLayerUI())); p.add(new JButton(new AbstractAction("add tab") { @Override//from w ww. j a va 2 s . co m public void actionPerformed(ActionEvent e) { tabbedPane.addTab("test", new JPanel()); } }), BorderLayout.SOUTH); return p; }
From source file:org.chocosolver.gui.panels.LeftRightBranchPanel.java
@Override public void plug(JTabbedPane tabbedpanel) { super.plug(tabbedpanel); tabbedpanel.addTab("LR decisions", this); }
From source file:org.chocosolver.gui.panels.ObjectivePanel.java
@Override public void plug(JTabbedPane tabbedpanel) { super.plug(tabbedpanel); if (isOpt) {//from w w w. j av a 2 s .c om tabbedpanel.addTab("Objective", this); } }
From source file:Main.java
private void init() { this.setLayout(new BorderLayout()); JPanel topPanel = new JPanel(); final JLabel topLabel = new JLabel("North"); topPanel.add(topLabel);//from ww w . jav a 2 s . c om this.add(topPanel, BorderLayout.NORTH); JTabbedPane tabbedPane = new JTabbedPane(); JPanel firstTabCont = new JPanel(); firstTabCont.add(new JLabel("First")); tabbedPane.addTab("First", firstTabCont); JPanel secondTabCont = new JPanel(); secondTabCont.add(new JLabel("Second")); tabbedPane.addTab("Second", secondTabCont); this.add(tabbedPane, BorderLayout.CENTER); JPanel bottomPanel = new JPanel(); final JLabel bottomLabel = new JLabel("South"); bottomPanel.add(bottomLabel); this.add(bottomPanel, BorderLayout.SOUTH); tabbedPane.addChangeListener(evt -> { JTabbedPane pane = (JTabbedPane) evt.getSource(); int selectedIndex = pane.getSelectedIndex(); if (selectedIndex == 0) { topLabel.setText(""); topLabel.setText("Hi"); bottomLabel.setText(""); bottomLabel.setText("Bye"); } else { topLabel.setText(""); topLabel.setText("Bye"); bottomLabel.setText(""); bottomLabel.setText("Hi"); } }); this.pack(); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); }