<div class="mgwt-Button">ButtonText</div>The following classes are added as needed:
Quit
" button as it appears under the Solaris operating system:
The first view shows the button as it appears normally. The second view shows the button when it has input focus. Its outline is darkened to let the user know that it is an active object. The third view shows the button when the user clicks the mouse over the button, and thus requests that an action be performed.
The gesture of clicking on a button with the mouse is associated with one instance of ActionEvent
, which is sent out when the mouse is both pressed and released over the button. If an application is interested in knowing when the button has been pressed but not released, as a separate gesture, it can specialize processMouseEvent
, or it can register itself as a listener for mouse events by calling addMouseListener
. Both of these methods are defined by Component
, the abstract superclass of all components.
When a button is pressed and released, AWT sends an instance of ActionEvent
to the button, by calling processEvent
on the button. The button's processEvent
method receives all events for the button; it passes an action event along by calling its own processActionEvent
method. The latter method passes the action event on to any action listeners that have registered an interest in action events generated by this button.
If an application wants to perform some action based on a button being pressed and released, it should implement ActionListener
and register the new listener to receive events from this button, by calling the button's addActionListener
method. The application can make use of the button's action command as a messaging protocol.
@version 1.83 10/31/08
@author Sami Shaio
@see java.awt.event.ActionEvent
@see java.awt.event.ActionListener
@see java.awt.Component#processMouseEvent
@see java.awt.Component#addMouseListener
@since JDK1.0
ActionEvent
, that is delegetated to registered listeners.
Within a form, you can nest Button components. Note that you don't have to do this to let the form work (a simple <input type="submit".. suffices), but if you want to have different kinds of submit behavior it might be a good idea to use Buttons.
The model property is used to set the "value" attribute. It will thus be the label of the button that shows up for end users. If you want the attribute to keep it's markup attribute value, don't provide a model, or let it return an empty string.
When you add a Wicket Button to a form, and that button is clicked, by default the button's onSubmit method is called first, and after that the form's onSubmit method is called. If you want to change this (e.g. you don't want to call the form's onSubmit method, or you want it called before the button's onSubmit method), you can override Form.delegateSubmit.
One other option you should know of is the 'defaultFormProcessing' property of Button components. When you set this to false (default is true), all validation and formupdating is bypassed and the onSubmit method of that button is called directly, and the onSubmit method of the parent form is not called. A common use for this is to create a cancel button.
@author Jonathan Locke @author Eelco HilleniusFace | Description | CSS class |
---|---|---|
"Up" | Shown when the user does not press or hover over the button (default face). | - |
"Down" | Shown when the user presses and holds the mouse down. | down |
"Disabled" | Shown when the button is disabled. See {@link #setEnabled(boolean)}. | disabled |
"Hover" | Shown when the user hovers over the button. | over |
Default {@link #getZclass}: z-button.(since 3.5.0) @author tomyeh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|