jbcl.view Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----com.borland.jbcl.view.BeanPanel +----com.borland.jbcl.view.TabsetView +----com.borland.jbcl.control.TabsetControl +----com.borland.jbcl.control.TabsetPanel
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.
protected transient ItemPainter defaultPainter
protected transient VectorModel model
protected transient WritableVectorSelection selection
protected int tabBarHeight
protected int tabBarWidth
protected transient VectorViewManager viewManager
protected transient WritableVectorModel writeModel
public TabsetView()Creates a
TabsetView
object with no tabs.
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
util.Alignment
constants.
Parameters:
align
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
public boolean isDoubleBuffer() public void setDoubleBuffer(boolean buffer)This property has been deprecated. Use
isDoubleBuffered
and setDoubleBuffered
.
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.
public boolean isFocusAware() public void setFocusAware(boolean focusAware)Determines whether the view can receive the focus.
public void setFont(Font font)
public Insets getItemMargins() public void setItemMargins(Insets margins)Determines the margins around the text in the tabs.
Parameters:
margins
Insets
object that specifies the margins around all sides of the text.
public String[] getLabels() public void setLabels(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
public VectorModel getModel() public void setModel(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
VectorModel
for the TabsetView
.
public Dimension getPreferredSize()Returns the preferred size of the
TabsetView
.
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
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
public String getSelectedTab() public void setSelectedTab(Object item)Determines the selected tab. If no tab is selected,
setSelectedTab()
returns null.
Parameters:
item
public WritableVectorSelection getSelection() public void setSelection(WritableVectorSelection vs)Determines the selection object that holds the currently selected tab.
Parameters:
vs
WritableVectorSelection
object for TabsetView
.
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.
public Component getSiteComponent()The component hosting the tabset view.
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
public boolean isTabsOnTop() public void setTabsOnTop(boolean tabsOnTop)Determines whether the tabs appear on the top or bottom of the view.
Parameters:
tabsOnTop
public boolean isThickBorder() public void setThickBorder(boolean thickBorder)Determines whether a raised border is drawn around the (non-tab) client area.
Parameters:
thickBorder
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.
public VectorViewManager getViewManager() public void setViewManager(VectorViewManager viewManager)Determines the view manager object that handles viewer and editor selection for this component. This property must be set.
public WritableVectorModel getWriteModel()Returns the model for the
TabsetView
.
public void addTab(int aheadOf, Object item)Adds a tab to the
TabsetView
in a specified position.
Parameters:
aheadOf
item
public void addTab(Object item)Adds a tab after the last tab in the row of tabs.
Parameters:
item
protected void adjustScrollbar()Determines whether the view needs to scroll, and if so, which tabs are visible.
public void doLayout()Lays out the component and calls
adjustScrollbar()
.
Overrides: java.awt.Container.doLayout()
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
public int hitTest(int x, int y)Determines where the mouse was clicked within the view.
public Insets insets()Returns the
Insets
object of the view, taking into account the alignment
of the tabs.
Overrides: java.awt.Container.insets()
public void paintComponent(Graphics g)Paints or repaints the
TabsetView
component.
Parameters:
g
Overrides: com.borland.jbcl.view.BeanPanel.paintComponent(java.awt.Graphics)
protected boolean preProcessSubfocusEvent(VectorSubfocusEvent e)Determines if any listeners of the
VectorSubfocusEvent
will veto the event.
Parameters:
e
protected void processFocusEvent(FocusEvent e)Calls
super.processFocusEvent
, then repaints the selected tab.
Parameters:
e
Overrides: com.borland.jbcl.view.BeanPanel.processFocusEvent(FocusEvent)
protected void processKeyPressed(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
Overrides: com.borland.jbcl.view.BeanPanel.processKeyPressed(KeyEvent)
protected void processMouseExited(MouseEvent e)
Overrides: com.borland.jbcl.view.BeanPanel.processMouseExited(java.awt.event.MouseEvent)
protected void processMouseMoved(MouseEvent e)
Overrides: com.borland.jbcl.view.BeanPanel.processMouseMoved(java.awt.event.MouseEvent)
protected void processMousePressed(MouseEvent e)Selects a tab if the mouse clicks it.
Parameters:
e
Overrides: com.borland.jbcl.view.BeanPanel.processMousePressed(MouseEvent)
protected void processSubfocusEvent(VectorSubfocusEvent e)
public void removeTab(Object item)Removes the specified tab from the tab view.
Parameters:
item
public void renameTab(String oldName, String newName)
Changes the label of the tab with the oldName
to the newName
.
Parameters:
oldName
newName
public void repaintTab(int index)Repaints the specified tab.
Parameters:
index
protected boolean scrollCheck(int x, int y)Checks to see if the scrollbar needs scrolling.
Parameters:
x
y
protected void scrollLeft()Scrolls the scrollbar to the left.
scrollLeft()
calls adjustScrollbar()
protected void scrollRight()Scrolls the scrollbar to the right.
scrollRight()
calls adjustScrollbar()
.
protected void selectTab(int index)Selects a specified tab.
Parameters:
index
protected void setBorderHeight(int height)Sets the height of the border.
Parameters:
height
public void setLabel(int index, Object item)Sets the label of a specified tab.
Parameters:
index
item
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.
public synchronized void addActionListener(ActionListener l) public synchronized void removeActionListener(ActionListener l)
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public void addModelListener(VectorModelListener l) public void removeModelListener(VectorModelListener l)
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public void addSelectionListener(VectorSelectionListener l) public void removeSelectionListener(VectorSelectionListener l)
public void addSubfocusListener(VectorSubfocusListener l) public void removeSubfocusListener(VectorSubfocusListener l)
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )