borland Packages  Class Hierarchy  jbcl.view Package  Index 

TabsetView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----borland.jbcl.view.BeanPanel
                                   +----borland.jbcl.view.TabsetView
                                           +----borland.jbcl.control.TabsetControl
                                           +----borland.jbcl.control.TabsetPanel

About the TabsetView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements ItemPaintSite, VectorModelListener, VectorSelectionListener, VectorView, ImageObserver, MenuContainer, Serializable, EventListener

The TabsetView component is a view element for developing new composite components that simulate a set of mutually exclusive tabs, like tabs in a notebook. You can use it to create tabbed, multi-page dialog boxes, for example. It requires a VectorModel data model and a VectorViewManager view manager.

The labels property is an array of strings that contains the labels that appear on the tabs. The tabs can appear on the top of the view or the bottom, depending on the value of the tabsOnTop property.

To add a new tab to the view, call one of the addTab() methods; one of them appends the tab to the row of tabs, and the other inserts the tab into a specified position. To remove a tab, call removeTab(). Change a specified tab with the renameTab() method.

To identify the currently selected tab or to make a tab the selected tab, use either the selectedTab property, which identifies the tab by its label, or the selectedIndex, which identifies the tab by its position in the row of tabs. To obtain the label of a specific tab, call getLabel(). To set the label of a tab, call setLabel(). The label can be any type of Object, so you can put a graphic on a label, for example.

TabsetView has several properties that affect its appearance, such as alignment, which aligns the label, itemMargins, which specifics the margins around the labels, and thickBorder, which specifies the type of border that appears around the view.

If there are more tabs than can be displayed at once in the view, two scroll buttons appear so the user can scroll to see the hidden tabs. The scrollRight() and scrollLeft() methods scroll the tabs programmatically.

To paint the view call paintComponent(). To paint a single tab only, use the repaintTab() method.


TabsetView variables

Variables implemented in this class

Variables implemented in borland.jbcl.view.BeanPanel

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in java.awt.Component

TabsetView constructors

TabsetView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.BeanPanel

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

TabsetView methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.BeanPanel

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

TabsetView event listeners


TabsetView variables

defaultPainter

  protected transient ItemPainter defaultPainter

model

  protected transient VectorModel model

selection

  protected transient WritableVectorSelection selection

viewManager

  protected transient VectorViewManager viewManager

writeModel

  protected transient WritableVectorModel writeModel

TabsetView constructors

TabsetView()

  public TabsetView()
Creates a TabsetView object with no tabs.


TabsetView properties

alignment

 public int getAlignment()
 public void setAlignment(int align)
Determines the alignment of the text in the tabs. To specify an alignment, use one of the Alignment constants.

Parameters:

align
One of the alignment constants.

clientBordered

 public boolean isClientBordered()
 public void setClientBordered(boolean bordered)
When true, a raised border is drawn around the (non-tab) client area. The default value is false.

Parameters:

bordered
If true, a border displays around the client area; if false, no border appears.

enabled

 public void setEnabled(boolean enabled)
Determines whether the tabset view is enabled. If the enabled parameter is true, the enabled property is true and the tabset view can be used.

focusAware

 public boolean isFocusAware()
 public void setFocusAware(boolean focusAware)
Determines whether the view can receive the focus.

font

 public void setFont(java.awt.Font font)

itemMargins

 public Insets getItemMargins()
 public void setItemMargins(java.awt.Insets margins)
Determines the margins around the text in the tabs.

Parameters:

margins
The Insets object that specifies the margins around all sides of the text.

labels

 public String[] getLabels()
 public void setLabels(java.lang.String[] labels)
Determines the text of the tabs, which are called the labels. The labels property is an array of strings, so you can set all the labels of the tabs at once. Each label string must be unique.

Parameters:

labels
An array of strings that become the labels of the tabs.

model

 public VectorModel getModel()
 public void setModel(borland.jbcl.model.VectorModel vm)
Specifies the data model object that provides items for the component. The TabsetView component requires a vector model. This property value must be set.

Parameters:

vm
The VectorModel for the TabsetView.

preferredSize

 public Dimension getPreferredSize()
Returns the preferred size of the TabsetView.

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)
Determines whether the user may change the data displayed in the component at runtime. The readOnly property also returns true if the model is not writable.

Parameters:

ro
If true, the user can change the data; if false, the data cannot be changed.

selectedIndex

 public int getSelectedIndex()
 public void setSelectedIndex(int index)
Determines the currently selected tab. The first tab is tab number zero. If no tab is selected, getSelectedIndex returns -1.

Parameters:

index
The position of the tab in the row of tabs. The first tab has an index value of 0.

selectedTab

 public String getSelectedTab()
 public void setSelectedTab(java.lang.Object item)
Determines the selected tab. If no tab is selected, setSelectedTab() returns null.

Parameters:

item
The object used to specify the desired tab.

selection

 public WritableVectorSelection getSelection()
 public void setSelection(borland.jbcl.model.WritableVectorSelection vs)
Determines the selection object that holds the currently selected tab.

Parameters:

vs
The WritableVectorSelection object for TabsetView.

showRollover

 public boolean isShowRollover()
 public void setShowRollover(boolean showRollover)
The showRollover property enables/disables the repainting of the rollover item. The rollover item is the item that currently has the mouse cursor over it. If an item painter plugged into the tabset ignores the ROLLOVER bit, this property has no effect. By default, showRollover is false.

siteComponent

 public Component getSiteComponent()
The component hosting the tabset view.

subfocus

 public int getSubfocus()
 public void setSubfocus(int subfocus)
Determines the subfocus within the TabsetView. The subfocus will always be the same as the selected tab.

Parameters:

subfocus
The position of the subfocused tab in the row of tabs. The first tab has a position of 0.

tabsOnTop

 public boolean isTabsOnTop()
 public void setTabsOnTop(boolean tabsOnTop)
Determines whether the tabs appear on the top or bottom of the view.

Parameters:

tabsOnTop
If true, the tabs appear on the top; if false, the tabs appear on the bottom.

thickBorder

 public boolean isThickBorder()
 public void setThickBorder(boolean thickBorder)
Determines whether a raised border is drawn around the (non-tab) client area.

Parameters:

thickBorder
If true, a border is drawn; if false, it isn't.

transparent

 public boolean isTransparent()
Determines whether the background of the view is transparent or opaque. If transparent is true, other objects behind the tabset show through.

viewManager

 public VectorViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.VectorViewManager viewManager)
Determines the view manager object that handles viewer and editor selection for this component. This property must be set.

writeModel

 public WritableVectorModel getWriteModel()
Returns the model for the TabsetView.


TabsetView methods

addTab(int, java.lang.Object)

  public void addTab(int aheadOf, java.lang.Object item)
Adds a tab to the TabsetView in a specified position.

Parameters:

aheadOf
The current position of the tab in the row of tabs the new tab is inserted ahead of. The first tab has the position of 0.
item
The object that appears on the new tab, such as a string label or a graphic.

addTab(java.lang.Object)

  public void addTab(java.lang.Object item)
Adds a tab after the last tab in the row of tabs.

Parameters:

item
The object that appears on the new tab, such as a string label or a graphic.

adjustScrollbar()

  protected void adjustScrollbar()
Determines whether the view needs to scroll, and if so, which tabs are visible.

doLayout()

  public void doLayout()
Lays out the component and calls adjustScrollbar().

Overrides: java.awt.Container.doLayout()

getLabel(int)

  public String getLabel(int index)
Returns the label of the tab at the specified index. The first tab is tab number zero. getLabel() returns null if the specified index is out of range.

Parameters:

index
The position of the tab in the row of tabs. The first tab has an index of 0.

hitTest(int, int)

  public int hitTest(int x, int y)
Determines where the mouse was clicked within the view.

insets()

  public Insets insets()
Returns the Insets object of the view, taking into account the alignment of the tabs.

Overrides: java.awt.Container.insets()

paintComponent(java.awt.Graphics)

  public void paintComponent(java.awt.Graphics g)
Paints or repaints the TabsetView component.

Parameters:

g
The Graphics object used to paint on.

Overrides: borland.jbcl.view.BeanPanel.paintComponent(java.awt.Graphics)

preProcessSubfocusEvent(borland.jbcl.model.VectorSubfocusEvent)

  protected boolean preProcessSubfocusEvent(borland.jbcl.model.VectorSubfocusEvent e)
Determines if any listeners of the VectorSubfocusEvent will veto the event.

Parameters:

e
The vector subfocus event.

processFocusEvent(java.awt.event.FocusEvent)

  protected void processFocusEvent(java.awt.event.FocusEvent e)
Calls super.processFocusEvent, then repaints the selected tab.

Parameters:

e
The focus event that occurs when the tab gets the focus.

Overrides: borland.jbcl.view.BeanPanel.processFocusEvent(FocusEvent)

processKeyPressed(java.awt.event.KeyEvent)

  protected void processKeyPressed(java.awt.event.KeyEvent e)
Handles the following keys when they are pressed:
Home Selects the first tab
Left Selects the tab to the left
Right Selects the tab to the right of the currently selected tab
End Seleects the last tab

Parameters:

e
The key event that occurs when a key is pressed.

Overrides: borland.jbcl.view.BeanPanel.processKeyPressed(KeyEvent)

processMouseExited(java.awt.event.MouseEvent)

  protected void processMouseExited(java.awt.event.MouseEvent e)

Overrides: borland.jbcl.view.BeanPanel.processMouseExited(java.awt.event.MouseEvent)

processMouseMoved(java.awt.event.MouseEvent)

  protected void processMouseMoved(java.awt.event.MouseEvent e)

Overrides: borland.jbcl.view.BeanPanel.processMouseMoved(java.awt.event.MouseEvent)

processMousePressed(java.awt.event.MouseEvent)

  protected void processMousePressed(java.awt.event.MouseEvent e)
Selects a tab if the mouse clicks it.

Parameters:

e
The mouse event that occurs when the mouse clicks a tab.

Overrides: borland.jbcl.view.BeanPanel.processMousePressed(MouseEvent)

processSubfocusEvent(borland.jbcl.model.VectorSubfocusEvent)

  protected void processSubfocusEvent(borland.jbcl.model.VectorSubfocusEvent e)

removeTab(java.lang.Object)

  public void removeTab(java.lang.Object item)
Removes the specified tab from the tab view.

Parameters:

item
The object that identifies a tab, such as a string or a graphic.

renameTab(java.lang.String, java.lang.String)

  public void renameTab(java.lang.String oldName, java.lang.String newName)

Changes the label of the tab with the oldName to the newName.

Parameters:

oldName
The old label of the tab.
newName
The new label of the tab.

repaintTab(int)

  public void repaintTab(int index)
Repaints the specified tab.

Parameters:

index
The position of the tab in the row of tabs. The first tab in the row has an index value of 0.

scrollCheck(int, int)

  protected boolean scrollCheck(int x, int y)
Checks to see if the scrollbar needs scrolling.

Parameters:

x
The position of a mouse click on the x-axis.
y
The position of a mouse click on the y-axis.

scrollLeft()

  protected void scrollLeft()
Scrolls the scrollbar to the left. scrollLeft() calls adjustScrollbar()

scrollRight()

  protected void scrollRight()
Scrolls the scrollbar to the right. scrollRight() calls adjustScrollbar().

selectTab(int)

  protected void selectTab(int index)
Selects a specified tab.

Parameters:

index
The position of the tab in the row of tabs. The first tab has an index value of 0.

setBorderHeight(int)

  protected void setBorderHeight(int height)
Sets the height of the border.

Parameters:

height
The desired height of the border in pixels.

setLabel(int, java.lang.Object)

  public void setLabel(int index, java.lang.Object item)
Sets the label of a specified tab.

Parameters:

index
The position of the desired tab in the row of tabs. The first tab in the row has an index value of 0.
item
The object that labels the tab, such as a string or a graphic.

updateTabInfo()

  protected void updateTabInfo()
Updates the tabInfo array that contains the tab information for each tab. Tab information includes such things as the item that labels the tab, the width of the tab, the height of the item, and so on. Each tab on the view has a corresponding TabInfo object in the tabInfo array.

TabsetView event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public synchronized void addActionListener(java.awt.event.ActionListener l)
 public synchronized void removeActionListener(java.awt.event.ActionListener l)

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public void removeContainerListener(java.awt.event.ContainerListener )

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener )
 public synchronized void removeFocusListener(java.awt.event.FocusListener )

key

 public synchronized void addKeyListener(java.awt.event.KeyListener )
 public synchronized void removeKeyListener(java.awt.event.KeyListener )

model

 public void addModelListener(borland.jbcl.model.VectorModelListener l)
 public void removeModelListener(borland.jbcl.model.VectorModelListener l)

mouse

 public synchronized void addMouseListener(java.awt.event.MouseListener )
 public synchronized void removeMouseListener(java.awt.event.MouseListener )

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener )
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

selection

 public void addSelectionListener(borland.jbcl.model.VectorSelectionListener l)
 public void removeSelectionListener(borland.jbcl.model.VectorSelectionListener l)

subfocus

 public void addSubfocusListener(borland.jbcl.model.VectorSubfocusListener l)
 public void removeSubfocusListener(borland.jbcl.model.VectorSubfocusListener l)

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )