Hlavní třída pro migraci, napojení na GUI.
4 * Created on 30.12.2009, 2:22:41
6 package cz.frantovo.abcDrupal.gui;
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;
20 public class HlavniOkno extends javax.swing.JFrame implements PosluchacLogu {
22 private static final Logger log = Logger.getLogger(HlavniOkno.class.getName());
24 /** Creates new form HlavniOkno */
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.
34 @SuppressWarnings("unchecked")
35 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
36 private void initComponents() {
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();
46 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
47 setTitle("ABC-Drupal");
49 jLabel1.setText("Zdroj");
51 jLabel2.setText("Cíl");
53 jdbcZdroj.setText("jdbcZdroj");
55 jdbcCil.setText("jdbcCil");
57 vystup.setColumns(20);
58 vystup.setEditable(false);
60 vystup.setEnabled(false);
61 jScrollPane1.setViewportView(vystup);
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);
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()
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))
89 layout.setVerticalGroup(
90 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91 .addGroup(layout.createSequentialGroup()
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)
108 }// </editor-fold>//GEN-END:initComponents
110 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
111 Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
113 }//GEN-LAST:event_jButton1ActionPerformed
116 * @param args the command line arguments
118 public static void main(String args[]) {
121 java.awt.EventQueue.invokeLater(new Runnable() {
124 new HlavniOkno().setVisible(true);
129 private static void nastavLaF() {
131 UIManager.setLookAndFeel(new NimbusLookAndFeel());
132 } catch (UnsupportedLookAndFeelException e) {
133 log.log(Level.FINE, "Nepodařilo se načíst LaF. Nevadí.");
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
146 public void vypis(String zprava) {
147 vystup.append(zprava + "\n");