|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--com.ultraswing.DockablePanel
DockablePanel
is a panel which is dockable and floatable.
A DockablePanel
only can dock on a CSplitPane
container.
A DockablePanel
consists of a title bar and a content panel. For horizontal title,
it's on the top of DockablePanel
; and for vertical title, it's on the left of
DockablePanel
component. In both cases, content panel is in the center.
Usage example:
CSplitPane split = new CSplitPane(); DockablePanel dock = new DockablePanel(new JTextArea(), "Dock 1 title", getImage("outline.gif"), false); //add dock to a CSplitPane container split.addPane(dock);
Field Summary | |
static int |
CLOSE_BUTTON
This index for "close" button on the titlebar |
static int |
DOCK_ANYWHERE
no dock preference |
static int |
DOCK_FIRST
Prefer docking as the first component in split pane |
static int |
DOCK_LAST
Prefer docking as the last component in split pane |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DockablePanel(Component comp,
String title)
Constructor |
|
DockablePanel(Component comp,
String title,
boolean isVerticalTitle)
Constructor |
|
DockablePanel(Component comp,
String title,
Icon icon,
boolean isVerticalTitle)
Constructor |
Method Summary | |
void |
addDockingListener(ActionListener l)
Adds a DockingEvent listener |
void |
addFocusListener(FocusListener l)
|
void |
close()
Closes this panel |
void |
doFloat(Point location,
Dimension size)
Floats this panel |
Component |
getComponent()
Returns the component object of this panel |
int |
getDockPreference()
Returns the dock preference |
Dimension |
getFloatingFrameSize()
Gets the size of this panel when it's floating |
TitleBar |
getTitleBar()
Returns the title bar object of this panel |
boolean |
isDockable()
Tests whether this panel is dockable or not |
boolean |
isFloating()
Tests if this panel is floating or not |
protected void |
processEvent(DockingEvent e)
Processes events on this panel. |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
removeDockingListener(ActionListener l)
Removes a DockingEvent listener |
void |
removeFocusListener(FocusListener l)
|
boolean |
restore()
Restores this panel to its previous state |
boolean |
restore(Point location,
Dimension size)
Restores this panel to its previous state |
void |
setDockable(boolean b)
Sets this panel to be dockable or not |
void |
setDockPreference(int pref)
Set docking preference when dock on JFrame |
void |
setFloatingFrameSize(Dimension dim)
Sets the size of this panel when it's floating |
void |
setFrame(Frame frame)
Sets the Frame object to be used when this panel is floating |
void |
setTitleBarColors(Color startingColorWhenFocused,
Color endingColorWhenFocused,
Color startingColorWhenNoFocus,
Color endingColorWhenNoFocus)
Sets title bar color |
void |
setToolTipText(int index,
String tooltip)
Sets tooltip for close button |
void |
setVisible(boolean b)
Shows or hides this component depending on the value of parameter b. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int CLOSE_BUTTON
public static final int DOCK_ANYWHERE
public static final int DOCK_FIRST
public static final int DOCK_LAST
Constructor Detail |
public DockablePanel(Component comp, String title)
comp
- the component which will be displayed at the center of this paneltitle
- title of this panel, displayed on the title barpublic DockablePanel(Component comp, String title, boolean isVerticalTitle)
comp
- the component which will be displayed at the center of this paneltitle
- title of this panel, displayed on the title barisVerticalTitle
- if true, show title bar vertically; otherwise, show title bar horizontallypublic DockablePanel(Component comp, String title, Icon icon, boolean isVerticalTitle)
comp
- the component which will be displayed at the center of this paneltitle
- title of this panel, displayed on the title baricon
- the small icon displayed at the left corner (horizotal case) or top corner (vertical case)isVerticalTitle
- if true, show title bar vertically; otherwise, show title bar horizontallyMethod Detail |
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public Component getComponent()
public TitleBar getTitleBar()
public void setTitleBarColors(Color startingColorWhenFocused, Color endingColorWhenFocused, Color startingColorWhenNoFocus, Color endingColorWhenNoFocus)
startingColorWhenNoFocus
- starting color of title bar when this panel has focusendingColorWhenNoFocus
- ending color of title bar when this panel has focuspublic void setDockPreference(int pref)
pref
- one of
{ DockablePanel.DOCK_FIRST, DockablePanel.DOCK_LAST, DockablePanel.DOCK_ANYWHERE}, DockablePanel.DOCK_ANYWHERE
is the default valuepublic int getDockPreference()
public void setFloatingFrameSize(Dimension dim)
public Dimension getFloatingFrameSize()
public boolean isFloating()
public void setDockable(boolean b)
public boolean isDockable()
public void close()
public boolean restore()
public boolean restore(Point location, Dimension size)
location
- the location of restored panel. Old value is used if the passed location is nullsize
- the size of restored panel. The old value is used if the passed size is null
public void addFocusListener(FocusListener l)
addFocusListener
in class Component
public void removeFocusListener(FocusListener l)
removeFocusListener
in class Component
public void setFrame(Frame frame)
public void doFloat(Point location, Dimension size)
location
- the location of the floating panelsize
- this size of the floating panelpublic void addDockingListener(ActionListener l)
public void removeDockingListener(ActionListener l)
protected void processEvent(DockingEvent e)
e
- the eventpublic void setVisible(boolean b)
setVisible
in class JComponent
b
- if true, shows this component; otherwise, hides this componentpublic void setToolTipText(int index, String tooltip)
index
- CLOSE_BUTTON : close button
|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |