352 lines
9.6 KiB
Java
352 lines
9.6 KiB
Java
/*
|
|
* Created on 28-sep-2004
|
|
*
|
|
* To change the template for this generated file go to
|
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
|
*/
|
|
package com.tarisan.chipcard.gui;
|
|
|
|
import java.awt.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
public class DetallesDialog extends javax.swing.JDialog implements Runnable,java.awt.event.ActionListener {
|
|
private javax.swing.JButton ivjAceptar = null;
|
|
private javax.swing.JButton ivjDescripcion = null;
|
|
private javax.swing.JLabel ivjEtiqueta = null;
|
|
private javax.swing.JPanel ivjJInternalFrameContentPane = null;
|
|
private javax.swing.JPanel ivjPanel = null;
|
|
private Editor edit = new Editor();
|
|
String mensaje = new String();
|
|
String error = new String();
|
|
Toolkit t = Toolkit.getDefaultToolkit();
|
|
Icon icono = (Icon) UIManager.get("OptionPane.errorIcon");
|
|
|
|
private Thread objThread=null;
|
|
private int intNumeroSegundos=-1;
|
|
/**
|
|
* Constructor
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
public DetallesDialog(JFrame f,String strTitle, String error, String mensaje) {
|
|
this( f, strTitle, error, mensaje, null);
|
|
}
|
|
public DetallesDialog(JFrame f,String strTitle, String error, String mensaje, Icon icon) {
|
|
|
|
super(f,strTitle);
|
|
this.mensaje = mensaje;
|
|
this.error = error;
|
|
if(icon!=null)
|
|
icono = icon;
|
|
initialize();
|
|
}
|
|
/**
|
|
* Detalles constructor comment.
|
|
* @param title java.lang.String
|
|
*/
|
|
|
|
/**
|
|
* Detalles constructor comment.
|
|
* @param title java.lang.String
|
|
* @param resizable boolean
|
|
*/
|
|
public DetallesDialog(JFrame f,String title, boolean resizable) {
|
|
super(f,title);
|
|
setResizable(resizable);
|
|
}
|
|
/**
|
|
* Detalles constructor comment.
|
|
* @param title java.lang.String
|
|
* @param resizable boolean
|
|
* @param closable boolean
|
|
*/
|
|
public DetallesDialog(JFrame f,String title, boolean resizable, boolean closable) {
|
|
super(f,title);
|
|
setResizable(resizable);
|
|
}
|
|
/**
|
|
* Detalles constructor comment.
|
|
* @param title java.lang.String
|
|
* @param resizable boolean
|
|
* @param closable boolean
|
|
* @param maximizable boolean
|
|
*/
|
|
public DetallesDialog(JFrame f,String title, boolean resizable, boolean closable, boolean maximizable) {
|
|
super(f,title);
|
|
setResizable(resizable);
|
|
}
|
|
/**
|
|
* Detalles constructor comment.
|
|
* @param title java.lang.String
|
|
* @param resizable boolean
|
|
* @param closable boolean
|
|
* @param maximizable boolean
|
|
* @param iconifiable boolean
|
|
*/
|
|
public DetallesDialog(JFrame f,String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) {
|
|
super(f,title);
|
|
setResizable(resizable);
|
|
}
|
|
|
|
// Center a dialog on screen
|
|
public static void centerDialog(Window frame) {
|
|
Dimension dialogSize = frame.getSize();
|
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
|
frame.setLocation(screenSize.width/2 - dialogSize.width/2,
|
|
screenSize.height/2 - dialogSize.height/2);
|
|
}
|
|
/**
|
|
* Comment
|
|
*/
|
|
public void aceptar_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
|
|
try
|
|
{
|
|
dispose();
|
|
}
|
|
catch (Exception w)
|
|
{
|
|
//System.out.println("hola");
|
|
}
|
|
return;
|
|
}
|
|
|
|
public void setAutomaticClose(int intSeconds){
|
|
intNumeroSegundos=intSeconds;
|
|
objThread=new Thread(this);
|
|
objThread.start();
|
|
}
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
// user code begin {1}
|
|
// user code end
|
|
if ((e.getSource() == getAceptar()) ) {
|
|
connEtoC2(e);
|
|
}
|
|
|
|
if ((e.getSource() == getDescripcion()) ) {
|
|
connEtoC3(e);
|
|
}
|
|
// user code begin {2}
|
|
// user code end
|
|
}
|
|
|
|
/**
|
|
* connEtoC2: (Aceptar.action.actionPerformed(java.awt.event.ActionEvent) --> Detalles.aceptar_ActionPerformed(Ljava.awt.event.ActionEvent;)V)
|
|
* @param arg1 java.awt.event.ActionEvent
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
|
|
private void connEtoC2(java.awt.event.ActionEvent arg1) {
|
|
try {
|
|
// user code begin {1}
|
|
// user code end
|
|
this.aceptar_ActionPerformed(arg1);
|
|
// user code begin {2}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {3}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* connEtoC3: (Descripcion.action.actionPerformed(java.awt.event.ActionEvent) --> Detalles.descripcion_ActionPerformed(Ljava.awt.event.ActionEvent;)V)
|
|
* @param arg1 java.awt.event.ActionEvent
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
private void connEtoC3(java.awt.event.ActionEvent arg1) {
|
|
try {
|
|
// user code begin {1}
|
|
// user code end
|
|
this.descripcion_ActionPerformed(arg1);
|
|
// user code begin {2}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {3}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
}
|
|
/**
|
|
* Comment
|
|
*/
|
|
public void descripcion_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
|
|
if(this.getSize().height < 200)
|
|
{
|
|
ivjDescripcion.setText("\u00AB Descripción");
|
|
this.setSize(this.getSize().width,200);
|
|
edit.append(mensaje, new Color(0xFF0000));
|
|
}
|
|
else
|
|
{
|
|
ivjDescripcion.setText("Descripción \u00BB");
|
|
this.setSize(this.getSize().width,110);
|
|
edit.remove();
|
|
}
|
|
validate();
|
|
repaint();
|
|
return;
|
|
}
|
|
/**
|
|
* Return the Aceptar property value.
|
|
* @return javax.swing.JButton
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
public javax.swing.JButton getAceptar() {
|
|
if (ivjAceptar == null) {
|
|
try {
|
|
ivjAceptar = new javax.swing.JButton();
|
|
ivjAceptar.setName("Aceptar");
|
|
ivjAceptar.setText("Aceptar");
|
|
ivjAceptar.setBounds(33, 56, 85, 17);
|
|
// user code begin {1}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {2}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
};
|
|
return ivjAceptar;
|
|
}
|
|
|
|
private javax.swing.JButton getDescripcion() {
|
|
if (ivjDescripcion == null) {
|
|
try {
|
|
ivjDescripcion = new javax.swing.JButton();
|
|
ivjDescripcion.setName("Descripcion");
|
|
ivjDescripcion.setText("Descripción \u00BB");
|
|
ivjDescripcion.setBounds(170, 56, 115, 17);
|
|
ivjDescripcion.setActionCommand("Descripcion");
|
|
// user code begin {1}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {2}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
};
|
|
return ivjDescripcion;
|
|
}
|
|
/**
|
|
* Return the Etiqueta property value.
|
|
* @return javax.swing.JLabel
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
private javax.swing.JLabel getEtiqueta() {
|
|
if (ivjEtiqueta == null) {
|
|
try {
|
|
ivjEtiqueta = new javax.swing.JLabel();
|
|
ivjEtiqueta.setName("Etiqueta");
|
|
ivjEtiqueta.setIcon(icono);
|
|
ivjEtiqueta.setText(error);
|
|
ivjEtiqueta.setBounds(15, 14, 258, 28);
|
|
// user code begin {1}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {2}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
};
|
|
return ivjEtiqueta;
|
|
}
|
|
/**
|
|
* Return the JInternalFrameContentPane property value.
|
|
* @return javax.swing.JPanel
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
public javax.swing.JPanel getJInternalFrameContentPane() {
|
|
if (ivjJInternalFrameContentPane == null) {
|
|
try {
|
|
ivjJInternalFrameContentPane = new javax.swing.JPanel();
|
|
ivjJInternalFrameContentPane.setName("JInternalFrameContentPane");
|
|
ivjJInternalFrameContentPane.setLayout(null);
|
|
getJInternalFrameContentPane().add(getAceptar(), getAceptar().getName());
|
|
getJInternalFrameContentPane().add(getEtiqueta(), getEtiqueta().getName());
|
|
getJInternalFrameContentPane().add(getPanel(), getPanel().getName());
|
|
getJInternalFrameContentPane().add(getDescripcion(), getDescripcion().getName());
|
|
// user code begin {1}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {2}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
};
|
|
return ivjJInternalFrameContentPane;
|
|
}
|
|
/**
|
|
* Return the Panel property value.
|
|
* @return javax.swing.JPanel
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
private javax.swing.JPanel getPanel() {
|
|
|
|
if (ivjPanel == null) {
|
|
try {
|
|
ivjPanel = new javax.swing.JPanel();
|
|
ivjPanel.setName("Panel");
|
|
ivjPanel.setLayout(new BorderLayout());
|
|
ivjPanel.setBounds(12, 91, 282, 50);
|
|
ivjPanel.add("Center",edit);
|
|
// user code begin {1}
|
|
// user code end
|
|
} catch (java.lang.Throwable ivjExc) {
|
|
// user code begin {2}
|
|
// user code end
|
|
handleException(ivjExc);
|
|
}
|
|
};
|
|
return ivjPanel;
|
|
}
|
|
/**
|
|
* Called whenever the part throws an exception.
|
|
* @param exception java.lang.Throwable
|
|
*/
|
|
private void handleException(Throwable exception) {
|
|
|
|
/* Uncomment the following lines to print uncaught exceptions to stdout */
|
|
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
|
|
// exception.printStackTrace(System.out);
|
|
}
|
|
/**
|
|
* Initializes connections
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
private void initConnections() {
|
|
// user code begin {1}
|
|
// user code end
|
|
getAceptar().addActionListener(this);
|
|
getDescripcion().addActionListener(this);
|
|
}
|
|
/**
|
|
* Initialize the class.
|
|
*/
|
|
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
|
private void initialize() {
|
|
// user code begin {1}
|
|
// user code end
|
|
setName("Detalles");
|
|
setBounds((t.getScreenSize().width-317)/2,(t.getScreenSize().height-110)/2, 317, 110);
|
|
setContentPane(getJInternalFrameContentPane());
|
|
initConnections();
|
|
// user code begin {2}
|
|
// user code end
|
|
}
|
|
|
|
public void run(){
|
|
try{
|
|
objThread.sleep(intNumeroSegundos*1000);
|
|
}catch(Exception err){
|
|
}
|
|
dispose();
|
|
}
|
|
/**
|
|
* main entrypoint - starts the part when it is run as an application
|
|
* @param args java.lang.String[]
|
|
*/
|
|
}
|
|
|