Revision 1752 org.gvsig.raster.georeferencing/trunk/org.gvsig.raster.georeferencing/org.gvsig.raster.georeferencing.swing/org.gvsig.raster.georeferencing.swing.impl/src/main/java/org/gvsig/raster/georeferencing/swing/impl/option/CellSizeOptionsPanel.java

View differences:

CellSizeOptionsPanel.java
24 24
import java.awt.GridBagConstraints;
25 25
import java.awt.GridBagLayout;
26 26
import java.awt.Insets;
27
import java.beans.PropertyChangeEvent;
28
import java.beans.PropertyChangeListener;
29
import java.text.DecimalFormat;
27 30

  
31
import javax.swing.JFormattedTextField;
32
import javax.swing.JLabel;
28 33
import javax.swing.JPanel;
29 34

  
30
import org.gvsig.gui.beans.datainput.DataInputContainer;
31 35
import org.gvsig.i18n.Messages;
32 36

  
33 37
/**
......
39 43
public class CellSizeOptionsPanel extends JPanel {
40 44
	private static final long     serialVersionUID    = 1L;
41 45
	
42
	private DataInputContainer    xCellSize           = null;
43
	private DataInputContainer    yCellSize           = null;
46
	private CellSizeContainer      xCellSize           = null;
47
	private CellSizeContainer      yCellSize           = null;
48
	
49
	public class CellSizeContainer extends JPanel implements PropertyChangeListener {
50
		private static final long      serialVersionUID = 1L;
51
		private JFormattedTextField    box;
52
		private PropertyChangeListener listener            = null;
44 53
		
54
		public CellSizeContainer(String txt) {
55
			box = new JFormattedTextField(new DecimalFormat("########.########"));
56
			box.setValue(0.0);
57
			box.addPropertyChangeListener("value", this);
58
			setLayout(new GridBagLayout());
59
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
60
			gridBagConstraints.insets = new Insets(0, 0, 0, 0);
61
			add(new JLabel(txt), gridBagConstraints);
62

  
63
			gridBagConstraints = new GridBagConstraints();
64
			gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
65
			gridBagConstraints.weightx = 1.0;
66
			add(box, gridBagConstraints);
67
		}
68
		
69
		public String getValue() {
70
			double n = ((Number) box.getValue()).doubleValue();
71
			return Double.toString(n);
72
		}
73
		
74
		public void setValue(String value) {
75
			box.setValue(new Double(value));
76
		}
77

  
78
		public void setListener(PropertyChangeListener listener) {
79
			this.listener = listener;
80
		}
81
		
82
		public void propertyChange(PropertyChangeEvent evt) {
83
			listener.propertyChange(evt);
84
		}
85
	}
86
		
45 87
	/**
46 88
	 * Constructor. Asigna la lista de nombres de vistas para el selector. 
47 89
	 * @param viewList
......
74 116
	 * Obtiene el control para selecci?n de tama?o de pixel en X
75 117
	 * @return DataInputContainer
76 118
	 */
77
	public DataInputContainer getXCellSizeTextField() {
119
	public CellSizeContainer getXCellSizeTextField() {
78 120
		if(xCellSize == null) {
79
			xCellSize = new DataInputContainer(8);
80
			xCellSize.setLabelText("X ");
121
			xCellSize = new CellSizeContainer("X: ");
81 122
		}
82 123
		return xCellSize;
83 124
	}
......
86 127
	 * Obtiene el control para selecci?n de tama?o de pixel en Y
87 128
	 * @return DataInputContainer
88 129
	 */
89
	public DataInputContainer getYCellSizeTextField() {
130
	public CellSizeContainer getYCellSizeTextField() {
90 131
		if(yCellSize == null) {
91
			yCellSize = new DataInputContainer(8);
92
			yCellSize.setLabelText("Y ");
132
			yCellSize = new CellSizeContainer("Y: ");
93 133
		}
94 134
		return yCellSize;
95 135
	}

Also available in: Unified diff