Class Button

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Button extends Component implements Accessible
Emulator for Button — a thin delegating shell over its SButton peer. Not to be confused with JButton: this is the AWT 1.0 push button, whose entire API is twelve methods with no ButtonModel, no Action, no icon, no mnemonic and no selected state. Everything a migrator touches beyond the members below — setBounds, setFont, setBackground, setEnabled, addMouseListener, requestFocus — is inherited Component.

Responsibility split with the peer:

  • Surrogate — the rendered Vaadin Button, the ClickNotifier → ActionEvent fan-out, and the actionCommand-falls-back-to-label rule.
  • Emulator (here) — the AWT-shape API migrated code compiles against: ActionListener with source == this Button, and a label field shadow so getLabel() returns null verbatim where the surrogate's Vaadin-backed getText() would say "" (R_swing_is_truth over the accepted R_vaadin_first loss).

Leaf peer is locked down per R_leaf_peer_lockdown: java.awt.Button has no public subclass in java.awt, so there is no protected (Component peer) ctor and every instance peers over an SButton.

See Also:
  • Constructor Details

  • Method Details

    • addNotify

      public void addNotify()
      Overrides:
      addNotify in class Component
    • getLabel

      public String getLabel()
    • setLabel

      public void setLabel(String label)
    • getActionCommand

      public String getActionCommand()
    • setActionCommand

      public void setActionCommand(String command)
    • addActionListener

      public void addActionListener(ActionListener l)
    • removeActionListener

      public void removeActionListener(ActionListener l)
    • getActionListeners

      public ActionListener[] getActionListeners()
    • processEvent

      protected void processEvent(AWTEvent e)
      Overrides:
      processEvent in class Component
    • processActionEvent

      protected void processActionEvent(ActionEvent e)
      The single funnel every action reaches the listeners through — both the peer click bridge and a user-code processEvent call. AWT subclasses override this (calling super) to intercept actions wholesale, so it must stay the only dispatch path.
    • paramString

      protected String paramString()
      Overrides:
      paramString in class Component
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component