Revision 14997

View differences:

import/ext3D/trunk/ext3D/src/com/iver/ai2/gvsig3d/gui/TransparencyPanel.java
43 43
import java.awt.Color;
44 44
import java.awt.Dimension;
45 45
import java.awt.Insets;
46
import java.awt.event.ActionEvent;
46 47
import java.awt.event.ActionListener;
48
import java.awt.event.MouseAdapter;
47 49

  
50
import javax.swing.AbstractAction;
51
import javax.swing.Action;
48 52
import javax.swing.BorderFactory;
53
import javax.swing.JCheckBox;
49 54
import javax.swing.JLabel;
50 55
import javax.swing.JSlider;
51 56
import javax.swing.event.ChangeEvent;
......
64 69
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
65 70
import com.iver.cit.gvsig.project.documents.view.IProjectView;
66 71

  
72
import es.upv.ai2.libjosg.planets.Planet.PlanetType;
73

  
67 74
/**
68 75
 * Dialogo donde se muestran las propiedades de una vista
69 76
 * 
......
76 83

  
77 84
	private int width = 304;
78 85

  
79
	private int height = 200;
86
	private int height = 250;
80 87

  
81 88
	private JLabel lblColor;
82 89

  
......
96 103

  
97 104
	private float opacity;
98 105

  
106
	private boolean refreshDirec;
107

  
108
	private JCheckBox checkBox;
109

  
99 110
	/**
100 111
	 * This is the default constructor
101 112
	 * 
......
145 156
		this.addComponent(getSliderTrans(), new Insets(5, 35, 5, 5));
146 157
		this.addComponent(getLblColor(), new Insets(5, 90, 5, 5));
147 158

  
159
		this.addComponent(getCheckBox(), new Insets(2, 5, 2, 5));
148 160
		// Accept buton
149 161
		this.addComponent(getOkCancelPanel(), new Insets(2, 5, 2, 5));
150 162

  
151 163
		// Inicialicing default values
152 164
	}
153 165

  
166
	private javax.swing.JCheckBox getCheckBox() {
167
		if (checkBox == null) {
168

  
169
			Action action = new AbstractAction("checkbutton") {
170
				public void actionPerformed(ActionEvent evt) {
171
					refreshDirec = checkBox.isSelected();
172
					int a;
173
				}
174
			};
175
			checkBox = new JCheckBox(action);
176
			checkBox.setText("Refrescar la vista automaticamente");
177
		}
178
		return checkBox;
179
	}
180

  
154 181
	private javax.swing.JSlider getSliderTrans() {
155 182
		if (sliderTrans == null) {
156 183
			sliderTrans = new JSlider(JSlider.HORIZONTAL, 0, 255,
......
165 192

  
166 193
	public void stateChanged(ChangeEvent e) {
167 194
		JSlider source = (JSlider) e.getSource();
168
		if (!source.getValueIsAdjusting()) {
169
			int trans = (int) source.getValue();
170
			if (lblColor != null) {
171
				Color aux = lblColor.getBackground();
172
				Color co = new Color(aux.getRed(), aux.getGreen(), aux
173
						.getBlue(), trans);
174
				lblColor.setBackground(co);
195
		int trans = (int) source.getValue();
196
		if (lblColor != null) {
197
			Color aux = lblColor.getBackground();
198
			Color co = new Color(aux.getRed(), aux.getGreen(), aux.getBlue(),
199
					trans);
200
			lblColor.setBackground(co);
201
			if (refreshDirec) {
202
				// Alpha value
203
				float a = ((float) lblColor.getBackground().getAlpha()) / 255.0f;
204
				// Setting opaciti in layer properties
205
				layer3DProps.setOpacity(a);
206
				// Notify the opacity to planet
207
				view3D.getPlanet().setLayerOpacity(order, a);
208
				// Repainting canvas
209
				view3D.getCanvas3d().repaint();
175 210
			}
176 211
			this.repaint();
177 212
		}

Also available in: Unified diff