Añado los fuentes de java
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
/**
|
||||
* @author jjrider
|
||||
*/
|
||||
public class AutomaticCloseDialog extends JDialog implements ActionListener,Runnable {
|
||||
|
||||
private int intNumeroSegundos=5;
|
||||
private Thread objThread=null;
|
||||
|
||||
public AutomaticCloseDialog(String strTitle,String strMensaje,int intNumeroSegundos){
|
||||
super();
|
||||
setUndecorated(false);
|
||||
setSize(320,150);
|
||||
this.intNumeroSegundos=intNumeroSegundos;
|
||||
setTitle(strTitle);
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JLabel label=new JLabel(strMensaje);
|
||||
label.setBounds(40,40,300,20);
|
||||
getContentPane().add(label);
|
||||
|
||||
JButton btnAceptar=new JButton("Aceptar");
|
||||
btnAceptar.setActionCommand("Aceptar");
|
||||
btnAceptar.addActionListener(this);
|
||||
btnAceptar.setBounds(115,80,90,20);
|
||||
getContentPane().add(btnAceptar);
|
||||
objThread=new Thread(this);
|
||||
validate();
|
||||
centerOnScreen(this);
|
||||
objThread.start();
|
||||
show();
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e){
|
||||
hide();
|
||||
}
|
||||
|
||||
public static void centerOnScreen(JDialog dialog){
|
||||
if(dialog==null)
|
||||
return;
|
||||
Dimension dimFrame=java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
Dimension dimDialog=dialog.getSize();
|
||||
int distanceWidth=dimFrame.width-dimDialog.width;
|
||||
distanceWidth=distanceWidth/2;
|
||||
int distanceHeight=dimFrame.height-dimDialog.height;
|
||||
distanceHeight=distanceHeight/2;
|
||||
dialog.setBounds(distanceWidth,distanceHeight,dimDialog.width,dimDialog.height);
|
||||
}
|
||||
|
||||
public void run(){
|
||||
try{
|
||||
objThread.sleep(intNumeroSegundos*1000);
|
||||
}catch(Exception err){
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListCellRenderer;
|
||||
import java.util.*;
|
||||
|
||||
/****
|
||||
* Se encarga de personalizar un combo
|
||||
* @author jjrider
|
||||
*
|
||||
*/
|
||||
public class ComboCellRenderer extends JLabel implements ListCellRenderer {
|
||||
HashMap hshImagenes=new HashMap();
|
||||
|
||||
private int nHeight=40;
|
||||
|
||||
public ComboCellRenderer() {
|
||||
super("");
|
||||
setOpaque(true);
|
||||
setVerticalTextPosition(JLabel.CENTER);
|
||||
setHorizontalTextPosition(JLabel.RIGHT);
|
||||
setHorizontalAlignment(LEFT);
|
||||
setVerticalAlignment(CENTER);
|
||||
//setFont(new java.awt.Font("Tahoma",java.awt.Font.BOLD,14));
|
||||
//setPreferredSize(new java.awt.Dimension(120,nHeight));
|
||||
//setMinimumSize(new java.awt.Dimension(120,35));
|
||||
}
|
||||
|
||||
public void addIcon(Object sValue,Icon icon){
|
||||
//System.out.println("addIcon:'"+sValue+"'->"+icon.getIconHeight());
|
||||
hshImagenes.put(sValue.toString(),icon);
|
||||
if(icon!=null){
|
||||
nHeight=Math.max(icon.getIconHeight(),nHeight);
|
||||
setPreferredSize(new java.awt.Dimension(Math.max(getWidth(),160),nHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeIcon(String sValue){
|
||||
hshImagenes.remove(sValue);
|
||||
}
|
||||
|
||||
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus)
|
||||
{
|
||||
if(value!=null){
|
||||
setText(value.toString());
|
||||
//setBackground(isSelected ? Color.GREEN : Color.white);
|
||||
//setForeground(isSelected ? Color.white : Color.black);
|
||||
}
|
||||
if(value!=null){
|
||||
//System.out.println("getListCellRendererComponent:'"+value+"'");
|
||||
Icon icon=(Icon)hshImagenes.get(value.toString());
|
||||
if(icon!=null){
|
||||
setIcon(icon);
|
||||
}else{
|
||||
setIcon(null);
|
||||
}
|
||||
}else{
|
||||
setText("");
|
||||
setIcon(null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,491 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
/**
|
||||
* @author jjrider
|
||||
*/
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
|
||||
/**
|
||||
* Custom dialog box to enter dates. The <code>DateChooser</code>
|
||||
* class presents a calendar and allows the user to visually select a
|
||||
* day, month and year so that it is impossible to enter an invalid
|
||||
* date.
|
||||
**/
|
||||
public class DateChooser extends JDialog
|
||||
implements ItemListener, MouseListener, FocusListener, KeyListener, ActionListener
|
||||
{
|
||||
/** Names of the months. */
|
||||
private static final String[] MONTHS =
|
||||
new String[] {
|
||||
"Enero",
|
||||
"Febrero",
|
||||
"Marzo",
|
||||
"Abril",
|
||||
"Mayo",
|
||||
"Junio",
|
||||
"Julio",
|
||||
"Agosto",
|
||||
"Septiembre",
|
||||
"Octubre",
|
||||
"Noviembre",
|
||||
"Diciembre"
|
||||
};
|
||||
|
||||
/** Names of the days of the week. */
|
||||
private static final String[] DAYS =
|
||||
new String[] {
|
||||
"Lun",
|
||||
"Mar",
|
||||
"Mie",
|
||||
"Jue",
|
||||
"Vie",
|
||||
"Sab",
|
||||
"Dom"
|
||||
};
|
||||
|
||||
/** Text color of the days of the weeks, used as column headers in
|
||||
the calendar. */
|
||||
private static final Color WEEK_DAYS_FOREGROUND = Color.black;
|
||||
|
||||
/** Text color of the days' numbers in the calendar. */
|
||||
private static final Color DAYS_FOREGROUND = Color.blue;
|
||||
|
||||
/** Background color of the selected day in the calendar. */
|
||||
private static final Color SELECTED_DAY_FOREGROUND = Color.white;
|
||||
|
||||
/** Text color of the selected day in the calendar. */
|
||||
private static final Color SELECTED_DAY_BACKGROUND = Color.blue;
|
||||
|
||||
/** Empty border, used when the calendar does not have the focus. */
|
||||
private static final Border EMPTY_BORDER = BorderFactory.createEmptyBorder(1,1,1,1);
|
||||
|
||||
/** Border used to highlight the selected day when the calendar
|
||||
has the focus. */
|
||||
private static final Border FOCUSED_BORDER = BorderFactory.createLineBorder(Color.yellow,1);
|
||||
|
||||
/** First year that can be selected. */
|
||||
private static final int FIRST_YEAR = 1900;
|
||||
|
||||
/** Last year that can be selected. */
|
||||
private static final int LAST_YEAR = 2100;
|
||||
|
||||
/** Auxiliary variable to compute dates. */
|
||||
private Calendar calendar;
|
||||
|
||||
/** Calendar, as a matrix of labels. The first row represents the
|
||||
first week of the month, the second row, the second week, and
|
||||
so on. Each column represents a day of the week, the first is
|
||||
Sunday, and the last is Saturday. The label's text is the
|
||||
number of the corresponding day. */
|
||||
private JLabel[][] days;
|
||||
|
||||
/** Day selection control. It is just a panel that can receive the
|
||||
focus. The actual user interaction is driven by the
|
||||
<code>DateChooser</code> class. */
|
||||
private FocusablePanel daysGrid;
|
||||
|
||||
/** Month selection control. */
|
||||
private JComboBox month;
|
||||
|
||||
/** Year selection control. */
|
||||
private JComboBox year;
|
||||
|
||||
/** "Ok" button. */
|
||||
private JButton ok;
|
||||
|
||||
/** "Cancel" button. */
|
||||
private JButton cancel;
|
||||
|
||||
/** Day of the week (0=Sunday) corresponding to the first day of
|
||||
the selected month. Used to calculate the position, in the
|
||||
calendar ({@link #days}), corresponding to a given day. */
|
||||
private int offset;
|
||||
|
||||
/** Last day of the selected month. */
|
||||
private int lastDay;
|
||||
|
||||
/** Selected day. */
|
||||
private JLabel day;
|
||||
|
||||
/** <code>true</code> if the "Ok" button was clicked to close the
|
||||
dialog box, <code>false</code> otherwise. */
|
||||
private boolean okClicked;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Custom panel that can receive the focus. Used to implement the
|
||||
* calendar control.
|
||||
**/
|
||||
private static class FocusablePanel extends JPanel
|
||||
{
|
||||
/**
|
||||
* Constructs a new <code>FocusablePanel</code> with the given
|
||||
* layout manager.
|
||||
*
|
||||
* @param layout layout manager
|
||||
**/
|
||||
public FocusablePanel( LayoutManager layout ) {
|
||||
super( layout );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Always returns <code>true</code>, since
|
||||
* <code>FocusablePanel</code> can receive the focus.
|
||||
*
|
||||
* @return <code>true</code>
|
||||
**/
|
||||
public boolean isFocusTraversable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initializes this <code>DateChooser</code> object. Creates the
|
||||
* controls, registers listeners and initializes the dialog box.
|
||||
**/
|
||||
private void construct()
|
||||
{
|
||||
calendar = Calendar.getInstance();//new Calendar();//GregorianCalendar();
|
||||
|
||||
month = new JComboBox(MONTHS);
|
||||
month.addItemListener( this );
|
||||
|
||||
year = new JComboBox();
|
||||
for ( int i=FIRST_YEAR; i<=LAST_YEAR; i++ )
|
||||
year.addItem( Integer.toString(i) );
|
||||
year.addItemListener( this );
|
||||
|
||||
days = new JLabel[7][7];
|
||||
for ( int i=0; i<7; i++ ) {
|
||||
days[0][i] = new JLabel(DAYS[i],JLabel.RIGHT);
|
||||
days[0][i].setForeground( WEEK_DAYS_FOREGROUND );
|
||||
}
|
||||
for ( int i=1; i<7; i++ )
|
||||
for ( int j=0; j<7; j++ )
|
||||
{
|
||||
days[i][j] = new JLabel(" ",JLabel.RIGHT);
|
||||
days[i][j].setForeground( DAYS_FOREGROUND );
|
||||
days[i][j].setBackground( SELECTED_DAY_BACKGROUND );
|
||||
days[i][j].setBorder( EMPTY_BORDER );
|
||||
days[i][j].addMouseListener( this );
|
||||
}
|
||||
|
||||
ok = new JButton("Aceptar");
|
||||
ok.addActionListener( this );
|
||||
cancel = new JButton("Cancelar");
|
||||
cancel.addActionListener( this );
|
||||
|
||||
JPanel monthYear = new JPanel();
|
||||
monthYear.add( month );
|
||||
monthYear.add( year );
|
||||
|
||||
daysGrid = new FocusablePanel(new GridLayout(7,7,5,0));
|
||||
daysGrid.addFocusListener( this );
|
||||
daysGrid.addKeyListener( this );
|
||||
for ( int i=0; i<7; i++ )
|
||||
for ( int j=0; j<7; j++ )
|
||||
daysGrid.add( days[i][j] );
|
||||
daysGrid.setBackground( Color.white );
|
||||
daysGrid.setBorder( BorderFactory.createLoweredBevelBorder() );
|
||||
JPanel daysPanel = new JPanel();
|
||||
daysPanel.add( daysGrid );
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
buttons.add( ok );
|
||||
buttons.add( cancel );
|
||||
|
||||
Container dialog = getContentPane();
|
||||
dialog.add( "North", monthYear );
|
||||
dialog.add( "Center", daysPanel );
|
||||
dialog.add( "South", buttons );
|
||||
|
||||
pack();
|
||||
setResizable( false );
|
||||
UtilGUI.centerOnWindow(this,getOwner());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the selected day, as an <code>int</code>. Parses the text
|
||||
* of the selected label in the calendar to get the day.
|
||||
*
|
||||
* @return the selected day or -1 if there is no day selected
|
||||
**/
|
||||
private int getSelectedDay()
|
||||
{
|
||||
if ( day == null )
|
||||
return -1 ;
|
||||
try {
|
||||
return Integer.parseInt(day.getText());
|
||||
} catch ( NumberFormatException e ) {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the selected day. The day is specified as the label
|
||||
* control, in the calendar, corresponding to the day to select.
|
||||
*
|
||||
* @param newDay day to select
|
||||
**/
|
||||
private void setSelected( JLabel newDay )
|
||||
{
|
||||
if ( day != null ) {
|
||||
day.setForeground( DAYS_FOREGROUND );
|
||||
day.setOpaque( false );
|
||||
day.setBorder( EMPTY_BORDER );
|
||||
}
|
||||
day = newDay;
|
||||
day.setForeground( SELECTED_DAY_FOREGROUND );
|
||||
day.setOpaque( true );
|
||||
if ( daysGrid.hasFocus() )
|
||||
day.setBorder( FOCUSED_BORDER );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the selected day. The day is specified as the number of
|
||||
* the day, in the month, to selected. The function compute the
|
||||
* corresponding control to select.
|
||||
*
|
||||
* @param newDay day to select
|
||||
**/
|
||||
private void setSelected( int newDay )
|
||||
{
|
||||
setSelected( days[(newDay+offset-1)/7+1][(newDay+offset-1)%7] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates the calendar. This function updates the calendar panel
|
||||
* to reflect the month and year selected. It keeps the same day
|
||||
* of the month that was selected, except if it is beyond the last
|
||||
* day of the month. In this case, the last day of the month is
|
||||
* selected.
|
||||
**/
|
||||
private void update()
|
||||
{
|
||||
int iday = getSelectedDay();
|
||||
for ( int i=0; i<7; i++ ) {
|
||||
days[1][i].setText( " " );
|
||||
days[5][i].setText( " " );
|
||||
days[6][i].setText( " " );
|
||||
}
|
||||
calendar.set( Calendar.DATE, 1 );
|
||||
calendar.set( Calendar.MONTH, month.getSelectedIndex()+Calendar.JANUARY );
|
||||
calendar.set( Calendar.YEAR, year.getSelectedIndex()+FIRST_YEAR );
|
||||
|
||||
offset = calendar.get(Calendar.DAY_OF_WEEK)-Calendar.MONDAY;
|
||||
lastDay = calendar.getActualMaximum(Calendar.DATE);
|
||||
for ( int i=0; i<lastDay; i++ ){
|
||||
try{
|
||||
days[(i+offset)/7+1][(i+offset)%7].setText( String.valueOf(i+1) );
|
||||
}catch(Exception err){
|
||||
}
|
||||
}
|
||||
if ( iday != -1 ) {
|
||||
if ( iday > lastDay )
|
||||
iday = lastDay;
|
||||
setSelected( iday );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called when the "Ok" button is pressed. Just sets a flag and
|
||||
* hides the dialog box.
|
||||
**/
|
||||
public void actionPerformed( ActionEvent e ) {
|
||||
if ( e.getSource() == ok )
|
||||
okClicked = true;
|
||||
hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the calendar gains the focus. Just re-sets the
|
||||
* selected day so that it is redrawn with the border that
|
||||
* indicate focus.
|
||||
**/
|
||||
public void focusGained( FocusEvent e ) {
|
||||
setSelected( day );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the calendar loses the focus. Just re-sets the
|
||||
* selected day so that it is redrawn without the border that
|
||||
* indicate focus.
|
||||
**/
|
||||
public void focusLost( FocusEvent e ) {
|
||||
setSelected( day );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a new month or year is selected. Updates the calendar
|
||||
* to reflect the selection.
|
||||
**/
|
||||
public void itemStateChanged( ItemEvent e ) {
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a key is pressed and the calendar has the
|
||||
* focus. Handles the arrow keys so that the user can select a day
|
||||
* using the keyboard.
|
||||
**/
|
||||
public void keyPressed( KeyEvent e ) {
|
||||
int iday = getSelectedDay();
|
||||
switch ( e.getKeyCode() ) {
|
||||
case KeyEvent.VK_LEFT:
|
||||
if ( iday > 1 )
|
||||
setSelected( iday-1 );
|
||||
break;
|
||||
case KeyEvent.VK_RIGHT:
|
||||
if ( iday < lastDay )
|
||||
setSelected( iday+1 );
|
||||
break;
|
||||
case KeyEvent.VK_UP:
|
||||
if ( iday > 7 )
|
||||
setSelected( iday-7 );
|
||||
break;
|
||||
case KeyEvent.VK_DOWN:
|
||||
if ( iday <= lastDay-7 )
|
||||
setSelected( iday+7 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked on a day in the
|
||||
* calendar. Selects the clicked day.
|
||||
**/
|
||||
public void mouseClicked( MouseEvent e ) {
|
||||
JLabel day = (JLabel)e.getSource();
|
||||
if ( !day.getText().equals(" ") )
|
||||
setSelected( day );
|
||||
daysGrid.requestFocus();
|
||||
}
|
||||
|
||||
public void keyReleased( KeyEvent e ) {}
|
||||
public void keyTyped( KeyEvent e ) {}
|
||||
public void mouseEntered( MouseEvent e ) {}
|
||||
public void mouseExited( MouseEvent e) {}
|
||||
public void mousePressed( MouseEvent e ) {}
|
||||
public void mouseReleased( MouseEvent e) {}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>DateChooser</code> with the given title.
|
||||
*
|
||||
* @param owner owner dialog
|
||||
*
|
||||
* @param title dialog title
|
||||
**/
|
||||
public DateChooser( Dialog owner, String title )
|
||||
{
|
||||
super( owner, title, true );
|
||||
construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>DateChooser</code>.
|
||||
*
|
||||
* @param owner owner dialog
|
||||
**/
|
||||
public DateChooser( Dialog owner )
|
||||
{
|
||||
super( owner, true );
|
||||
construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>DateChooser</code> with the given title.
|
||||
*
|
||||
* @param owner owner frame
|
||||
*
|
||||
* @param title dialog title
|
||||
**/
|
||||
public DateChooser( Frame owner, String title )
|
||||
{
|
||||
super( owner, title, true );
|
||||
construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>DateChooser</code>.
|
||||
*
|
||||
* @param owner owner frame
|
||||
**/
|
||||
public DateChooser( Frame owner )
|
||||
{
|
||||
super( owner, true );
|
||||
construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Selects a date. Displays the dialog box, with a given date as
|
||||
* the selected date, and allows the user select a new date.
|
||||
*
|
||||
* @param date initial date
|
||||
*
|
||||
* @return the new date selected or <code>null</code> if the user
|
||||
* press "Cancel" or closes the dialog box
|
||||
**/
|
||||
public Date select( Date date )
|
||||
{
|
||||
calendar.setTime( date );
|
||||
int _day = calendar.get(Calendar.DATE);
|
||||
int _month = calendar.get(Calendar.MONTH);
|
||||
int _year = calendar.get(Calendar.YEAR);
|
||||
|
||||
year.setSelectedIndex( _year-FIRST_YEAR );
|
||||
month.setSelectedIndex( _month-Calendar.JANUARY );
|
||||
setSelected( _day );
|
||||
okClicked = false;
|
||||
show();
|
||||
if ( !okClicked )
|
||||
return null;
|
||||
calendar.set( Calendar.DATE, getSelectedDay() );
|
||||
calendar.set( Calendar.MONTH, month.getSelectedIndex()+Calendar.JANUARY );
|
||||
calendar.set( Calendar.YEAR, year.getSelectedIndex()+FIRST_YEAR );
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Selects new date. Just calls {@link #select(Date)} with the
|
||||
* system date as the parameter.
|
||||
*
|
||||
* @return the same as the function {@link #select(Date)}
|
||||
**/
|
||||
public Date select()
|
||||
{
|
||||
return select(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
* 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.*;
|
||||
/**
|
||||
* This type was created in VisualAge.
|
||||
*/
|
||||
public class Detalles extends javax.swing.JInternalFrame implements 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");
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
||||
public Detalles(String strTitle, String error, String mensaje) {
|
||||
super("Error");
|
||||
this.mensaje = mensaje;
|
||||
this.error = error;
|
||||
initialize();
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
*/
|
||||
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
*/
|
||||
public Detalles(String title, boolean resizable) {
|
||||
super(title, resizable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
*/
|
||||
public Detalles(String title, boolean resizable, boolean closable) {
|
||||
super(title, resizable, closable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
* @param maximizable boolean
|
||||
*/
|
||||
public Detalles(String title, boolean resizable, boolean closable, boolean maximizable) {
|
||||
super(title, resizable, closable, maximizable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
* @param maximizable boolean
|
||||
* @param iconifiable boolean
|
||||
*/
|
||||
public Detalles(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) {
|
||||
super(title, resizable, closable, maximizable, iconifiable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Comment
|
||||
*/
|
||||
public void aceptar_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
|
||||
try
|
||||
{
|
||||
this.setClosed(true);
|
||||
}
|
||||
catch (java.beans.PropertyVetoException w)
|
||||
{
|
||||
//System.out.println("hola");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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 == 110)
|
||||
{
|
||||
ivjDescripcion.setText("\u00AB Descripción");
|
||||
this.setSize(this.getSize().width,193);
|
||||
edit.append(mensaje, new Color(0xFF0000));
|
||||
}
|
||||
else
|
||||
{
|
||||
ivjDescripcion.setText("Descripción \u00BB");
|
||||
this.setSize(this.getSize().width,110);
|
||||
edit.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Return the Aceptar property value.
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
||||
private 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. */
|
||||
private 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
|
||||
}
|
||||
/**
|
||||
* main entrypoint - starts the part when it is run as an application
|
||||
* @param args java.lang.String[]
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
/*
|
||||
* 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[]
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
/**
|
||||
* This type was created in VisualAge.
|
||||
*/
|
||||
public class DetallesFrame extends javax.swing.JFrame implements 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");
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
||||
public DetallesFrame(String strTitle, String error, String mensaje) {
|
||||
super("Error");
|
||||
this.mensaje = mensaje;
|
||||
this.error = error;
|
||||
initialize();
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
*/
|
||||
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
*/
|
||||
public DetallesFrame(String title, boolean resizable) {
|
||||
super(title);
|
||||
setResizable(resizable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
*/
|
||||
public DetallesFrame(String title, boolean resizable, boolean closable) {
|
||||
super(title);
|
||||
setResizable(resizable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
* @param maximizable boolean
|
||||
*/
|
||||
public DetallesFrame(String title, boolean resizable, boolean closable, boolean maximizable) {
|
||||
super(title);
|
||||
setResizable(resizable);
|
||||
}
|
||||
/**
|
||||
* Detalles constructor comment.
|
||||
* @param title java.lang.String
|
||||
* @param resizable boolean
|
||||
* @param closable boolean
|
||||
* @param maximizable boolean
|
||||
* @param iconifiable boolean
|
||||
*/
|
||||
public DetallesFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) {
|
||||
super(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 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 == 110)
|
||||
{
|
||||
ivjDescripcion.setText("\u00AB Descripción");
|
||||
this.setSize(this.getSize().width,193);
|
||||
edit.append(mensaje, new Color(0xFF0000));
|
||||
}
|
||||
else
|
||||
{
|
||||
ivjDescripcion.setText("Descripción \u00BB");
|
||||
this.setSize(this.getSize().width,110);
|
||||
edit.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Return the Aceptar property value.
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
/* WARNING: THIS METHOD WILL BE REGENERATED. */
|
||||
private 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
|
||||
}
|
||||
/**
|
||||
* main entrypoint - starts the part when it is run as an application
|
||||
* @param args java.lang.String[]
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import javax.swing.text.*;
|
||||
|
||||
public class Editor extends JScrollPane
|
||||
{
|
||||
EditorTexto edit = new EditorTexto();;
|
||||
public Editor()
|
||||
{
|
||||
super();
|
||||
setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
getViewport().add(edit);
|
||||
}
|
||||
public void remove()
|
||||
{
|
||||
edit.remove();
|
||||
}
|
||||
|
||||
public void append(String cadena, Color color)
|
||||
{
|
||||
edit.append(cadena+"\r",color);
|
||||
}
|
||||
public class EditorTexto extends JTextPane
|
||||
{
|
||||
Style Linea,Titulo; // Estilos
|
||||
Style s;
|
||||
StyleContext sc; // Contenedor de estilos
|
||||
DefaultStyledDocument doc; // Plantilla de Documento
|
||||
Color color= new Color(0) ; // color texto chat
|
||||
|
||||
public void remove()
|
||||
{
|
||||
try
|
||||
{
|
||||
doc.remove(0,doc.getLength());
|
||||
}
|
||||
catch(BadLocationException x)
|
||||
{
|
||||
//System.out.println("no sé");
|
||||
}
|
||||
}
|
||||
public EditorTexto()
|
||||
{
|
||||
super();
|
||||
sc = new StyleContext();
|
||||
doc= new DefaultStyledDocument(sc);
|
||||
Editable(false);
|
||||
DeficionEstilos();
|
||||
setDocument(doc);
|
||||
}
|
||||
public void Editable(boolean flag) // Estado de Edicion del NewChat
|
||||
{
|
||||
if(!flag)
|
||||
{
|
||||
setEditable(false);
|
||||
setCaretColor(Color.white);
|
||||
setSelectionColor(Color.BLUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEditable(true);
|
||||
}
|
||||
}
|
||||
public void append(String cadena, Color color)
|
||||
{
|
||||
|
||||
Style tmp;
|
||||
|
||||
tmp = sc.getStyle("tmp"+ color /*Integer.toString(color)*/);
|
||||
|
||||
if(tmp == null) // el estilo no existe lo añadimos
|
||||
{
|
||||
tmp = sc.getStyle("Linea");
|
||||
sc.addStyle("tmp"+color,tmp);
|
||||
StyleConstants.setForeground(tmp, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
StyleConstants.setForeground(tmp, color);
|
||||
}
|
||||
try
|
||||
{
|
||||
doc.insertString(doc.getLength(), cadena,tmp);
|
||||
}
|
||||
catch (BadLocationException e)
|
||||
{
|
||||
System.err.println("Internal error: " + e);
|
||||
}
|
||||
}
|
||||
public void append(String cadena, String Estilo)
|
||||
{
|
||||
try
|
||||
{
|
||||
doc.insertString(doc.getLength(), cadena,null);
|
||||
doc.setLogicalStyle(doc.getLength()-1, sc.getStyle(Estilo));
|
||||
}
|
||||
catch (BadLocationException e)
|
||||
{
|
||||
System.err.println("Internal error: " + e);
|
||||
}
|
||||
|
||||
}
|
||||
public void DeficionEstilos()
|
||||
{
|
||||
|
||||
// Estilo de Linea
|
||||
Linea = sc.getStyle(StyleContext.DEFAULT_STYLE);
|
||||
Linea = sc.addStyle("Linea", Linea);
|
||||
StyleConstants.setFontFamily(Linea, "Helvetica");
|
||||
StyleConstants.setBold(Linea, true);
|
||||
StyleConstants.setAlignment(Linea, StyleConstants.ALIGN_LEFT);
|
||||
StyleConstants.setSpaceAbove(Linea, 10);
|
||||
StyleConstants.setSpaceBelow(Linea, 10);
|
||||
StyleConstants.setFontSize(Linea, 12);
|
||||
StyleConstants.setForeground(Linea, new Color(255,255,255));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
public interface IconizableObject {
|
||||
|
||||
public javax.swing.Icon getIcon();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
import javax.swing.*;
|
||||
|
||||
public class ImageComboBox extends JComboBox{
|
||||
private ComboCellRenderer renderer=new ComboCellRenderer();
|
||||
private String sIconPath="";
|
||||
|
||||
//private int nHeight=40;
|
||||
|
||||
public ImageComboBox(){
|
||||
super();
|
||||
setRenderer(renderer);
|
||||
/*setFont(new java.awt.Font("Tahoma",java.awt.Font.BOLD,14));
|
||||
setPreferredSize(new java.awt.Dimension(120,nHeight));
|
||||
setMinimumSize(new java.awt.Dimension(120,35));
|
||||
*/
|
||||
}
|
||||
|
||||
public void setIconPath(String s){
|
||||
sIconPath=s;
|
||||
}
|
||||
|
||||
public void addItem(Object anObject){
|
||||
super.addItem(anObject);
|
||||
Icon icon=null;
|
||||
if(anObject instanceof IconizableObject){
|
||||
icon=((IconizableObject)anObject).getIcon();
|
||||
//nHeight=Math.max(icon.getIconHeight(),nHeight);
|
||||
//setPreferredSize(new java.awt.Dimension(Math.max(getWidth(),120),nHeight));
|
||||
validate();
|
||||
}
|
||||
renderer.addIcon(anObject,icon);
|
||||
}
|
||||
|
||||
|
||||
public void removeItemAt(int nIndex){
|
||||
Object obj=this.getItemAt(nIndex);
|
||||
renderer.removeIcon(obj.toString());
|
||||
if(nIndex>0)
|
||||
renderer.remove(nIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
public class ProgressDialog extends JFrame {
|
||||
|
||||
JProgressBar progressBar=null;
|
||||
JLabel jlabel=null;
|
||||
|
||||
public ProgressDialog(String strTitle){
|
||||
super(strTitle);
|
||||
setSize(400,70);
|
||||
addComponents(strTitle);
|
||||
setVisible(true);
|
||||
show();
|
||||
UtilGUI.centerOnScreen(this);
|
||||
|
||||
}
|
||||
|
||||
private void addComponents(String strTitle){
|
||||
getContentPane().setLayout(new java.awt.BorderLayout());
|
||||
jlabel=new JLabel(strTitle);
|
||||
getContentPane().add(jlabel,java.awt.BorderLayout.SOUTH);
|
||||
progressBar=new JProgressBar(0, 100);
|
||||
progressBar.setPreferredSize(new Dimension(400,60));
|
||||
progressBar.setValue(0);
|
||||
progressBar.setStringPainted(true);
|
||||
getContentPane().add(progressBar,java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void setProgressState(int intValue){
|
||||
String str=null;
|
||||
setProgressState(intValue,str);
|
||||
}
|
||||
|
||||
public void setProgressState(int intValue,String strTexto){
|
||||
setVisible(true);
|
||||
progressBar.setValue(intValue);
|
||||
if(strTexto!=null){
|
||||
jlabel.setText(strTexto);
|
||||
}
|
||||
validate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author jjrider
|
||||
*
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class UtilGUI {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
public static void centerOnWindow(Window dialog, Window frame){
|
||||
if(dialog==null)
|
||||
return;
|
||||
if(frame==null)
|
||||
return;
|
||||
Dimension dimDialog=dialog.getSize();
|
||||
Dimension dimFrame=frame.getSize();
|
||||
/*int intFrameX=frame.getX();
|
||||
int intFrameY=frame.getY();*/
|
||||
int distanceWidth=dimFrame.width-dimDialog.width;
|
||||
distanceWidth=distanceWidth/2;
|
||||
int distanceHeight=dimFrame.height-dimDialog.height;
|
||||
distanceHeight=distanceHeight/2;
|
||||
dialog.setBounds(frame.getX()+distanceWidth,frame.getY()+distanceHeight,dimDialog.width,dimDialog.height);
|
||||
}
|
||||
|
||||
public static void centerOnScreen(Window dialog){
|
||||
if(dialog==null)
|
||||
return;
|
||||
Dimension dimFrame=java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
Dimension dimDialog=dialog.getSize();
|
||||
int distanceWidth=dimFrame.width-dimDialog.width;
|
||||
distanceWidth=distanceWidth/2;
|
||||
int distanceHeight=dimFrame.height-dimDialog.height;
|
||||
distanceHeight=distanceHeight/2;
|
||||
dialog.setBounds(distanceWidth,distanceHeight,dimDialog.width,dimDialog.height);
|
||||
}
|
||||
|
||||
public static Icon getIconForType(int iconType) {
|
||||
try{
|
||||
switch (iconType) {
|
||||
case JOptionPane.ERROR_MESSAGE:
|
||||
return UIManager.getIcon("OptionPane.errorIcon");
|
||||
case JOptionPane.INFORMATION_MESSAGE:
|
||||
return UIManager.getIcon("OptionPane.informationIcon");
|
||||
case JOptionPane.WARNING_MESSAGE:
|
||||
return UIManager.getIcon("OptionPane.warningIcon");
|
||||
case JOptionPane.QUESTION_MESSAGE:
|
||||
return UIManager.getIcon("OptionPane.questionIcon");
|
||||
}
|
||||
}catch(Exception err){}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getInputValue(Component parentComponent,Object message){
|
||||
return JOptionPane.showInputDialog(parentComponent,message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
/**
|
||||
* @author jjrider
|
||||
*/
|
||||
public class VentanaProgreso extends JDialog {
|
||||
|
||||
JProgressBar progressBar=null;
|
||||
JLabel jlabel=null;
|
||||
|
||||
public VentanaProgreso(JFrame objFrame,String strTitle){
|
||||
super(objFrame,strTitle, false);
|
||||
setSize(400,70);
|
||||
addComponents(strTitle);
|
||||
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private void addComponents(String strTitle){
|
||||
getContentPane().setLayout(new java.awt.BorderLayout());
|
||||
jlabel=new JLabel(strTitle);
|
||||
getContentPane().add(jlabel,java.awt.BorderLayout.SOUTH);
|
||||
progressBar=new JProgressBar(0, 100);
|
||||
progressBar.setPreferredSize(new Dimension(400,60));
|
||||
//progressBar.setBackground(new java.awt.Color(0,0,0));
|
||||
progressBar.setValue(0);
|
||||
progressBar.setStringPainted(true);
|
||||
getContentPane().add(progressBar,java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void setProgressState(int intValue){
|
||||
String str=null;
|
||||
setProgressState(intValue,str);
|
||||
}
|
||||
|
||||
public void setProgressState(int intValue,String strTexto){
|
||||
progressBar.setValue(intValue);
|
||||
if(strTexto!=null){
|
||||
jlabel.setText(strTexto);
|
||||
}
|
||||
validate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
protected void finalize() throws Throwable{
|
||||
try {
|
||||
hide();
|
||||
}catch(Throwable th){}
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.tarisan.chipcard.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
/**
|
||||
* @author jjrider
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class hiloDialogo extends Thread {//implements Runnable{
|
||||
int intDialogType=0;
|
||||
String strMessage="";
|
||||
String strTitle="";
|
||||
private JFrame jframe=null;
|
||||
String options[]={"Si","No"};
|
||||
java.awt.event.ActionListener actionListener=null;
|
||||
|
||||
public hiloDialogo(JFrame f,String t,String m, int d){
|
||||
this(f, t, m, d,null);
|
||||
}
|
||||
public hiloDialogo(JFrame f,String t,String m, int d,java.awt.event.ActionListener a){
|
||||
super();
|
||||
jframe=f;
|
||||
intDialogType=d;
|
||||
strMessage=m;
|
||||
strTitle=t;
|
||||
actionListener=a;
|
||||
start();
|
||||
}
|
||||
|
||||
public void run(){
|
||||
//jframe.setVisible(true);
|
||||
if(jframe!=null)
|
||||
jframe.setFocusable(true);
|
||||
if(actionListener==null)
|
||||
JOptionPane.showMessageDialog(jframe,strMessage,strTitle,intDialogType);
|
||||
else
|
||||
confirmDialog();
|
||||
}
|
||||
|
||||
public void confirmDialog(){
|
||||
int intRetorno=JOptionPane.showOptionDialog(null, strMessage, strTitle, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null,options, options[1]);
|
||||
if(actionListener!=null){
|
||||
actionListener.actionPerformed(new java.awt.event.ActionEvent(this,intRetorno,null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user