/[classpath]/classpath/javax/swing/JButton.java
ViewVC logotype

Diff of /classpath/javax/swing/JButton.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rveldema, Mon Mar 11 15:48:06 2002 UTC revision 1.2 by rveldema, Tue Mar 12 11:36:22 2002 UTC
# Line 4  import java.awt.*; Line 4  import java.awt.*;
4  import java.awt.event.*;  import java.awt.event.*;
5  import javax.swing.plaf.*;  import javax.swing.plaf.*;
6    
7    
8    /**
9     * An instance of JButton can be added to a panel, frame etc
10     *
11     * @author Ronald Veldema (rveldema@cs.vu.nl)
12     */
13    
14    
15  public class JButton extends AbstractButton implements Accessible  public class JButton extends AbstractButton implements Accessible
16  {  {
17      boolean def, is_def;      boolean def, is_def;
18    
19      JButton()      
20        public JButton()
21      {      {
22          this(null, null);          this(null, null);
23      }      }
24      JButton(Action a)  
25        public JButton(Action a)
26      {      {
27          this();          this();
28          setAction(a);          setAction(a);
29      }      }
30    
31      JButton(Icon icon)      public JButton(Icon icon)
32      {      {
33          this(null, icon);          this(null, icon);
34      }          }    
35        
36      JButton(String text)      public JButton(String text)
37      {      {
38          this(text, null);          this(text, null);
39      }      }
40                
41      JButton(String text, Icon icon)      public JButton(String text, Icon icon)
42      {      {
43          super(text, icon);          super(text, icon);
44      }      }
# Line 49  public class JButton extends AbstractBut Line 59  public class JButton extends AbstractBut
59          return null;          return null;
60      }      }
61        
62      String getUIClassID()      public String getUIClassID()
63      {      {
64          //Returns a string that specifies the name of the L&F class that renders this component.            //Returns a string that specifies the name of the L&F class that renders this component.  
65          return "JButton";          return "JButton";
66      }      }
67        
68      boolean isDefaultButton()      public boolean isDefaultButton()
69      {      {
70          //Returns whether or not this button is the default button on the RootPane.            //Returns whether or not this button is the default button on the RootPane.  
71          return is_def;          return is_def;
72      }      }
73        
74      boolean isDefaultCapable()      public boolean isDefaultCapable()
75      {      {
76          //Returns whether or not this button is capable of being the default button on the RootPane.          //Returns whether or not this button is capable of being the default button on the RootPane.
77          return def;          return def;
# Line 77  public class JButton extends AbstractBut Line 87  public class JButton extends AbstractBut
87          //Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference.            //Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference.  
88      }      }
89            
90      void setDefaultCapable(boolean defaultCapable)      public void setDefaultCapable(boolean defaultCapable)
91      {   def = defaultCapable;    }      {   def = defaultCapable;    }
92            
93      void updateUI()      public void updateUI()
94      {      {
95          ButtonUI b = (ButtonUI)UIManager.getUI(this);          ButtonUI b = (ButtonUI)UIManager.getUI(this);
96          setUI(b);          setUI(b);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26