/* * FaxPrinter.java * * Created on March 1, 2007, 3:26 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package siprp.medicina.locais_realizacao; import com.evolute.utils.ui.CustomJDialog; import info.clearthought.layout.TableLayout; import info.clearthought.layout.TableLayoutConstraints; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; /** * * @author fpalma */ public class FaxPrinter extends CustomJDialog implements ActionListener { private JTextField deText; private JTextField deEmailText; private JTextField deFaxText; private JTextField deTelefoneText; private JTextField assuntoText; private JButton imprimirButton; private JButton cancelarButton; /** Creates a new instance of FaxPrinter */ public FaxPrinter() { setupComponents(); } private void setupComponents() { JLabel deLabel = new JLabel( "De" ); deText = new JTextField(); JLabel deEmailLabel = new JLabel( "E-mail" ); deEmailText = new JTextField(); JLabel deFaxLabel = new JLabel( "Fax" ); deFaxText = new JTextField(); JLabel deTelefoneLabel = new JLabel( "N\u00famero de telefone" ); deTelefoneText = new JTextField(); JLabel assuntoLabel = new JLabel( "Assunto" ); assuntoText = new JTextField(); imprimirButton = new JButton( "Imprimir" ); imprimirButton.addActionListener( this ); cancelarButton = new JButton( "Cancelar" ); cancelarButton.addActionListener( this ); JPanel buttonPanel = new JPanel(); double cols[] = new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.PREFERRED, }; double rows[] = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, }; TableLayout tableLayout = new TableLayout( cols,rows ); setLayout( tableLayout ); add( deLabel, new TableLayoutConstraints( 0, 0 ) ); add( deText, new TableLayoutConstraints( 1, 0 ) ); add( deEmailLabel, new TableLayoutConstraints( 2, 0 ) ); add( deEmailText, new TableLayoutConstraints( 3, 0 ) ); add( deFaxLabel, new TableLayoutConstraints( 0, 1 ) ); add( deFaxText, new TableLayoutConstraints( 1, 1 ) ); add( deTelefoneLabel, new TableLayoutConstraints( 2, 1 ) ); add( deTelefoneText, new TableLayoutConstraints( 3, 1 ) ); add( assuntoLabel, new TableLayoutConstraints( 0, 2 ) ); add( assuntoText, new TableLayoutConstraints( 1, 2, 3, 2 ) ); add( buttonPanel, new TableLayoutConstraints( 0, 3, 3, 3 ) ); buttonPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); buttonPanel.add( imprimirButton ); buttonPanel.add( cancelarButton ); } public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if( source.equals( imprimirButton ) ) { print(); } else if( source.equals( cancelarButton ) ) { close(); } } public void close() { SwingUtilities.invokeLater( new Runnable(){ public void run() { setVisible( false ); dispose(); } } ); } public void print() { } }