1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.x.impl.swing;
14
15 import java.awt.Dimension;
16
17 import javax.swing.Action;
18 import javax.swing.JButton;
19
20 import com.eviware.x.form.XFormTextField;
21
22 public class ActionFormFieldComponent extends AbstractSwingXFormField<JButton> implements XFormTextField
23 {
24 public ActionFormFieldComponent( String name, String description )
25 {
26 super( new JButton( name ) );
27 }
28
29 public void setWidth( int columns )
30 {
31 getComponent().setPreferredSize( new Dimension( columns, 20 ) );
32 }
33
34 public String getValue()
35 {
36 return null;
37 }
38
39 public void setValue( String value )
40 {
41 }
42
43 @Override
44 public void setProperty( String name, Object value )
45 {
46 if( name.equals( "action" ) )
47 {
48 getComponent().setAction( ( Action )value );
49 }
50 else
51 {
52 super.setProperty( name, value );
53 }
54 }
55
56 }