⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 button.html

📁 jsf、swing的官方指南
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getText()">String getText()</a>    <br></td><td>Set or get the text displayed by the button.You can use HTML formatting, as described in<a href="html.html">Using HTML in Swing Components</a>.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setIcon(javax.swing.Icon)">void setIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getIcon()">Icon getIcon()</a>    <br></td><td>Set or get the image displayed by the button    when the button isn't selected or pressed.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setDisabledIcon(javax.swing.Icon)">void setDisabledIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getDisabledIcon()">Icon getDisabledIcon()</a>    <br></td><td>Set or get the image displayed by the button    when it's disabled.    If you don't specify a disabled image,    then the look and feel creates one    by manipulating the default image.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setPressedIcon(javax.swing.Icon)">void setPressedIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getPressedIcon()">Icon getPressedIcon()</a>    <br></td><td>Set or get the image displayed by the button    when it's being pressed.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setSelectedIcon(javax.swing.Icon)">void setSelectedIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getSelectedIcon()">Icon getSelectedIcon()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setDisabledSelectedIcon(javax.swing.Icon)">void setDisabledSelectedIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getDisabledSelectedIcon()">Icon getDisabledSelectedIcon()</a>    <br></td><td>Set or get the image displayed by the button    when it's selected.    If you don't specify a disabled selected image,    then the look and feel creates one    by manipulating the selected     image.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setRolloverEnabled(boolean)">setRolloverEnabled(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#isRolloverEnabled()">boolean isRolloverEnabled()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setRolloverIcon(javax.swing.Icon)">void setRolloverIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getRolloverIcon()">Icon getRolloverIcon()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setRolloverSelectedIcon(javax.swing.Icon)">void setRolloverSelectedIcon(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getRolloverSelectedIcon()">Icon getRolloverSelectedIcon()</a>    <br></td><td>Use <code>setRolloverIcon(someIcon)</code>    to make the button display the specified icon    when the cursor passes over it.    The <code>setRolloverSelectedIcon</code> method    lets you specify the rollover icon when the    button is selected &#151; this is useful for    two-state buttons such as toggle buttons.    Setting the rollover icon automatically    calls <code>setRollover(true)</code>,    enabling rollover.</td></tr></table><p><table border=1><caption><a name="looks">Fine Tuning the Button's Appearance</a></caption><tr><th>Method or Constructor</th><th>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setHorizontalAlignment(int)">void setHorizontalAlignment(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setVerticalAlignment(int)">void setVerticalAlignment(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getHorizontalAlignment()">int getHorizontalAlignment()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getVerticalAlignment()">int getVerticalAlignment()</a></td><td>Set or get where in the button its contents should be placed.    The <code>AbstractButton</code> class allows     any one of the following values    for horizontal alignment:    <code>RIGHT</code>,    <code>LEFT</code>,     <code>CENTER</code> (the default),    <code>LEADING</code>, and    <code>TRAILING</code>.    For vertical alignment:    <code>TOP</code>,     <code>CENTER</code> (the default), and    <code>BOTTOM</code>.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setHorizontalTextPosition(int)">void setHorizontalTextPosition(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setVerticalTextPosition(int)">void setVerticalTextPosition(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getHorizontalTextPosition()">int getHorizontalTextPosition()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getVerticalTextPosition()">int getVerticalTextPosition()</a></td><td>Set or get where the button's text should be placed,    relative to the button's image.    The <code>AbstractButton</code> class allows     any one of the following values    for horizontal position:    <code>LEFT</code>,     <code>CENTER</code>,    <code>RIGHT</code>,    <code>LEADING</code>, and    <code>TRAILING</code> (the default).    For vertical position:    <code>TOP</code>,     <code>CENTER</code> (the default), and    <code>BOTTOM</code>.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setMargin(java.awt.Insets)">void setMargin(Insets)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getMargin()">Insets getMargin()</a>    </td>    <td>Set or get the number of pixels between     the button's border and its contents.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setFocusPainted(boolean)">void setFocusPainted(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#isFocusPainted()">boolean isFocusPainted()</a>    </td>    <td>Set or get whether the button        should look different when it has the focus.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setBorderPainted(boolean)">void setBorderPainted(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#isBorderPainted()">boolean isBorderPainted()</a>    </td>    <td>Set or get whether the border of the button        should be painted.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setIconTextGap(int)">void setIconTextGap(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getIconTextGap()">int getIconTextGap()</a>    <br>    </td>    <td>Set or get the amount of space between the text and the icon        displayed in this button.     </td>  </tr></table><p><table border=1><caption><a name="acts">Implementing the Button's Functionality</a></caption><tr><th>Method or Constructor</th><th>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setMnemonic(int)">void setMnemonic(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getMnemonic()">char getMnemonic()</a>    <br></td><td>Set or get the keyboard alternative to clicking the button.    One form of the <code>setMnemonic</code> method    accepts a character argument;    however,     the Swing team recommends that you use an <code>int</code> argument    instead,     specifying a <code>KeyEvent.VK_<em>X</em></code> constant.</td></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setDisplayedMnemonicIndex(int)">void setDisplayedMnemonicIndex(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getDisplayedMnemonicIndex()">int getDisplayedMnemonicIndex()</a>    <br>    </td>    <td>Set or get a hint as to which character in the text should be        decorated to represent the mnemonic.  Note that not all look        and feels may support this.   </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setActionCommand(java.lang.String)">void setActionCommand(String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getActionCommand()">String getActionCommand()</a>    <br>    </td>    <td>Set or get the name of the action performed by the button.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#addActionListener(java.awt.event.ActionListener)">void addActionListener(ActionListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#removeActionListener()">ActionListener removeActionListener()</a>    <br>    </td>    <td>Add or remove an object that listens for action events        fired by the button.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#addItemListener(java.awt.event.ItemListener)">void addItemListener(ItemListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#removeItemListener()">ItemListener removeItemListener()</a>    <br>    </td>    <td>Add or remove an object that listens for item events        fired by the button.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setSelected(boolean)">void setSelected(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#isSelected()">boolean isSelected()</a>    <br>    </td>    <td>Set or get whether the button is selected.        Makes sense only for buttons that have on/off state,        such as check boxes.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#doClick()">void doClick()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#doClick(int)">void doClick(int)</a>    <br>    </td>    <td>Programmatically perform a "click".        The optional argument specifies the amount of time        (in milliseconds)        that the button should look pressed.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#setMultiClickThreshhold(long)">void setMultiClickThreshhold(long)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html#getMultiClickThreshhold()">long getMultiClickThreshhold()</a>    </td>    <td>Set or get the amount of time (in milliseconds) required between        mouse press events for the button to generate corresponding action        events.    </td>  </tr></table><p><table border=1><caption><a name="checkboxapi">Check Box Constructors</a></caption><tr><th>Constructor</th><th>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(javax.swing.Action)">JCheckBox(Action)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(java.lang.String)">JCheckBox(String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(java.lang.String, boolean)">JCheckBox(String, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(javax.swing.Icon)">JCheckBox(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(javax.swing.Icon, boolean)">JCheckBox(Icon, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(java.lang.String, javax.swing.Icon)">JCheckBox(String, Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox(java.lang.String, javax.swing.Icon, boolean)">JCheckBox(String, Icon, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBox.html#JCheckBox()">JCheckBox()</a></td><td>Create a <code>JCheckBox</code> instance.    The string argument specifies the text,    if any, that the check box should display.    Similarly, the <code>Icon</code> argument    specifies the image that should be used    instead of the look and feel's default check box image.    Specifying the boolean argument as <code>true</code>    initializes the check box to be selected.    If the boolean argument is absent or <code>false</code>,    then the check box is initially unselected.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(javax.swing.Action)">JCheckBoxMenuItem(Action)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(java.lang.String)">JCheckBoxMenuItem(String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(java.lang.String, boolean)">JCheckBoxMenuItem(String, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(javax.swing.Icon)">JCheckBoxMenuItem(Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(java.lang.String, javax.swing.Icon)">JCheckBoxMenuItem(String, Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem(java.lang.String, javax.swing.Icon, boolean)">JCheckBoxMenuItem(String, Icon, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JCheckBoxMenuItem.html#JCheckBoxMenuItem()">JCheckBoxMenuItem()</a>  </td>  <td>Create a <code>JCheckBoxMenuItem</code> instance.      The arguments are interpreted in the same way as the arguments      to the <code>JCheckBox</code> constructors,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -