/* * Created on Dec 6, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class DataInputGui implements ActionListener { String returnMsg; JTextField textField_Name = new JTextField(20); JTextField textField_Geschlecht = new JTextField(20); JTextField textField_Alter = new JTextField(20); JTextField textField_Beruf = new JTextField(20); JTextField textField_e_mail = new JTextField(20); JTextField textField_TypGruppe = new JTextField(20); JTextField textField_HausTyp = new JTextField(20); JTextField textField_Size = new JTextField(20); JTextField textField_Accessoires = new JTextField(20); JTextField textField_PosVH = new JTextField(20); JTextField textField_PosLR = new JTextField(20); JTextField textField_GartenTyp = new JTextField(20); JTextField textField_NStrasse = new JTextField(20); JTextField textField_NBus = new JTextField(20); JTextField textField_NWasser = new JTextField(20); JTextField textField_NWald = new JTextField(20); JTextField textField_NMarkt = new JTextField(20); JTextField textField_NNachbar = new JTextField(20); JTextField textField_NachbarName = new JTextField(20); JTextField returnField = new JTextField(40); public DataInputGui() { JLabel label_name = new JLabel("Name"); JLabel label_Geschlecht = new JLabel("Geschlecht"); JLabel label_Alter = new JLabel("Alter"); JLabel label_Beruf = new JLabel("Beruf"); JLabel label_e_mail = new JLabel("e-mail"); JLabel label_TypGruppe = new JLabel("TypGruppe"); JLabel label_HausTyp = new JLabel("HausTyp"); JLabel label_Size = new JLabel("Size"); JLabel label_Accessoires = new JLabel("Accessoires"); JLabel label_PosVH = new JLabel("PosVH"); JLabel label_PosLR = new JLabel("PosLR"); JLabel label_GartenTyp = new JLabel("GartenTyp"); JLabel label_NStrasse = new JLabel("NStrasse"); JLabel label_NBus = new JLabel("NBus"); JLabel label_NWasser = new JLabel("NWasser"); JLabel label_NWald = new JLabel("NWald"); JLabel label_NMarkt = new JLabel("NMarkt"); JLabel label_NNachbar = new JLabel("NNachbar"); JLabel label_NachbarName = new JLabel("NachbarName"); //Create and set up the window. JFrame frame = new JFrame("generisches gui"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); JPanel panel = new JPanel(); frame.getContentPane().add(panel); panel.setLayout(new GridLayout(25,2)); JLabel label = new JLabel(" attributs :"); label.setBackground(Color.lightGray); label.setOpaque(true); panel.add(label); JLabel label1 = new JLabel(" inputfields :"); label1.setBackground(Color.lightGray); label1.setOpaque(true); panel.add(label1); panel.add(label_name); panel.add(textField_Name); panel.add(label_Geschlecht); panel.add(textField_Geschlecht); panel.add(label_Alter); panel.add(textField_Alter); panel.add(label_Beruf); panel.add(textField_Beruf); panel.add(label_e_mail); panel.add(textField_e_mail); panel.add(label_TypGruppe); panel.add(textField_TypGruppe); panel.add(label_HausTyp); panel.add(textField_HausTyp); panel.add(label_Size); panel.add(textField_Size); panel.add(label_Accessoires); panel.add(textField_Accessoires); panel.add(label_PosVH); panel.add(textField_PosVH); panel.add(label_PosLR); panel.add(textField_PosLR); panel.add(label_GartenTyp); panel.add(textField_GartenTyp); panel.add(label_NStrasse); panel.add(textField_NStrasse); panel.add(label_NBus); panel.add(textField_NBus); panel.add(label_NWasser); panel.add(textField_NWasser); panel.add(label_NWald); panel.add(textField_NWald); panel.add(label_NMarkt); panel.add(textField_NMarkt); panel.add(label_NNachbar); panel.add(textField_NNachbar); panel.add(label_NachbarName); panel.add(textField_NachbarName); JButton saveDataButton = new JButton("save data to db"); saveDataButton.setBackground(Color.lightGray); saveDataButton.setOpaque(true); saveDataButton.addActionListener(this); panel.add(saveDataButton); JLabel label2 = new JLabel(" "); panel.add(label2); JLabel returnStatus = new JLabel("return status: "); panel.add (returnStatus); panel.add (returnField); //Display the window. frame.pack(); frame.setSize(500,800); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { System.out.println("Name :" + textField_Name.getText()); System.out.println("Geschlecht :" + textField_Geschlecht.getText()); System.out.println("Alter :" + textField_Alter.getText()); System.out.println("Beruf :" + textField_Beruf.getText()); System.out.println("e-mail :" + textField_e_mail.getText()); System.out.println("TypeGruppe :" + textField_TypGruppe.getText()); System.out.println("HausTyp :" + textField_HausTyp.getText()); System.out.println("Size :" + textField_Size.getText()); System.out.println("Accessoires :" + textField_Accessoires.getText()); System.out.println("PosVH :" + textField_PosVH.getText()); System.out.println("PosLR :" + textField_PosLR.getText()); System.out.println("GartenTyp :" + textField_GartenTyp.getText()); System.out.println("NStrasse :" + textField_NStrasse.getText()); System.out.println("NBus :" + textField_NBus.getText()); System.out.println("NWasser :" + textField_NWasser.getText()); System.out.println("NWald :" + textField_NWald.getText()); System.out.println("NMarkt :" + textField_NMarkt.getText()); System.out.println("NNachbar :" + textField_NNachbar.getText()); System.out.println("NachbarName:" + textField_NachbarName.getText()); String [] array = {textField_Name.getText(), textField_Geschlecht.getText(), textField_Alter.getText(), textField_Beruf.getText(), textField_e_mail.getText(), textField_TypGruppe.getText(), textField_HausTyp.getText(), textField_Size.getText(), textField_Accessoires.getText(), textField_PosVH.getText(), textField_PosLR.getText(), textField_GartenTyp.getText(), textField_NStrasse.getText(), textField_NBus.getText(), textField_NWasser.getText(), textField_NWald.getText(), textField_NMarkt.getText(), textField_NNachbar.getText(), textField_NachbarName.getText()}; StoreData storeData = new StoreData(); returnMsg = storeData.store(array); returnField.setText(returnMsg); textField_Name.setText(""); textField_Alter.setText(""); textField_Beruf.setText(""); textField_e_mail.setText(""); textField_TypGruppe.setText(""); textField_HausTyp.setText(""); textField_Size.setText(""); textField_Accessoires.setText(""); textField_PosVH.setText(""); textField_PosLR.setText(""); textField_GartenTyp.setText(""); textField_NStrasse.setText(""); textField_NBus.setText(""); textField_NWasser.setText(""); textField_NWald.setText(""); textField_NMarkt.setText(""); textField_NNachbar.setText(""); textField_NachbarName.setText(""); } }-- OtherDenisRaschpichler - 15 Dec 2004
Topic Gui-Pgm . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More } |
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
|
This website has been archived and is no longer maintained.