Package com.ms.ui |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class UIExpandButton extends UIPushButton { // Constructor public UIExpandButton(IUITree tree); // Methods public IUITree getTree(); public boolean isKeyable(); public Dimension minimumSize(); public Dimension preferredSize(); public void paint(Graphics g); public void update(Graphics g); public boolean action(Event e, Object o); public boolean mouseEnter(Event e, int x, int y); }
A class that implements a tree expander button, which indicates whether a tree node is expanded or collapsed. Class UITree uses UIExpandButton to create its tree expander. Every UIExpandButton object is associated with a tree control. By default, UIExpandButton uses the system-defined expand box image.
For more information about buttons, see the UIButton overview.
public UIExpandButton(IUITree tree);Creates an expand button, which is associated with the specified tree node.
Parameter Description tree The tree node associated with the expand button. Remarks:
By default, the button's style is set to TOGGLE.
public boolean action(Event e, Object o);Reacts to the expand button being clicked by toggling the expanded state of the associated tree node.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter Description e The event posted to the button. o The object that posted the event. Remarks:
If the tree node is collapsed when the expand button is clicked, this method expands the node. If the node is expanded when the button is clicked, the node is then collapsed.
public IUITree getTree();Retrieves the associated tree.
Return Value:
Returns the tree node associated with the expand button.
public boolean isKeyable();Determines whether the expand button can receive keyboard input.
Return Value:
Returns false, indicating the button cannot receive keyboard input.
public Dimension minimumSize();Determines the minimum size (in pixels) of the button control.
Return Value:
Returns a Dimension object that contains the minimum size.
Remarks:
The button's minimum size is determined by the height of the associated tree's bounding rectangle, as returned by the getAttachRect method.
public boolean mouseEnter(Event e, int x, int y);Reacts to the mouse entering the button area and sets the button's hot-tracked state.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter Description e The event posted to the button. x The x coordinate of the event. y The y coordinate of the event. Remarks:
This method is called when the mouse first enters the button area. Sets the button's hot-tracked state if it has not yet been set. This method allows the button to be hot-tracked even though it is not keyable, as indicated by the isKeyable method.
public void paint(Graphics g);Draws the button's expand box image.
Return Value:
No return value.
Parameter Description g The graphics context. Remarks:
By default, this method uses the system-defined expand box image.
public Dimension preferredSize();Determines the preferred size of the button control. The preferred size specifies the dimensions (in pixels) you want for the button.
Return Value:
Returns a Dimension object containing the preferred size.
Remarks:
By default, this method returns the minimum size as determined by minimumSize.
public void update(Graphics g);Paints the button's expand box image.
Return Value:
No return value.
Parameter Description g The graphics context. Remarks:
This method calls paint to redraw the expand box image.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.