1 14 package org.wings; 15 16 17 import javax.swing.*; 18 import java.awt.event.ActionEvent ; 19 20 30 public class SButton extends SAbstractButton { 31 32 37 public SButton(String text) { 38 super(text); 39 } 40 41 47 public SButton(Action action) { 48 super(action); 49 } 50 51 54 public SButton() { 55 super(); 56 } 57 58 63 public SButton(SIcon i) { 64 super(); 65 setIcon(i); 66 } 67 68 74 75 public SButton(String text, SIcon i) { 76 super(text); 77 setIcon(i); 78 } 79 80 protected void setGroup(SButtonGroup g) { 81 if (g != null) { 82 throw new IllegalArgumentException ("SButton doesn't support button groups, use SToggleButton"); 83 } } 85 86 public boolean isSelected() { 87 return false; 88 } 89 90 private String actionCommandToFire; 91 92 public void processLowLevelEvent(String action, String [] values) { 93 processKeyEvents(values); 94 95 SForm.addArmedComponent(this); 97 98 if (getShowAsFormComponent() && 99 getActionCommand() != null) { 100 actionCommandToFire = getActionCommand(); 101 } else { 102 actionCommandToFire = values[0]; 103 } 104 } 105 106 public void fireFinalEvents() { 107 requestFocus(); 108 fireActionPerformed(new ActionEvent (this, ActionEvent.ACTION_PERFORMED, actionCommandToFire)); 109 if (getGroup() != null) { 110 getGroup().fireDelayedFinalEvents(); 111 } 112 } 113 114 public String getSelectionParameter() { 115 return getActionCommand() != null ? getActionCommand() : "1"; 116 } 117 } 118 | Popular Tags |