/* * MainWindow.java * * Created on 8. Juli 2008, 17:02 */ package wsclient; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JDialog; import javax.swing.JOptionPane; /** * * @author Jan */ public class MainWindow extends javax.swing.JFrame { /** Creates new form MainWindow */ public MainWindow() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jSpinnerKundeId = new javax.swing.JSpinner(); jSpinnerArtikelId = new javax.swing.JSpinner(); jSpinnerArtikelAnzahl = new javax.swing.JSpinner(); jButtonBestellungAbschicken = new javax.swing.JButton(); jLabelOutput = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Kunden-Id"); jLabel2.setText("Artikel-Id"); jLabel3.setText("Anzahl"); jSpinnerKundeId.setModel(new javax.swing.SpinnerNumberModel(Long.valueOf(0L), null, null, Long.valueOf(1L))); jSpinnerArtikelId.setModel(new javax.swing.SpinnerNumberModel(Long.valueOf(0L), null, null, Long.valueOf(1L))); jSpinnerArtikelAnzahl.setModel(new javax.swing.SpinnerNumberModel(Long.valueOf(0L), null, null, Long.valueOf(1L))); jButtonBestellungAbschicken.setText("Bestellung abschicken"); jButtonBestellungAbschicken.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonBestellungAbschickenActionPerformed(evt); } }); jLabelOutput.setText("..."); jLabelOutput.setVerticalAlignment(javax.swing.SwingConstants.TOP); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jLabel2) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jSpinnerKundeId) .addComponent(jSpinnerArtikelId) .addComponent(jSpinnerArtikelAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jButtonBestellungAbschicken, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGap(158, 158, 158) .addComponent(jLabelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(24, 24, 24) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jSpinnerKundeId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jSpinnerArtikelId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jSpinnerArtikelAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButtonBestellungAbschicken)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(102, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents private void jButtonBestellungAbschickenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBestellungAbschickenActionPerformed Bestellung b = new Bestellung(); try { String output = b.fuehreBestellungDurch((Long) jSpinnerKundeId.getValue(), (Long) jSpinnerArtikelId.getValue(), (Long) jSpinnerArtikelAnzahl.getValue()); jLabelOutput.setText(output); } catch (Exception ex) { JOptionPane.showMessageDialog(rootPane, ex.getMessage(), "Fehler beim Bestellvorgang", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_jButtonBestellungAbschickenActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainWindow().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonBestellungAbschicken; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabelOutput; private javax.swing.JSpinner jSpinnerArtikelAnzahl; private javax.swing.JSpinner jSpinnerArtikelId; private javax.swing.JSpinner jSpinnerKundeId; // End of variables declaration//GEN-END:variables }