Class JTabbedPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, FieldReconciler.Reconcilable

public class JTabbedPane extends JComponent implements Accessible, SwingConstants, FieldReconciler.Reconcilable
Emulator for JTabbedPane. See D_jtabbedpane.
See Also:
  • Field Details

  • Constructor Details

    • JTabbedPane

      public JTabbedPane()
    • JTabbedPane

      public JTabbedPane(int tabPlacement)
    • JTabbedPane

      public JTabbedPane(int tabPlacement, int tabLayoutPolicy)
  • Method Details

    • reconcileFields

      public final void reconcileFields()
      D_field_write_reconcile repair hook — see JSlider.reconcileFields().
      Specified by:
      reconcileFields in interface FieldReconciler.Reconcilable
    • createChangeListener

      protected ChangeListener createChangeListener()
    • addChangeListener

      public void addChangeListener(ChangeListener l)
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
    • getChangeListeners

      public ChangeListener[] getChangeListeners()
    • fireStateChanged

      protected void fireStateChanged()
      Shows the selected tab's component and hides the one shown before, then notifies the listeners, last to first. The JDK also moves the focus into the new component when the old one held it; that is not reproduced.
    • getModel

      public SingleSelectionModel getModel()
    • setModel

      public void setModel(SingleSelectionModel model)
    • getSelectedIndex

      public int getSelectedIndex()
    • setSelectedIndex

      public void setSelectedIndex(int index)
    • getSelectedComponent

      public Component getSelectedComponent()
    • setSelectedComponent

      public void setSelectedComponent(Component c)
    • getTabPlacement

      public int getTabPlacement()
    • setTabPlacement

      public void setTabPlacement(int tabPlacement)
    • getTabLayoutPolicy

      public int getTabLayoutPolicy()
    • setTabLayoutPolicy

      public void setTabLayoutPolicy(int tabLayoutPolicy)
    • insertTab

      public void insertTab(String title, Icon icon, Component component, String tip, int index)
    • addTab

      public void addTab(String title, Icon icon, Component component, String tip)
    • addTab

      public void addTab(String title, Icon icon, Component component)
    • addTab

      public void addTab(String title, Component component)
    • add

      public Component add(Component component)
      Overrides:
      add in class Container
    • add

      public Component add(String title, Component component)
      Overrides:
      add in class Container
    • add

      public Component add(Component component, int index)
      Overrides:
      add in class Container
    • add

      public void add(Component component, Object constraints)
      A String constraint is the title and an Icon the icon; anything else is ignored.
      Overrides:
      add in class Container
    • add

      public void add(Component component, Object constraints, int index)
      Overrides:
      add in class Container
    • removeTabAt

      public void removeTabAt(int index)
    • remove

      public void remove(Component component)
      Overrides:
      remove in class Container
    • remove

      public void remove(int index)
      Removes the tab at index, not the child — they differ, as in the JDK.
      Overrides:
      remove in class Container
    • removeAll

      public void removeAll()
      Deselects first, so it fires once, then removes the tabs last to first.
      Overrides:
      removeAll in class Container
    • getTabCount

      public int getTabCount()
    • getTabRunCount

      public int getTabRunCount()
      One run while there are tabs: the browser scrolls the tab strip rather than wrapping it.
    • getTitleAt

      public String getTitleAt(int index)
    • getIconAt

      public Icon getIconAt(int index)
    • getDisabledIconAt

      public Icon getDisabledIconAt(int index)
      The icon set by setDisabledIconAt(int, Icon). The JDK's L&F derives a greyed one when none was set; with no L&F, this answers null instead.
    • getToolTipTextAt

      public String getToolTipTextAt(int index)
    • getBackgroundAt

      public Color getBackgroundAt(int index)
      The tab's own colour, or this pane's background when it has none.
    • getForegroundAt

      public Color getForegroundAt(int index)
      See Also:
    • isEnabledAt

      public boolean isEnabledAt(int index)
    • getComponentAt

      public Component getComponentAt(int index)
    • getMnemonicAt

      public int getMnemonicAt(int tabIndex)
    • getDisplayedMnemonicIndexAt

      public int getDisplayedMnemonicIndexAt(int tabIndex)
    • getBoundsAt

      public Rectangle getBoundsAt(int index)
      Always null: the server has no tab geometry (R_layouts_close_enough).
    • setTitleAt

      public void setTitleAt(int index, String title)
      Fires ("indexForTitle", -1, index), guarded — as the JDK guards it — on oldTitle != title by reference, not equals. So two equal-but-distinct Strings fire and two identical references do not; faithful to the JDK's body, odd as it reads (D_owed_events).
    • setIconAt

      public void setIconAt(int index, Icon icon)
    • setDisabledIconAt

      public void setDisabledIconAt(int index, Icon disabledIcon)
    • setToolTipTextAt

      public void setToolTipTextAt(int index, String toolTipText)
    • setBackgroundAt

      public void setBackgroundAt(int index, Color background)
      Stores the tab's colour and fires nothing, as the JDK's repaints and fires nothing; null clears it. The surrogate declines the rendering: a Vaadin TabSheet has no per-tab background (R_decline_effect_only).
    • setForegroundAt

      public void setForegroundAt(int index, Color foreground)
      See Also:
    • setEnabledAt

      public void setEnabledAt(int index, boolean enabled)
    • setComponentAt

      public void setComponentAt(int index, Component component)
      Replaces the tab's content, keeping the selection. null leaves the tab without one, as the JDK allows; the peer shows an empty area.
    • setDisplayedMnemonicIndexAt

      public void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)
      Throws the JDK's IllegalArgumentException for an index outside the title. The surrogate declines the effect: a Vaadin tab has no underlined character.
    • setMnemonicAt

      public void setMnemonicAt(int tabIndex, int mnemonic)
      Fires "displayedMnemonicIndexAt" when the underlined character moves, then "mnemonicAt", both with (null, null) — the JDK's literal argument pair. PropertyChangeSupport lets a both-null pair through, so the event always reaches listeners and carries no payload (D_owed_events). The surrogate declines the keyboard effect.
    • setTabComponentAt

      public void setTabComponentAt(int index, Component component)
      Custom tab header, not a child in Container.components. Throws the JDK's IllegalArgumentException for a component that is already a tab's content, and moves one that is already another tab's header.
    • getTabComponentAt

      public Component getTabComponentAt(int index)
    • indexOfTab

      public int indexOfTab(String title)
      null finds an empty title. Throws NPE past a tab whose title was set to null, as the JDK does.
    • indexOfTab

      public int indexOfTab(Icon icon)
    • indexOfComponent

      public int indexOfComponent(Component component)
      null finds the first tab without a content component.
    • indexOfTabComponent

      public int indexOfTabComponent(Component tabComponent)
    • indexAtLocation

      public int indexAtLocation(int x, int y)
      Always -1: the server has no tab geometry (R_layouts_close_enough).
    • toString

      public String toString()
      Overrides:
      toString in class Component
    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JComponent
    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JComponent
    • getUI

      public TabbedPaneUI getUI()
      Overrides:
      getUI in class JComponent
    • setUI

      public void setUI(TabbedPaneUI ui)
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component
    • paramString

      protected String paramString()
      Overrides:
      paramString in class JComponent