Java Doc for Component.java in  » Web-Framework » ThinWire » thinwire » ui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » ThinWire » thinwire.ui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


thinwire.ui.Component

All known Subclasses:   thinwire.ui.AbstractComponent,
Component
public interface Component (Code)
Component is the foundation of all visual objects in the framework. A visual object is one that offers a user interface that can be displayed and interacted with by a user. The common capabilities of all visual objects are defined by this object. This includes methods for setting and getting common spatial and focus properites as well as support for adding event listeners that receive notification of property and keypress state changes.

Since Component is an interface, you do not actually create an instance of it directly, instead you create an instance of one of its sub-classes, such as Button, TextField or Label.

Keyboard Navigation:
KEYRESPONSENOTE
TabTransitions to the next focus capable ComponentSee Component.setFocus(boolean) for details.
Shift-TabTransitions to the prior focus capable ComponentSee Component.setFocus(boolean) for details.


author:
   Joshua J. Gertzen


Field Summary
final public static  StringACTION_CLICK
     Contains the formal action name for a click performed on a Component.
final public static  StringACTION_DOUBLE_CLICK
     Contains the formal action name for a double click performed on a Component.
final public static  StringPROPERTY_ENABLED
     Contains the formal property name for the enabled state of a Component.
final public static  StringPROPERTY_FOCUS
     Contains the formal property name for the focus state of a Component.
final public static  StringPROPERTY_FOCUS_CAPABLE
     Contains the formal property name for the focus capability of a Component.
final public static  StringPROPERTY_HEIGHT
     Contains the formal property name for the height of a Component.
final public static  StringPROPERTY_LIMIT
     Contains the formal property name for the layout manager limit of a component.
final public static  StringPROPERTY_USER_OBJECT
     Contains the formal property name for the user object of a Component.
final public static  StringPROPERTY_VISIBLE
     Contains the formal property name for the visible state of a Component.
final public static  StringPROPERTY_WIDTH
     Contains the formal property name for the width of a Component.
final public static  StringPROPERTY_X
     Contains the formal property name for the 'X' coordinate of a Component.
final public static  StringPROPERTY_Y
     Contains the formal property name for the 'Y' coordinate of a Component.


Method Summary
 voidaddActionListener(String action, ActionListener listener)
     Adds a ActionListener to this component that will be notified when the specified action occurs.
 voidaddActionListener(String[] actions, ActionListener listener)
     Adds a ActionListener to this component that will be notified when any of the specified actions occur.
 voidaddDropListener(Component dragSource, DropListener listener)
    
 voidaddDropListener(Component[] dragSources, DropListener listener)
    
 voidaddKeyPressListener(String keyPressCombo, KeyPressListener listener)
     Adds a KeyPressListener that will be notified when the specified key press combination occurs.

For a description and list of valid keyPressCombo strings, see the documentation for thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString) .

Establishing keyboard shortcuts for certain features can be a highly effective way to improve the efficiency of your application.

 voidaddKeyPressListener(String[] keyPressCombos, KeyPressListener listener)
     Adds a KeyPressListener that will be notified when any of the specified key press combinations occur.
 voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener)
     Adds a PropertyChangeListener to this componetn that will be notified when the specified property changes. Adding a property listener to a component allows your code to react to a state change within the component.
 voidaddPropertyChangeListener(String[] propertyNames, PropertyChangeListener listener)
     Adds a PropertyChangeListener to this component that will be notified when any of the specified properties change.
 voidfireAction(ActionEvent ev)
     Programmatically signals an action which triggers the appropriate listener which calls the desired method.
 voidfireAction(String action)
    
 voidfireAction(String action, Object source)
    
 voidfireDrop(DropEvent ev)
    
 voidfireDrop(Component dragComponent)
    
 voidfireDrop(Component dragComponent, Object dragObject)
    
 voidfireKeyPress(KeyPressEvent ev)
     Allows you to programmatically trigger a key press combination.
 voidfireKeyPress(String keyPressCombo)
    
 ContainergetContainer()
     Returns the parent Container of this Component.
 intgetHeight()
     Returns the height of this Component.
 LabelgetLabel()
     Returns the Label assigned to this Component.
 ObjectgetLimit()
     Gets the layout limit that controls the bounds of this component within the context of the parent Container's layout.
 ObjectgetParent()
     Returns the parent Object of this Component.
 StylegetStyle()
     Returns a Style object representing this Component's current style settings.
 ObjectgetUserObject()
     Returns the user defined Object for this Component.
 intgetWidth()
     Returns the width of this Component.
 intgetX()
     Returns the X coordinate of this Component.
 intgetY()
     Returns the Y coordinate of this Component.
 booleanisEnabled()
     Returns whether this Component is enabled and therefore supports user interaction.
 booleanisFocus()
     Returns whether this Component has the input focus.
 booleanisFocusCapable()
     Returns whether this Component supports gaining focus.
 booleanisVisible()
     Returns a boolean value indicating whether this Component may be displayed in a window.
 voidremoveActionListener(ActionListener listener)
     Unregister an ActionListener from all action event notifications from this component.
 voidremoveDropListener(DropListener listener)
    
 voidremoveKeyPressListener(KeyPressListener listener)
     Removes the specified KeyPressListener from the component.
 voidremovePropertyChangeListener(PropertyChangeListener listener)
     Removes the specified PropertyChangeListener from the component.
 ComponentsetBounds(int x, int y, int width, int height)
     Assigns the specified width, height, X and Y values to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that all of the provided values are legal before they are committed.
 voidsetEnabled(boolean enabled)
     Assigns whether this Component is enabled and therefore supports user interaction. The form of user iteraction this property controls, depends on the specific kind of Component itself.
 voidsetFocus(boolean focus)
     Assigns whether this Component has the input focus.
 voidsetFocusCapable(boolean focusCapable)
     Assigns whether this Component supports gaining focus.
 voidsetHeight(int height)
     Assigns the specified height to this Component.
Default: 0
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_HEIGHT ) to be generated.

 ComponentsetLimit(Object limit)
     Sets a layout limit that controls the bounds of this component within the context of the parent Container's layout. The type of limit object that is acceptable depends on the Layout that is specified for the parent Container. Default: null
Parameters:
  limit - a layout limit to use for the Container's layout, or null to clear the limit.
 ComponentsetPosition(int x, int y)
     Assigns the specified X and Y coordinates to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that both of the provided X and Y coordinates are legal values before the values are committed.
 ComponentsetSize(int width, int height)
     Assigns the specified width and height to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that both of the provided width and height are legal values before the values are committed.
 voidsetUserObject(Object userObject)
     Assigns a user defined Object to this Component.
 voidsetVisible(boolean visible)
     Assigns a boolean value indicating whether this Component may be displayed in a window.
 voidsetWidth(int width)
     Assigns the specified width to this Component.
Default: 0
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_WIDTH ) to be generated.

 voidsetX(int x)
     Assigns the specified X coordinate to this Component.
Default: 0 Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_X ) to be generated.

 voidsetY(int y)
     Assigns the specified Y coordinate to this Component.
Default: 0 Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_Y ) to be generated.


Field Detail
ACTION_CLICK
final public static String ACTION_CLICK(Code)
Contains the formal action name for a click performed on a Component.
See Also:   Component.addActionListener(String,ActionListener)
See Also:   Component.addActionListener(String[],ActionListener)
See Also:   Component.removeActionListener(ActionListener)
See Also:   Component.fireAction(ActionEvent)



ACTION_DOUBLE_CLICK
final public static String ACTION_DOUBLE_CLICK(Code)
Contains the formal action name for a double click performed on a Component.
See Also:   Component.addActionListener(String,ActionListener)
See Also:   Component.addActionListener(String[],ActionListener)
See Also:   Component.removeActionListener(ActionListener)
See Also:   Component.fireAction(ActionEvent)



PROPERTY_ENABLED
final public static String PROPERTY_ENABLED(Code)
Contains the formal property name for the enabled state of a Component.
See Also:   Component.setEnabled(boolean)
See Also:   Component.isEnabled()



PROPERTY_FOCUS
final public static String PROPERTY_FOCUS(Code)
Contains the formal property name for the focus state of a Component.
See Also:   Component.setFocus(boolean)
See Also:   Component.isFocus()



PROPERTY_FOCUS_CAPABLE
final public static String PROPERTY_FOCUS_CAPABLE(Code)
Contains the formal property name for the focus capability of a Component.
See Also:   Component.setFocusCapable(boolean)
See Also:   Component.isFocusCapable()



PROPERTY_HEIGHT
final public static String PROPERTY_HEIGHT(Code)
Contains the formal property name for the height of a Component.
See Also:   Component.setHeight(int)
See Also:   Component.getHeight()



PROPERTY_LIMIT
final public static String PROPERTY_LIMIT(Code)
Contains the formal property name for the layout manager limit of a component.
See Also:   Component.setLimit(Object)
See Also:   Component.getLimit()



PROPERTY_USER_OBJECT
final public static String PROPERTY_USER_OBJECT(Code)
Contains the formal property name for the user object of a Component.
See Also:   Component.setUserObject(Object)
See Also:   Component.getUserObject()



PROPERTY_VISIBLE
final public static String PROPERTY_VISIBLE(Code)
Contains the formal property name for the visible state of a Component.
See Also:   Component.setVisible(boolean)
See Also:   Component.isVisible()



PROPERTY_WIDTH
final public static String PROPERTY_WIDTH(Code)
Contains the formal property name for the width of a Component.
See Also:   Component.setWidth(int)
See Also:   Component.getWidth()



PROPERTY_X
final public static String PROPERTY_X(Code)
Contains the formal property name for the 'X' coordinate of a Component.
See Also:   Component.setX(int)
See Also:   Component.getX()



PROPERTY_Y
final public static String PROPERTY_Y(Code)
Contains the formal property name for the 'Y' coordinate of a Component.
See Also:   Component.setY(int)
See Also:   Component.getY()





Method Detail
addActionListener
void addActionListener(String action, ActionListener listener)(Code)
Adds a ActionListener to this component that will be notified when the specified action occurs.
Parameters:
  action - the action to specficially be notified of.
Parameters:
  listener - the event listener that will receive notification.



addActionListener
void addActionListener(String[] actions, ActionListener listener)(Code)
Adds a ActionListener to this component that will be notified when any of the specified actions occur.
Parameters:
  actions - the actions to specficially be notified of.
Parameters:
  listener - the event listener that will receive notification.



addDropListener
void addDropListener(Component dragSource, DropListener listener)(Code)



addDropListener
void addDropListener(Component[] dragSources, DropListener listener)(Code)



addKeyPressListener
void addKeyPressListener(String keyPressCombo, KeyPressListener listener)(Code)
Adds a KeyPressListener that will be notified when the specified key press combination occurs.

For a description and list of valid keyPressCombo strings, see the documentation for thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString) .

Establishing keyboard shortcuts for certain features can be a highly effective way to improve the efficiency of your application. If your application has a Menu, then typically the best way to establish such shortcuts is to simply set the keyPressCombo property for each Menu.Item. Second to that, using this method to establish shortcuts on the Frame or a Dialog will have a similar wide reaching effect. Occasionally, based on the requirements of your application, you may also use this method to establish shortcuts that are only valid when a given component has focus.

Details:

When a user presses a key and/or combination, the event bubbles up the component hierarchy from the component that currently has focus and is absorbed by the first Component that has a listener asking to be notified of that event. Therefore, if both a Component and a Container up the hierarchy are listening for the same event, only the Component will receive notification. There is currently no way to cause the event to continue bubbling.

Additionally, the keyboard navigation of each Component cannot be overridden and you cannot receive notification of such events. As an example, establishing a KeyPressListener for "Space" key on the CheckBox, will have no effect because the "Space" key toggles the checked state of that component.

NOTE ON WEBBROWSERS: If no Component is listening for a given key press, then the default behavior that the browser has associated with that key press will occur. Additionally, certain key press events in certain browsers cannot be entirely circumvented. In such a case, both the action defined by a listener and the browser's default behavior will occur. An example of this is the F1 key in Internet Explorer. If you establish a listener for the F1 key, the IE help file will open in addition to whatever action you may have defined.

Example:
 Application.current().getFrame().addKeyPressListener("Ctrl-Alt-M", new KeyPressListener() {
 public void keyPress(KeyPressEvent kpe) {
 MessageBox.confirm("You pressed the following key combination: " + kpe.getKeyPressCombo());
 }
 });
 

Parameters:
  keyPressCombo - a key press combo in any dash separated format supported bythinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String).
Parameters:
  listener - the listener that will receive KeyPressEvent objects upon the key press occurring.
throws:
  IllegalArgumentException - if listener or keyPressCombo is null, or ifkeyPressCombo is an empty string, or if keyPressCombo represents an invalid key combo.
See Also:   thinwire.ui.event.KeyPressListener
See Also:   thinwire.ui.event.KeyPressEvent
See Also:   thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString)
See Also:   thinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String)



addKeyPressListener
void addKeyPressListener(String[] keyPressCombos, KeyPressListener listener)(Code)
Adds a KeyPressListener that will be notified when any of the specified key press combinations occur.

For a description and list of valid keyPressCombo strings, see the documentation for thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString) .

See Component.addKeyPressListener(String,KeyPressListener) for a full semantic description.


Parameters:
  keyPressCombos - a string array of key press combos, each in any dash separated format supported bythinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String).
Parameters:
  listener - the listener that will receive KeyPressEvent objects when any of the key presses occur.
throws:
  IllegalArgumentException - if listener or any key press combo in keyPressCombos is null,or if any key press combo in keyPressCombos is an empty string, or if any key press combo inkeyPressCombos represents an invalid key combo.
See Also:   Component.addKeyPressListener(String,KeyPressListener)
See Also:   thinwire.ui.event.KeyPressListener
See Also:   thinwire.ui.event.KeyPressEvent
See Also:   thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString)
See Also:   thinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String)



addPropertyChangeListener
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)
Adds a PropertyChangeListener to this componetn that will be notified when the specified property changes. Adding a property listener to a component allows your code to react to a state change within the component.
Example:
 final TextField tf = new TextField();
 tf.setEnabled(false);
 CheckBox cb = new CheckBox("Check me to enable the TextField.");
 cb.addPropertyChangeListener(CheckBox.PROPERTY_CHECKED, new PropertyChangeListener() {
 public void propertyChange(PropertyChangeEvent pce) {
 if (pce.getNewValue() == Boolean.TRUE) {
 tf.setEnabled(true);
 } else {
 tf.setEnabled(false);
 }
 }
 });
 

Parameters:
  propertyName - the name of the property that the listener will receive change events for.
Parameters:
  listener - the listener that will receive PropertyChangeEvent objects upon the property changing.
throws:
  IllegalArgumentException - if listener or propertyName is null or ifpropertyName is an empty string.
See Also:   thinwire.ui.event.PropertyChangeListener
See Also:   thinwire.ui.event.PropertyChangeEvent



addPropertyChangeListener
void addPropertyChangeListener(String[] propertyNames, PropertyChangeListener listener)(Code)
Adds a PropertyChangeListener to this component that will be notified when any of the specified properties change. This method is equivalent to calling Component.addPropertyChangeListener(String,PropertyChangeListener) once for each property you want to listen to.
Parameters:
  propertyNames - a string array of property names that the listener will receive change events for.
Parameters:
  listener - the listerner that will receive PropertyChangeEvent objects anytime one of the specifiedpropertyNames of this component change.
throws:
  IllegalArgumentException - if listener, propertyNames or any property name is the arrayis null or if any property name is an empty string.
See Also:   Component.addPropertyChangeListener(String,PropertyChangeListener)
See Also:   thinwire.ui.event.PropertyChangeListener
See Also:   thinwire.ui.event.PropertyChangeEvent



fireAction
void fireAction(ActionEvent ev)(Code)
Programmatically signals an action which triggers the appropriate listener which calls the desired method.
Parameters:
  ev - the event to signal



fireAction
void fireAction(String action)(Code)
A convenience method that is equal to this.fireAction(new ActionEvent(this, action));
Parameters:
  action - the action to perform on the component.



fireAction
void fireAction(String action, Object source)(Code)
A convenience method that is equal to this.fireAction(new ActionEvent(this, action));
Parameters:
  action - the action to perform on the component.



fireDrop
void fireDrop(DropEvent ev)(Code)



fireDrop
void fireDrop(Component dragComponent)(Code)



fireDrop
void fireDrop(Component dragComponent, Object dragObject)(Code)



fireKeyPress
void fireKeyPress(KeyPressEvent ev)(Code)
Allows you to programmatically trigger a key press combination. Passing this method a valid key press combination will result in a KeyPressEvent being generated. As a result, all KeyPressListener's that are registered on the specified keyPressCombo will be notified.

For a description and list of valid keyPressCombo strings, see the documentation for thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString) .

Details:

A KeyPressEvent that is generated programmatically via this mechansim may, under some circumstances, have a slightly different behavior than one generated by user activity. The reason for this is that the event is only propagated within the framework itself and does not actually occur in the client. In general, this should never be an issue because the desired response to a keypress will be expressly defined by a given KeyPressListener and therefore there would be no dependence on any such side-effect. However, an example of one such difference, is in terms of a browser's default behavior for a specific key press combination. If you use this mechanism to trigger an F1 keypress, the browser's default behavior (typically bringing up a help window), will not occur.


throws:
  IllegalArgumentException - if keyPressCombo is null, or if keyPressCombo is an emptystring, or if keyPressCombo represents an invalid key combo.
Parameters:
  ev - a KeyPressEvent that represents the key press combo you want to signal has occured.



fireKeyPress
void fireKeyPress(String keyPressCombo)(Code)
A convenience method that is equal to this.fireKeyPress(new KeyPressEvent(keyPressCombo, this));
Parameters:
  keyPressCombo - a key press combo in any dash separated format supported bythinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String).
See Also:   thinwire.ui.event.KeyPressEvent.encodeKeyPressCombo(booleanbooleanbooleanString)
See Also:   thinwire.ui.event.KeyPressEvent.normalizeKeyPressCombo(String)



getContainer
Container getContainer()(Code)
Returns the parent Container of this Component. Unlike getParent(), this method guarantees that if a non-null value is returned, it will be a Contaienr. the parent Container of this Component, or null if no parent exists.
throws:
  IllegalStateException - if in the process of walking up the parent hierarchy, an unrecognized parent type is found.
See Also:   Component.getParent()



getHeight
int getHeight()(Code)
Returns the height of this Component. the height (in pixels) of this Component
See Also:   Component.setHeight(int)



getLabel
Label getLabel()(Code)
Returns the Label assigned to this Component. This property is part of a two-way relationship that is established by the thinwire.ui.Label.setLabelFor(Component) property. There is no setLabel method, instead use thinwire.ui.Label.setLabelFor(Component) . the Label assigned to this Component.



getLimit
Object getLimit()(Code)
Gets the layout limit that controls the bounds of this component within the context of the parent Container's layout. the layout limit that is in use by the Container's layout, or null if no limit is specified.
See Also:   Component.setLimit(Object)
See Also:   Container.getLayout
See Also:   Container.setLayout(thinwire.ui.layout.Layout)
See Also:   thinwire.ui.layout.Layout



getParent
Object getParent()(Code)
Returns the parent Object of this Component. If you specifically need the parent Container of this Component use Component.getContainer() instead.
Details:

Under the majority of situations, the returned value is either a Container or null since a Component will either be a child of a Container or not attached to any object. However, in some cases the parent of the Component may be another Component, or a completely different kind of Object. For example, in the case of the DropDownGridBox, there is an actual GridBox that is a child of the drop down. Therefore, the parent of that GridBox would be the DropDownGridBox. Another situation exists when you use a multi-tiered GridBox, meaning a GridBox that has one or more "pop-up" child GridBox's. Under that scenario, the parent of the child's GridBox is actually an instance of GridBox.Row and the parent of the row is the GridBox.

the parent Object of this Component, or null if no parent exists.
See Also:   Component.getContainer()



getStyle
Style getStyle()(Code)
Returns a Style object representing this Component's current style settings. NOTE: This method will never return null. a Style object representing this Component's current style settings.
See Also:   thinwire.ui.style.Style



getUserObject
Object getUserObject()(Code)
Returns the user defined Object for this Component.
Default: null the user defined Object for this Component, or null if no value has been specified.
See Also:   Component.setUserObject(Object)



getWidth
int getWidth()(Code)
Returns the width of this Component. the width (in pixels) of this Component
See Also:   Component.setWidth(int)



getX
int getX()(Code)
Returns the X coordinate of this Component. the X coordinate (in pixels) of this Component
See Also:   Component.setX(int)



getY
int getY()(Code)
Returns the Y coordinate of this Component. the Y coordinate (in pixels) of this Component
See Also:   Component.setY(int)



isEnabled
boolean isEnabled()(Code)
Returns whether this Component is enabled and therefore supports user interaction.
Default: true true if the Component supports user interaction, false otherwise.
See Also:   Component.setEnabled(boolean)



isFocus
boolean isFocus()(Code)
Returns whether this Component has the input focus. If this is a Container, then this method will return true if a child Component has the focus. In such a case, you can use the thinwire.ui.Container.getChildWithFocus method to get a reference to that child. Similarly, if you want to find the child Component that has the focus anywhere in the current Frame or Dialog, you can use the thinwire.ui.Container.getComponentWithFocus method.

Default: false. However, at rendering time, if no component in the window has focus, the first focus capable component is given focus.

See the Component.setFocus(boolean) method for a full description of focus details.

true if this Component has the input focus, false otherwise.
See Also:   Component.setFocus(boolean)
See Also:   thinwire.ui.Container.getComponentWithFocus
See Also:   thinwire.ui.Container.getChildWithFocus



isFocusCapable
boolean isFocusCapable()(Code)
Returns whether this Component supports gaining focus.
Default: true, except for Divider, Image and Label. true if this Component supports gaining focus, false otherwise.
See Also:   Component.setFocusCapable(boolean)
See Also:   Component.setFocus(boolean)



isVisible
boolean isVisible()(Code)
Returns a boolean value indicating whether this Component may be displayed in a window. See the documentation of Component.setVisible(boolean) for further details about this property.
Default: true, except for the Dialog and Frame containers. true if this Component may be displayed, fasle otherwise
See Also:   Component.setVisible(boolean)



removeActionListener
void removeActionListener(ActionListener listener)(Code)
Unregister an ActionListener from all action event notifications from this component.
Parameters:
  listener - the listener that should no longer receive action event notifications.



removeDropListener
void removeDropListener(DropListener listener)(Code)



removeKeyPressListener
void removeKeyPressListener(KeyPressListener listener)(Code)
Removes the specified KeyPressListener from the component. If the listener was added for multiple key press combinations, it will be removed for all of them. NOTE: An exception is NOT thrown if you attempt to remove a listener that does not exist on this component.
Parameters:
  listener - the listener to remove from the component.
throws:
  IllegalArgumentException - if listener is null.
See Also:   thinwire.ui.event.KeyPressListener



removePropertyChangeListener
void removePropertyChangeListener(PropertyChangeListener listener)(Code)
Removes the specified PropertyChangeListener from the component. If the listener was added for multiple properties, it will be removed for all of them. NOTE: An exception is NOT thrown if you attempt to remove a listener that does not exist on this component.
Parameters:
  listener - the listener to remove from the component.
throws:
  IllegalArgumentException - if listener is null.
See Also:   thinwire.ui.event.PropertyChangeListener



setBounds
Component setBounds(int x, int y, int width, int height)(Code)
Assigns the specified width, height, X and Y values to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that all of the provided values are legal before they are committed. The primary benefit of this is that no PropertyChangeEvent's will be generated until all values have been set. Events:

This method may generate PropertyChangeEvent's. See the documenation of setX, setY, setWidth and setHeight for more details.


Parameters:
  x - the x coordinate (in pixels) to assign to this Component
Parameters:
  y - the y coordinate (in pixels) to assign to this Component
Parameters:
  width - the width (in pixels) to assign to this Component
Parameters:
  height - the height (in pixels) to assign to this Component this Component so that you can perform operations like container.getChildren().add(new Button().setBounds(x, y, width, height))
throws:
  IllegalArgumentException - if the width or height value is < 0 or >= 32767, or if the x or y value is < -32768 or >= 32767
See Also:   Component.setX
See Also:   Component.setY
See Also:   Component.setWidth
See Also:   Component.setHeight
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_X
See Also:   Component.PROPERTY_Y
See Also:   Component.PROPERTY_WIDTH
See Also:   Component.PROPERTY_HEIGHT
See Also:   thinwire.ui.event.PropertyChangeEvent



setEnabled
void setEnabled(boolean enabled)(Code)
Assigns whether this Component is enabled and therefore supports user interaction. The form of user iteraction this property controls, depends on the specific kind of Component itself. However, in general, all keyboard interaction and mouse interaction is disabled by setting this property to false.
Default: true
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_ENABLED ) to be generated.


Parameters:
  enabled - true to allow user interaction, false to disallow it.
See Also:   Component.isEnabled()
See Also:   Component.PROPERTY_ENABLED
See Also:   thinwire.ui.event.PropertyChangeEvent



setFocus
void setFocus(boolean focus)(Code)
Assigns whether this Component has the input focus. When this Component has the input focus, it will receive all keyboard events generated by the user. Therefore, if this Component supports text editing and it has focus, the user can type a value into it's field. Additionally, any keyboard navigation supported by this Component or keyboard shortcuts added by a developer become available upon gaining focus. Conversely, when this Component no longer has focus, it will receive no keyboard events.

Default: false. However, at rendering time, if no component in the window has focus, the first focus capable component is given focus.

Details:

The simplest of all cases, is when this Component has not yet been added to a Container. In that scenario, the focus property is simply set to true and no other effect occurs. Later, when this Component is added to a Container it will be given the focus according to the guidelines that follow.

As a general rule, only a single Component can have the focus per Frame or Dialog container hierarchy. In terms of the user interface, only a single Component will actually have the focus regardless of whether a Dialog and the Frame have components with focus. In such a case, the actual focus is determined based on which window is currently active.

Since only one Component per window can have focus, giving this Component focus will cause the prior Component of the window to lose focus. In the most common case, both this Component and the Component losing focus will be siblings in the same Container. In that case, the focus property of the Component losing focus is simply set to false whereas the focus property of this Component is set to true.

More complex scenarios arise when the Component losing focus and this Component are not siblings in the same Container. In those cases, the order in which focus is lost and gained occurs as follows:

  • 1. The highest level shared parent Container between both the Component losing focus and this Component is found. This shared parent and any Container above it in the hierarchy will be left alone.
  • 2. The focus property is set to false for each Container in the hierarchy that contains the Component losing focus, as well as the component itself. This is done in top down order, so that the top most Container loses focus first, followed by every container between it and the Component losing focus next, and with the component itself losing focus last.
  • 3. The focus property is set to true for each Container in the hierarchy that contains this Component, as well as the component itself. This is done in top down order, so that the top most Container gains focus first, followed by every container between it and the Component gaining focus next, and with this component gaining focus last.

The final case to be aware of is if you directly set this Component's focus to false. In that case, the same loss of focus rules outlined above apply. There is simply no gaining of focus that occurs by any component. Therefore you cause the window to have no Component with focus, with the except of the parent Container of this Component.

Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_FOCUS ) to be generated. Additionally, similar event generation may occur for other components according to the details outlined above.


Parameters:
  focus - true to give this Component and it's parent containers focus, false otherwise.
See Also:   Component.isFocus()
See Also:   thinwire.ui.Container.getComponentWithFocus
See Also:   thinwire.ui.Container.getChildWithFocus
throws:
  IllegalStateException - if this Component is not focus capable
throws:
  UnsupportedOperationException - if the parent of this Component is not null and is not a Container



setFocusCapable
void setFocusCapable(boolean focusCapable)(Code)
Assigns whether this Component supports gaining focus.
Default: true, except for Divider, Image and Label.
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_FOCUS_CAPABLE ) to be generated.


Parameters:
  focusCapable - true to allow this component to receive focus, false to disallow it.
See Also:   Component.isFocusCapable()
See Also:   Component.PROPERTY_FOCUS_CAPABLE
See Also:   Component.setFocus(boolean)
See Also:   thinwire.ui.event.PropertyChangeEvent



setHeight
void setHeight(int height)(Code)
Assigns the specified height to this Component.
Default: 0
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_HEIGHT ) to be generated.


Parameters:
  height - the height (in pixels) to assign to this Component
throws:
  IllegalArgumentException - if the height value is < 0 or >= 32767
See Also:   Component.getHeight()
See Also:   Component.setSize(int,int)
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_HEIGHT
See Also:   thinwire.ui.event.PropertyChangeEvent



setLimit
Component setLimit(Object limit)(Code)
Sets a layout limit that controls the bounds of this component within the context of the parent Container's layout. The type of limit object that is acceptable depends on the Layout that is specified for the parent Container. Default: null
Parameters:
  limit - a layout limit to use for the Container's layout, or null to clear the limit. this Component so that you can perform operations like container.getChildren().add(new Button().setLimit(...))
See Also:   Component.PROPERTY_LIMIT
See Also:   Component.getLimit()
See Also:   Container.getLayout
See Also:   Container.setLayout(thinwire.ui.layout.Layout)
See Also:   thinwire.ui.layout.Layout
See Also:   thinwire.ui.event.PropertyChangeEvent



setPosition
Component setPosition(int x, int y)(Code)
Assigns the specified X and Y coordinates to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that both of the provided X and Y coordinates are legal values before the values are committed. The primary benefit of this is that no PropertyChangeEvent's will be generated until both values have been set. Events:

This method may generate PropertyChangeEvent's. See the documenation of setX and setY for more details.


Parameters:
  x - the x coordinate (in pixels) to assign to this Component
Parameters:
  y - the y coordinate (in pixels) to assign to this Component this Component so that you can perform operations like container.getChildren().add(new Button().setPosition(x, y))
throws:
  IllegalArgumentException - if the x or y value is < -32768 or >= 32767
See Also:   Component.setX
See Also:   Component.setY
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_X
See Also:   Component.PROPERTY_Y
See Also:   thinwire.ui.event.PropertyChangeEvent



setSize
Component setSize(int width, int height)(Code)
Assigns the specified width and height to this Component atomically, in one operation. Aside from the convienence provided by this method, it also guarantees that both of the provided width and height are legal values before the values are committed. The primary benefit of this is that no PropertyChangeEvent's will be generated until both values have been set. Events:

This method may generate PropertyChangeEvent's. See the documenation of setWidth and setHeight for more details.


Parameters:
  width - the width (in pixels) to assign to this Component
Parameters:
  height - the height (in pixels) to assign to this Component this Component so that you can perform operations like container.getChildren().add(new Button().setSize(width, height))
throws:
  IllegalArgumentException - if the width or height value is < 0 or >= 32767
See Also:   Component.setWidth
See Also:   Component.setHeight
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_WIDTH
See Also:   Component.PROPERTY_HEIGHT
See Also:   thinwire.ui.event.PropertyChangeEvent



setUserObject
void setUserObject(Object userObject)(Code)
Assigns a user defined Object to this Component. This property has no direct effect on the state of the Component. Instead, it provides a general purpose storage mechanism to the developer that allows any kind of data to be associated to this Component. For complex applications, alternate methods of associating state to a Component will likely serve your design more thoroughly. However, there are a number of cases where this flexibility could be useful and therefore the framework supports the concept.
Default: null

Refer to the documenation on Application.addGlobalPropertyChangeListener(StringPropertyChangeListener) for an example of a potential use of this property.

Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_USER_OBJECT ) to be generated.


Parameters:
  userObject - an Object of any type that is to be associated with this Component.
See Also:   Component.getUserObject()
See Also:   Application.addGlobalPropertyChangeListener(StringPropertyChangeListener)
See Also:   Component.PROPERTY_USER_OBJECT
See Also:   thinwire.ui.event.PropertyChangeEvent



setVisible
void setVisible(boolean visible)(Code)
Assigns a boolean value indicating whether this Component may be displayed in a window.
Default: true, except for the Dialog and Frame containers.
Details:

This Component will not actually be displayed unless it is visible and added to a Container hierarchy in which all of the containers are also visible and the top-level Container is a visible Frame or Dialog. Once a Component has been displayed, toggling this property results in a light-weight operation that simply hides/shows this Component. This may sound trivial, but the difference is important when you need to maximize the performance of your application. For instance, it is a faster to toggle the visibility of components then it is to add/remove the components from a displayed Container. This is because the first time a Component is displayed, the entire state must be rendered. In contrast, when you toggle visibility, the Component remains in memory in a fully rendered form, it is just not visible to the user.

Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_VISIBLE ) to be generated.


Parameters:
  visible - true to indicate this Component may be displayed, false otherwise
See Also:   Component.isVisible()
See Also:   Component.PROPERTY_VISIBLE
See Also:   thinwire.ui.Container.getChildren
See Also:   thinwire.ui.event.PropertyChangeEvent



setWidth
void setWidth(int width)(Code)
Assigns the specified width to this Component.
Default: 0
Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_WIDTH ) to be generated.


Parameters:
  width - the width (in pixels) to assign to this Component
throws:
  IllegalArgumentException - if the width value is < 0 or >= 32767
See Also:   Component.getWidth()
See Also:   Component.setSize(int,int)
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_WIDTH
See Also:   thinwire.ui.event.PropertyChangeEvent



setX
void setX(int x)(Code)
Assigns the specified X coordinate to this Component.
Default: 0 Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_X ) to be generated.


Parameters:
  x - the x coordinate (in pixels) to assign to this Component
throws:
  IllegalArgumentException - if the x value is < -32768 or >= 32767
See Also:   Component.getX()
See Also:   Component.setPosition(int,int)
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_X
See Also:   thinwire.ui.event.PropertyChangeEvent



setY
void setY(int y)(Code)
Assigns the specified Y coordinate to this Component.
Default: 0 Events:

If the prior value and new value differ, setting this property causes a PropertyChangeEvent ( propertyName = PROPERTY_Y ) to be generated.


Parameters:
  y - the y coordinate (in pixels) to assign to this Component
throws:
  IllegalArgumentException - if the y value is < -32768 or >= 32767
See Also:   Component.getY()
See Also:   Component.setPosition(int,int)
See Also:   Component.setBounds(int,int,int,int)
See Also:   Component.PROPERTY_Y
See Also:   thinwire.ui.event.PropertyChangeEvent



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.