Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h3>Generated Object</h3> <p>A javax.swing.JButton is returned, unless the user passes in a subclass of JButton as the value argument, in which case the value argument is returned.</p> <h3>Attributes</h3> <p>See also: <a class="confluence-link" href="/display/GROOVY/SwingBuilder.JComponent" data-linked-resource-id="24576133" data-linked-resource-type="page" data-linked-resource-default-alias="SwingBuilder.JComponent" data-base-url="http://docs.codehaus.org">JComponent</a></p> <h4>Declared in JButton</h4> <ul> <li>defaultButton <boolean> Whether or not this button is the default button</li> <li>defaultCapable <boolean> Whether or not this button can be the default button</li> </ul> <h4>Declared in AbstractButton</h4> <ul> <li>action <Action> the Action instance connected with this ActionEvent source</li> <li>actionCommand <String> actionCommand</li> <li>model <ButtonModel> Model that the Button uses.</li> <li>multiClickThreshhold <long> multiClickThreshhold</li> <li>selected <boolean> selected</li> </ul> <h5>Text related</h5> <ul> <li>text <String> The button's text.</li> <li>label <String> Replace by setText(text)</li> <li>mnemonic <int> the keyboard character mnemonic</li> <li>displayedMnemonicIndex <int> the index into the String to draw the keyboard character mnemonic at</li> <li>horizontalTextPosition <int> The horizontal position of the text relative to the icon.</li> <li>verticalTextPosition <int> The vertical position of the text relative to the icon.</li> </ul> <h5>Rendering related</h5> <ul> <li>borderPainted <boolean> Whether the border should be painted.</li> <li>contentAreaFilled <boolean> Whether the button should paint the content area or leave it transparent.</li> <li>focusPainted <boolean> Whether focus should be painted</li> <li>rolloverEnabled <boolean> Whether rollover effects should be enabled.</li> <li>margin <Insets> The space between the button's border and the label</li> <li>iconTextGap <int> If both the icon and text properties are set, this property defines the space between them.</li> </ul> <h5>Icon related</h5> <ul> <li>icon <Icon> The button's default icon</li> <li>disabledIcon <Icon> The disabled icon for the button.</li> <li>pressedIcon <Icon> The pressed icon for the button.</li> <li>rolloverIcon <Icon> The rollover icon for the button.</li> <li>selectedIcon <Icon> The selected icon for the button.</li> <li>disabledSelectedIcon <Icon> The disabled selection icon for the button.</li> <li>rolloverSelectedIcon <Icon> The rollover selected icon for the button.</li> </ul> <h5>Alignment Related</h5> <ul> <li>horizontalAlignment <int> The horizontal alignment of the icon and text.</li> <li>verticalAlignment <int> The vertical alignment of the icon and text.</li> </ul> <h3>Content</h3> <p>No child content is accepted in a button.</p> <h3>Usage</h3> <p>button creates a slider-bar type widget.<br /> //TODO add an image<br /> //TODO describe how to fire code on a button press</p> <p>The selected property is not very interesting for the Button class, as it is not user changeable. This is mostly a leaky abstraction for checkBox and radioButton</p> <h3>Examples</h3> <p>This will run as a Groovy script.</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> import groovy.swing.SwingBuilder import java.awt.Insets import javax.swing.JFrame println 'hello, world' new SwingBuilder().frame(title: 'demo using buttons', defaultCloseOperation: JFrame.EXIT_ON_CLOSE, show: true, pack: true) { vbox() { button(action: action(name: 'basic', closure: {println "basic"})) button(action: action(name: 'mnemonic', mnemonic: 'P', closure: {println 'with mnemonic'})) button(action: action(name: 'default', defaultButton: true, closure: {println 'this is the default button'})) button(borderPainted:false, action: action(name: 'unpainted border', closure: {println 'unpainted border'})) button(contentAreaFilled:false, action: action(name: 'unfilled content area', closure: {println 'unfilled content area'})) button(focusPainted:false, action: action(name: 'unpainted focus (select it and you\'ll see)', closure: {println 'unpainted focus'})) button(margin: new Insets(5, 10, 15, 20), action: action(name: 'margins', closure: {println 'margins'})) } } </pre></td></tr></table> <p>//TBD further examples for icon related behaviour</p> <h3>Observable Attributes</h3> <ul> <li>defaultCapable</li> <li>selected - via synthetic observation</li> <li>action</li> <li>borderPainted</li> <li>contentAreaFilled</li> <li>disabledIcon</li> <li>disabledSelectedIcon</li> <li>displayedMnemonicIndex</li> <li>focusPainted</li> <li>hideActionText</li> <li>horizontalAlignment</li> <li>horizontalTextPosition</li> <li>icon</li> <li>iconTextGap</li> <li>label</li> <li>margin</li> <li>mnemonic</li> <li>model</li> <li>pressedIcon</li> <li>rolloverEnabled</li> <li>rolloverIcon</li> <li>rolloverSelectedIcon</li> <li>selectedIcon</li> <li>text</li> <li>verticalAlignment</li> <li>verticalTextPosition</li> </ul>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced