java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
- All Implemented Interfaces:
- ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants
- Direct Known Subclasses:
- JButton, JMenuItem, JToggleButton
- See Also:
- Top Examples, Source Code,
XMLEncoder
public AbstractButton()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ActionListener actionListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addActionListener(ActionListener l)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[411]Create JButton with ActionListener
By Madhu on 2003/12/16 11:51:18 Rate
public class save
{
private JButton theButton;
public test ( )
{
theButton = new JButton ( "save" ) ;
theButton.addActionListener ( new ButtonSelector ( ) ) ;
}
public class ButtonSelector implements ActionListener
{
public void actionPerformed ( ActionEvent e4 )
{
}
}
public static void main ( String [ ] args )
{
new test ( ) ;
}
}
public void addChangeListener(ChangeListener l)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void addImpl(Component comp,
Object constraints,
int index)
- See Also:
LayoutManager2
, LayoutManager
, Container.add(Component, java.lang.Object)
, Container.add(Component, int)
, Container.add(Component)
, IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addItemListener(ItemListener l)
- See Also:
ItemEvent
, ItemSelectable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String BORDER_PAINTED_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient ChangeEvent changeEvent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ChangeListener changeListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected int checkHorizontalKey(int key,
String exception)
- See Also:
setHorizontalAlignment(int)
, setHorizontalTextPosition(int)
, IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected int checkVerticalKey(int key,
String exception)
- See Also:
- IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void configurePropertiesFromAction(Action a)
- See Also:
setAction(javax.swing.Action)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String CONTENT_AREA_FILLED_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ActionListener createActionListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected PropertyChangeListener createActionPropertyChangeListener(Action a)
- See Also:
setAction(javax.swing.Action)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ChangeListener createChangeListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ItemListener createItemListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String DISABLED_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void doClick()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void doClick(int pressTime)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireActionPerformed(ActionEvent event)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireItemStateChanged(ItemEvent event)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireStateChanged()
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String FOCUS_PAINTED_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Action getAction()
- See Also:
setAction(javax.swing.Action)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getActionCommand()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ActionListener[] getActionListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ChangeListener[] getChangeListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getDisabledIcon()
- See Also:
LookAndFeel.getDisabledIcon(javax.swing.JComponent, javax.swing.Icon)
, setDisabledIcon(javax.swing.Icon)
, getPressedIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getDisabledSelectedIcon()
- See Also:
LookAndFeel.getDisabledSelectedIcon(javax.swing.JComponent, javax.swing.Icon)
, setDisabledSelectedIcon(javax.swing.Icon)
, getDisabledIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getDisplayedMnemonicIndex()
- See Also:
setDisplayedMnemonicIndex(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getHorizontalAlignment()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[174]Positioning all buttons and labels
By Anonymous on 2003/03/12 17:40:26 Rate
for ( int i = 0; i < controls.size ( ) ; i++ ) {
Component c = ( Component ) controls.elementAt ( i ) ;
int hPos, vPos, hAlign, vAlign;
if ( c instanceof AbstractButton ) {
hPos = ( ( AbstractButton ) c ) .getHorizontalTextPosition ( ) ;
vPos = ( ( AbstractButton ) c ) .getVerticalTextPosition ( ) ;
hAlign = ( ( AbstractButton ) c ) .getHorizontalAlignment ( ) ;
vAlign = ( ( AbstractButton ) c ) .getVerticalAlignment ( ) ;
} else if ( c instanceof JLabel ) {
hPos = ( ( JLabel ) c ) .getHorizontalTextPosition ( ) ;
vPos = ( ( JLabel ) c ) .getVerticalTextPosition ( ) ;
hAlign = ( ( JLabel ) c ) .getHorizontalAlignment ( ) ;
vAlign = ( ( JLabel ) c ) .getVerticalAlignment ( ) ;
} else {
continue;
}
setPosition ( c, hPos, vPos ) ;
setAlignment ( c, hAlign, vAlign ) ;
}
public int getHorizontalTextPosition()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getIcon()
- See Also:
setIcon(javax.swing.Icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getIconTextGap()
- See Also:
setIconTextGap(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ItemListener[] getItemListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public String getLabel()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Insets getMargin()
- See Also:
setMargin(java.awt.Insets)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getMnemonic()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ButtonModel getModel()
- See Also:
setModel(javax.swing.ButtonModel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public long getMultiClickThreshhold()
- See Also:
setMultiClickThreshhold(long)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getPressedIcon()
- See Also:
setPressedIcon(javax.swing.Icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getRolloverIcon()
- See Also:
setRolloverIcon(javax.swing.Icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getRolloverSelectedIcon()
- See Also:
setRolloverSelectedIcon(javax.swing.Icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Icon getSelectedIcon()
- See Also:
setSelectedIcon(javax.swing.Icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object[] getSelectedObjects()
- See Also:
- ItemSelectable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getText()
- See Also:
setText(java.lang.String)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ButtonUI getUI()
- See Also:
setUI(javax.swing.plaf.ButtonUI)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getVerticalAlignment()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getVerticalTextPosition()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean imageUpdate(Image img,
int infoflags,
int x,
int y,
int w,
int h)
- See Also:
ImageObserver
, Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void init(String text,
Icon icon)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isBorderPainted()
- See Also:
setBorderPainted(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isContentAreaFilled()
- See Also:
setContentAreaFilled(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isFocusPainted()
- See Also:
setFocusPainted(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isRolloverEnabled()
- See Also:
setRolloverEnabled(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isSelected()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ItemListener itemListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String MARGIN_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String MNEMONIC_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected ButtonModel model
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String MODEL_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void paintBorder(Graphics g)
- See Also:
JComponent.setBorder(javax.swing.border.Border)
, JComponent.paint(java.awt.Graphics)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected String paramString()
- See Also:
- JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String PRESSED_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeActionListener(ActionListener l)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeChangeListener(ChangeListener l)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeItemListener(ItemListener l)
- See Also:
ItemEvent
, ItemSelectable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ROLLOVER_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String SELECTED_ICON_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setAction(Action a)
- See Also:
createActionPropertyChangeListener(javax.swing.Action)
, configurePropertiesFromAction(javax.swing.Action)
, getAction()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setActionCommand(String actionCommand)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setBorderPainted(boolean b)
- See Also:
isBorderPainted()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setContentAreaFilled(boolean b)
- See Also:
JComponent.setOpaque(boolean)
, isContentAreaFilled()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setDisabledIcon(Icon disabledIcon)
- See Also:
getDisabledIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setDisabledSelectedIcon(Icon disabledSelectedIcon)
- See Also:
getDisabledSelectedIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setDisplayedMnemonicIndex(int index)
throws IllegalArgumentException
- See Also:
getDisplayedMnemonicIndex()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setEnabled(boolean b)
- See Also:
Component.isLightweight()
, Component.isEnabled()
, JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setFocusPainted(boolean b)
- See Also:
isFocusPainted()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setHorizontalAlignment(int alignment)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setHorizontalTextPosition(int textPosition)
- See Also:
- IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setIcon(Icon defaultIcon)
- See Also:
setPressedIcon(javax.swing.Icon)
, getIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setIconTextGap(int iconTextGap)
- See Also:
getIconTextGap()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void setLabel(String label)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setLayout(LayoutManager mgr)
- See Also:
Container.getLayout()
, Container.doLayout()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setMargin(Insets m)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setMnemonic(char mnemonic)
- See Also:
setMnemonic(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[596]Create short cut key for a menu item
By jyurow { at } aol { dot } com on 2004/01/01 17:25:06 Rate
menu = new JMenu ( "File" ) ;
menu.setMnemonic ( KeyEvent.VK_F ) ;
menu.add ( menuItem ) ;
public void setMnemonic(int mnemonic)
- See Also:
setDisplayedMnemonicIndex(int)
, KeyEvent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setModel(ButtonModel newModel)
- See Also:
getModel()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setMultiClickThreshhold(long threshhold)
- See Also:
getMultiClickThreshhold()
, IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setPressedIcon(Icon pressedIcon)
- See Also:
getPressedIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRolloverEnabled(boolean b)
- See Also:
isRolloverEnabled()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRolloverIcon(Icon rolloverIcon)
- See Also:
getRolloverIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRolloverSelectedIcon(Icon rolloverSelectedIcon)
- See Also:
getRolloverSelectedIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelected(boolean b)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectedIcon(Icon selectedIcon)
- See Also:
getSelectedIcon()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setText(String text)
- See Also:
getText()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setUI(ButtonUI ui)
- See Also:
getUI()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setVerticalAlignment(int alignment)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setVerticalTextPosition(int textPosition)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String TEXT_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void updateUI()
- See Also:
UIManager.getUI(javax.swing.JComponent)
, UIManager.getLookAndFeel()
, JComponent.setUI(javax.swing.plaf.ComponentUI)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples