java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.java
author František Kučera <franta-hg@frantovo.cz>
Thu, 31 Dec 2009 18:12:03 +0100
changeset 2 2f02db6cd698
parent 0 f1a6902957b8
child 3 d40099dbbdd1
permissions -rw-r--r--
Hlavní třída pro migraci, napojení na GUI.
     1 /*
     2  * HlavniOkno.java
     3  *
     4  * Created on 30.12.2009, 2:22:41
     5  */
     6 package cz.frantovo.abcDrupal.gui;
     7 
     8 import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
     9 import cz.frantovo.abcDrupal.Konvertor;
    10 import cz.frantovo.abcDrupal.PosluchacLogu;
    11 import java.util.logging.Level;
    12 import java.util.logging.Logger;
    13 import javax.swing.UIManager;
    14 import javax.swing.UnsupportedLookAndFeelException;
    15 
    16 /**
    17  *
    18  * @author fiki
    19  */
    20 public class HlavniOkno extends javax.swing.JFrame implements PosluchacLogu {
    21 
    22     private static final Logger log = Logger.getLogger(HlavniOkno.class.getName());
    23 
    24     /** Creates new form HlavniOkno */
    25     public HlavniOkno() {
    26 	initComponents();
    27     }
    28 
    29     /** This method is called from within the constructor to
    30      * initialize the form.
    31      * WARNING: Do NOT modify this code. The content of this method is
    32      * always regenerated by the Form Editor.
    33      */
    34     @SuppressWarnings("unchecked")
    35     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    36     private void initComponents() {
    37 
    38         jLabel1 = new javax.swing.JLabel();
    39         jLabel2 = new javax.swing.JLabel();
    40         jdbcZdroj = new javax.swing.JTextField();
    41         jdbcCil = new javax.swing.JTextField();
    42         jScrollPane1 = new javax.swing.JScrollPane();
    43         vystup = new javax.swing.JTextArea();
    44         jButton1 = new javax.swing.JButton();
    45 
    46         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    47         setTitle("ABC-Drupal");
    48 
    49         jLabel1.setText("Zdroj");
    50 
    51         jLabel2.setText("Cíl");
    52 
    53         jdbcZdroj.setText("jdbcZdroj");
    54 
    55         jdbcCil.setText("jdbcCil");
    56 
    57         vystup.setColumns(20);
    58         vystup.setEditable(false);
    59         vystup.setRows(5);
    60         vystup.setEnabled(false);
    61         jScrollPane1.setViewportView(vystup);
    62 
    63         jButton1.setText("Nahrát data");
    64         jButton1.addActionListener(new java.awt.event.ActionListener() {
    65             public void actionPerformed(java.awt.event.ActionEvent evt) {
    66                 jButton1ActionPerformed(evt);
    67             }
    68         });
    69 
    70         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    71         getContentPane().setLayout(layout);
    72         layout.setHorizontalGroup(
    73             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    74             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    75                 .addContainerGap()
    76                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    77                     .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
    78                     .addGroup(layout.createSequentialGroup()
    79                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    80                             .addComponent(jLabel1)
    81                             .addComponent(jLabel2))
    82                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    83                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    84                             .addComponent(jdbcCil, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
    85                             .addComponent(jdbcZdroj, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)))
    86                     .addComponent(jButton1))
    87                 .addContainerGap())
    88         );
    89         layout.setVerticalGroup(
    90             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    91             .addGroup(layout.createSequentialGroup()
    92                 .addContainerGap()
    93                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    94                     .addComponent(jLabel1)
    95                     .addComponent(jdbcZdroj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    96                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    97                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    98                     .addComponent(jdbcCil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    99                     .addComponent(jLabel2))
   100                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
   101                 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
   102                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
   103                 .addComponent(jButton1)
   104                 .addContainerGap())
   105         );
   106 
   107         pack();
   108     }// </editor-fold>//GEN-END:initComponents
   109 
   110     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
   111 	Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
   112 	k.konvertuj();
   113     }//GEN-LAST:event_jButton1ActionPerformed
   114 
   115     /**
   116      * @param args the command line arguments
   117      */
   118     public static void main(String args[]) {
   119 	nastavLaF();
   120 
   121 	java.awt.EventQueue.invokeLater(new Runnable() {
   122 
   123 	    public void run() {
   124 		new HlavniOkno().setVisible(true);
   125 	    }
   126 	});
   127     }
   128 
   129     private static void nastavLaF() {
   130 	try {
   131 	    UIManager.setLookAndFeel(new NimbusLookAndFeel());
   132 	} catch (UnsupportedLookAndFeelException e) {
   133 	    log.log(Level.FINE, "Nepodařilo se načíst LaF. Nevadí.");
   134 	}
   135     }
   136     // Variables declaration - do not modify//GEN-BEGIN:variables
   137     private javax.swing.JButton jButton1;
   138     private javax.swing.JLabel jLabel1;
   139     private javax.swing.JLabel jLabel2;
   140     private javax.swing.JScrollPane jScrollPane1;
   141     private javax.swing.JTextField jdbcCil;
   142     private javax.swing.JTextField jdbcZdroj;
   143     private javax.swing.JTextArea vystup;
   144     // End of variables declaration//GEN-END:variables
   145 
   146     public void vypis(String zprava) {
   147 	vystup.append(zprava + "\n");
   148     }
   149 }