/**
* Boite de dialogue permettant de d�finir l'espacement des points de calibration
*
* @author HEIT Sylvestre & Coustillac Laurent
*
*
* Programme kartoMNT : g�n�ration de MNT � partir d'une carte de lignes de niveaux
* Copyright (C) 2002 HEIT Sylvestre & Coustillac Laurent
*
* Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon les termes de la Licence
*Publique G�n�rale GNU publi�e par la Free Software Foundation (version 2).
*
*Ce programme est distribu� car potentiellement utile, mais SANS AUCUNE GARANTIE, ni explicite ni implicite,
*y compris les garanties de commercialisation ou d'adaptation dans un but sp�cifique. Reportez-vous � la
*Licence Publique G�n�rale GNU pour plus de d�tails.
*
*Vous devez avoir re�u une copie de la Licence Publique G�n�rale GNU en m�me temps que ce programme ; si
*ce n'est pas le cas, �crivez � la
*Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, �tats-Unis.
*/
package kartoMNT;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import kartoMNT.karto.outils.MsgInfo;
public class CarroyageDialog extends JDialog
{
/** Creates new form carroyageDialog */
public CarroyageDialog(java.awt.Frame parent,DocumentKartoContainer _documentKartoContainer, boolean modal)
{
super(parent, modal);
frameParent=parent;
documentKartoContainer=_documentKartoContainer;
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents()
{//GEN-BEGIN:initComponents
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
JPanel mainPanel=new JPanel();
getContentPane().add(mainPanel);
mainPanel.setLayout(new kartoMNT.org.netbeans.lib.awtextra.AbsoluteLayout());
mainPanel.setBorder(new EmptyBorder(20,20,20,20));
addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent evt)
{
closeDialog(evt);
}
}
);
jLabel1.setText(ResourceManager.get("carroDist"));
mainPanel.add(jLabel1, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));
jLabel2.setText(ResourceManager.get("carroEspV"));
mainPanel.add(jLabel2, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, -1, -1));
jLabel3.setText(ResourceManager.get("carroEspH"));
mainPanel.add(jLabel3, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, -1, -1));
jTextField1.setText("1");
mainPanel.add(jTextField1, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(170, 60, 40, -1));
jTextField2.setText("1");
mainPanel.add(jTextField2, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(170, 30, 40, -1));
jButton1.setText(ResourceManager.get("CancelKey"));
mainPanel.add(jButton1, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(130, 100, -1, -1));
jButton1.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
actionCancel(evt);
}
}
);
jButton2.setText("Ok");
mainPanel.add(jButton2, new kartoMNT.org.netbeans.lib.awtextra.AbsoluteConstraints(60, 100, -1, -1));
jButton2.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
actionOk(evt);
}
}
);
pack();
Dimension dim=getSize();
setSize(dim.width+20,dim.height+5);
setTitle(ResourceManager.get("optCarroyage"));
Util.centrer(this);
}//GEN-END:initComponents
/** Closes the dialog */
private void closeDialog(java.awt.event.WindowEvent evt)
{//GEN-FIRST:event_closeDialog
setVisible(false);
dispose();
}//GEN-LAST:event_closeDialog
private void actionCancel(java.awt.event.ActionEvent evt)
{
setVisible(false);
dispose();
}
private void actionOk(java.awt.event.ActionEvent evt)
{
try
{
DocumentKarto doc=(DocumentKarto)documentKartoContainer.getCurrentDocument();
if(doc==null)
return;
Carroyage c=doc.getCarroyage();
if(c==null)
return;
double deltax=Double.parseDouble(jTextField2.getText());
double deltay=Double.parseDouble(jTextField1.getText());
if((deltax>0)&&(deltay>0))
c.setInterval(deltax,deltay);
setVisible(false);
dispose();
}
catch (NumberFormatException ne)
{
MsgInfo msg=new MsgInfo(frameParent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("fillError"));
}
}
/**
* @param args the command line arguments
*/
/*public static void main(String args[]) {
new carroyageDialog(new javax.swing.JFrame(), true).show();
}*/
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
// End of variables declaration//GEN-END:variables
DocumentKartoContainer documentKartoContainer;
Frame frameParent;
}