Revision 15313
import/ext3D/branches/ext3D_v1.1/ext3D/src/com/iver/ai2/gvsig3d/gui/InsertPosition.java | ||
---|---|---|
44 | 44 |
import java.awt.Insets; |
45 | 45 |
import java.awt.event.ActionEvent; |
46 | 46 |
import java.awt.event.ActionListener; |
47 |
import java.io.File; |
|
48 |
import java.io.IOException; |
|
47 | 49 |
import java.util.Enumeration; |
48 | 50 |
|
49 | 51 |
import javax.swing.AbstractAction; |
50 | 52 |
import javax.swing.Action; |
51 | 53 |
import javax.swing.BorderFactory; |
52 | 54 |
import javax.swing.ButtonGroup; |
53 |
import javax.swing.JLabel;
|
|
55 |
import javax.swing.JFileChooser;
|
|
54 | 56 |
import javax.swing.JPanel; |
55 | 57 |
import javax.swing.JRadioButton; |
56 | 58 |
import javax.swing.JTextField; |
... | ... | |
59 | 61 |
import org.gvsig.gui.beans.swing.JButton; |
60 | 62 |
|
61 | 63 |
import com.iver.ai2.gvsig3d.ProjectView3D; |
62 |
import com.iver.ai2.gvsig3d.utils.UtilCoord; |
|
63 | 64 |
import com.iver.andami.PluginServices; |
64 | 65 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
65 | 66 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
... | ... | |
74 | 75 |
* @author Fernando Gonz?lez Cort?s |
75 | 76 |
*/ |
76 | 77 |
public class InsertPosition extends GridBagLayoutPanel implements |
77 |
SingletonWindow { |
|
78 |
SingletonWindow, ActionListener {
|
|
78 | 79 |
|
79 | 80 |
private ProjectView3D view3D; |
80 | 81 |
|
... | ... | |
124 | 125 |
|
125 | 126 |
private GridBagLayoutPanel cartesianasLongitudPanel; |
126 | 127 |
|
128 |
private JButton openButton = new JButton("Explorar"); |
|
129 |
|
|
127 | 130 |
/** |
128 | 131 |
* This is the default constructor |
129 | 132 |
* |
... | ... | |
154 | 157 |
|
155 | 158 |
// Name Component |
156 | 159 |
this.addComponent("Nombre:", getTxtName(), new Insets(0, 10, 2, 10)); |
160 |
this.addComponent(openButton); |
|
161 |
openButton .addActionListener(this); |
|
157 | 162 |
|
158 | 163 |
// Projection selector (Radio buton group) |
159 | 164 |
// this.addComponent("Seleccione proyecci?n:", |
... | ... | |
440 | 445 |
|
441 | 446 |
// Vec3 posicion = new Vec3(h,lati,longi); |
442 | 447 |
Vec3 posicion = new Vec3(lati,longi,h); |
443 |
view3D.insertaText(txtName.getText(),posicion);
|
|
448 |
view3D.insert3DObject(txtName.getText(),posicion);
|
|
444 | 449 |
|
445 | 450 |
} |
446 | 451 |
PluginServices.getMDIManager().closeWindow( |
... | ... | |
481 | 486 |
return m_viewinfo; |
482 | 487 |
} |
483 | 488 |
|
489 |
public void actionPerformed(ActionEvent e) { |
|
490 |
JFileChooser fc = new JFileChooser(); |
|
491 |
int returnVal = fc.showOpenDialog(this); |
|
492 |
|
|
493 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
|
494 |
File file = fc.getSelectedFile(); |
|
495 |
//this is where a real application would open the file. |
|
496 |
System.out.println("Opening: " + file.getName()); |
|
497 |
txtName.setText(file.getPath()); |
|
498 |
txtName.repaint(); |
|
499 |
} else { |
|
500 |
System.out.println("Open command cancelled by user."); |
|
501 |
} |
|
502 |
|
|
503 |
} |
|
504 |
|
|
484 | 505 |
} |
Also available in: Unified diff