Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Generated Object

A JTabbedPane

Value Argument

The tabbedPane() node accepts no value argument.


In addition to JComponent attributes, tabbedPane supports these additional attributes:

  • model <SingleSelectionModel> The model that tracks the tab selection. not normally set by the end user.
  • tabPlacement <int> One of JTabbedPane.TOP, JTabbedPane.BOTTOM, JTabbedPane.LEFT, or JTabbedPane.RIGHT, indicates where the tabs should be palced.
  • tabLayoutPolicy <int> One of JTabbedPane.WRAP_TAB_LAYOUT or JTabbedPane.SCROLL_TAB_LAYOUT. Determines the behavior of the tabs when there are too many for one line. Either multiple lines, or a single line with scroll controls (respectively)
  • selectedIndex <int> The tab index to be selected initially. Do not combine with selectedComponent
  • selectedComponent <Component> The tab representing the component to be selected initally. Do not combine with selectedIndex.


All immediate children of the JTabbedPane that are Components are added to the tabbed pane as tabs. In addition, these children also can have the following attributes, which apply to the tab representiong those components

  • title <String> The text title on the tab. If this is missing the name property of the component is used (which defaults to an empty string)
  • tabIcon <Icon> The icon to be used on the tab, usually to the left of the text.
  • tabDisabledIcon <Icon> The icon to be displayed when the tab is disabled. If tabIcon: is specified but tabDisabledIcon isn't then a disable icon will be automatically generated base on the Look and Feel.
  • tabToolTip <String> The toolTip to be displayed when the mouse is hovering over the tab. (note that this is different than the component in the tab, use toolTip: for the component itself)
  • tabBackground <Color> The background color of the tab. If this isn't specified a Look and Feel dependent value will be provided. The Look and Feel may ignore this (Windows Vista does)
  • tabForeground <Color> The foreground text color of the tab. If this isn't specified a Look and Feel dependent value will be provided. The Look and Feel may ignore this (Windows Vista does)
  • tabEnabled <booelan> A flag to indicate whether or not this tab should be considered activated and accessible.
  • tabMnemonic <int or String or char> The mnemonic of the tab to be used for keyboard navigation. Do not combine with tabDisplayedMnemonicIndex unless the characters match up. Character must be in title/upper case
  • tabDispalyedMnemonicIndex <int> The character index in the title to use for the mnemonic. Useful when a more prominent character should be used, like "Stop Operation", a mnemonic of O would ordinarily underline the 'o' in Stop.


Code Block
tabbedPane(tabPlacement: JTabbedPane.LEFT) {
  label('One', title:'One', tabToolTip:'Uno!')
  label('Green', title:'Green', tabBackground:java.awt.Color.GREEN)
  label('Stop Operation', title:'Stop Operation', tabMnemonic:'O')
  label('Stop Operation', title:'Stop Operation', tabDisplayedMnemonicIndex:5)
Code Block
   tabbedPane() {
      panel(name:'One') {
      panel(name:'Two') {