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