Java Code Examples for javax.swing.JTabbedPane#indexOfTabComponent()
The following examples show how to use
javax.swing.JTabbedPane#indexOfTabComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ButtonTabComponent.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
public ButtonTabComponent(JTabbedPane pane, Function<CodeEditor<?, ?, ?>, Unit> callback) { // unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; this.callback = callback; setOpaque(false); // make JLabel read titles from JTabbedPane JLabel label = new JLabel() { @Override public String getText() { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; add(label); // add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); // tab button JButton button = new TabButton(); add(button); // add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example 2
Source File: ButtonTabComponent.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
public ButtonTabComponent(final JTabbedPane pane) { //unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; setOpaque(false); //make JLabel read titles from JTabbedPane JLabel label = new JLabel() { @Override public String getText() { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; add(label); //add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); //tab button button = new TabButton(); add(button); //add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example 3
Source File: ButtonTabComponent.java From binnavi with Apache License 2.0 | 5 votes |
/** * Creates a new button tab component. * * @param pane pane the button tab component belongs to. */ public ButtonTabComponent(final JTabbedPane pane) { // unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); m_pane = Preconditions.checkNotNull(pane, "IE01213: TabbedPane is null"); setOpaque(false); // make JLabel read titles from JTabbedPane final JLabel label = new JLabel() { private static final long serialVersionUID = 8139543899934835869L; @Override public String getText() { final int index = pane.indexOfTabComponent(ButtonTabComponent.this); if (index != -1) { return pane.getTitleAt(index); } return null; } }; add(label); // add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); // tab button final JButton button = new TabButton(); add(button); // add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example 4
Source File: MButtonTabComponent.java From javamelody with Apache License 2.0 | 5 votes |
/** * Constructor. * @param pane JTabbedPane */ public MButtonTabComponent(final JTabbedPane pane) { //unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new IllegalArgumentException("TabbedPane is null"); } this.pane = pane; setOpaque(false); //make JLabel read titles from JTabbedPane final JLabel label = new JLabel() { private static final long serialVersionUID = 1L; @Override public String getText() { final int i = pane.indexOfTabComponent(MButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; add(label); //add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); //tab button final JButton button = new TabButton(); add(button); //add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example 5
Source File: ButtonTabComponent.java From JCEditor with GNU General Public License v2.0 | 5 votes |
public ButtonTabComponent(final JTabbedPane pane, ArrayList<AreaDeTexto> adts, ArrayList<String> arqsAbertos) { //unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException(""); } this.pane = pane; this.adts = adts; this.arquivosAbertos = arqsAbertos; setOpaque(false); //make JLabel read titles from JTabbedPane JLabel label = new JLabel() { public String getText() { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; add(label); //add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); //tab button JButton button = new TabButton(); add(button); //add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }
Example 6
Source File: ButtonTabComponent.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
public ButtonTabComponent(final JTabbedPane pane) { //unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; setOpaque(false); //make JLabel read titles from JTabbedPane JLabel label = new JLabel() { public String getText() { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; add(label); //add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); //tab button JButton button = new TabButton(); add(button); //add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); }