Skript pro spouštění a hesla k DB.
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 cz.frantovo.abcDrupal.PromenneProstredi;
12 import java.util.logging.Level;
13 import java.util.logging.Logger;
14 import javax.swing.UIManager;
15 import javax.swing.UnsupportedLookAndFeelException;
21 public class HlavniOkno extends javax.swing.JFrame implements PosluchacLogu {
23 private static final Logger log = Logger.getLogger(HlavniOkno.class.getName());
25 /** Creates new form HlavniOkno */
28 setLocationRelativeTo(null);
29 nactiPromenneProstredi();
32 private void nactiPromenneProstredi() {
33 String zdroj = System.getenv(PromenneProstredi.MIGRACE_ZDROJ.toString());
35 jdbcZdroj.setText(zdroj);
37 String cil = System.getenv(PromenneProstredi.MIGRACE_CIL.toString());
43 /** This method is called from within the constructor to
44 * initialize the form.
45 * WARNING: Do NOT modify this code. The content of this method is
46 * always regenerated by the Form Editor.
48 @SuppressWarnings("unchecked")
49 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
50 private void initComponents() {
52 jLabel1 = new javax.swing.JLabel();
53 jLabel2 = new javax.swing.JLabel();
54 jdbcZdroj = new javax.swing.JTextField();
55 jdbcCil = new javax.swing.JTextField();
56 jScrollPane1 = new javax.swing.JScrollPane();
57 vystup = new javax.swing.JTextArea();
58 nahratData = new javax.swing.JButton();
60 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
61 setTitle("ABC-Drupal");
63 jLabel1.setText("Zdroj");
65 jLabel2.setText("Cíl");
67 jdbcZdroj.setText("jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&password=nbusr123");
69 jdbcCil.setText("jdbc:mysql://127.0.0.1:3306/abclinuxu?user=abclinuxu&password=nbusr123");
71 vystup.setColumns(20);
72 vystup.setEditable(false);
74 vystup.setEnabled(false);
75 jScrollPane1.setViewportView(vystup);
77 nahratData.setText("Nahrát data");
78 nahratData.addActionListener(new java.awt.event.ActionListener() {
79 public void actionPerformed(java.awt.event.ActionEvent evt) {
80 nahratDataActionPerformed(evt);
84 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
85 getContentPane().setLayout(layout);
86 layout.setHorizontalGroup(
87 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
88 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
90 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
91 .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
92 .addGroup(layout.createSequentialGroup()
93 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
94 .addComponent(jLabel1)
95 .addComponent(jLabel2))
96 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
97 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
98 .addComponent(jdbcCil, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
99 .addComponent(jdbcZdroj, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)))
100 .addComponent(nahratData))
103 layout.setVerticalGroup(
104 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
105 .addGroup(layout.createSequentialGroup()
107 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
108 .addComponent(jLabel1)
109 .addComponent(jdbcZdroj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
110 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
111 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
112 .addComponent(jdbcCil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
113 .addComponent(jLabel2))
114 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
115 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
116 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
117 .addComponent(nahratData)
122 }// </editor-fold>//GEN-END:initComponents
124 private void nahratDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nahratDataActionPerformed
125 Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
127 }//GEN-LAST:event_nahratDataActionPerformed
130 * @param args the command line arguments
132 public static void main(String args[]) {
135 java.awt.EventQueue.invokeLater(new Runnable() {
138 new HlavniOkno().setVisible(true);
143 private static void nastavLaF() {
145 UIManager.setLookAndFeel(new NimbusLookAndFeel());
146 } catch (UnsupportedLookAndFeelException e) {
147 log.log(Level.FINE, "Nepodařilo se načíst LaF. Nevadí.");
150 // Variables declaration - do not modify//GEN-BEGIN:variables
151 private javax.swing.JLabel jLabel1;
152 private javax.swing.JLabel jLabel2;
153 private javax.swing.JScrollPane jScrollPane1;
154 private javax.swing.JTextField jdbcCil;
155 private javax.swing.JTextField jdbcZdroj;
156 private javax.swing.JButton nahratData;
157 private javax.swing.JTextArea vystup;
158 // End of variables declaration//GEN-END:variables
160 public void vypis(String zprava) {
161 vystup.append(zprava + "\n");