/* * 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.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class DataInputGui implements ActionListener { String returnMsg; JTextField textField1 = new JTextField(20); JTextField textField2 = new JTextField(20); JTextField textField3 = new JTextField(20); JTextField textField4 = new JTextField(20); JTextField returnField = new JTextField(40); public DataInputGui() { JLabel label1 = new JLabel("Label-1"); JLabel label2 = new JLabel("Label-2"); JLabel label3 = new JLabel("Label-3"); JLabel label4 = new JLabel("Label-4"); //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(6,2)); JButton saveDataButton = new JButton("save data now"); saveDataButton.addActionListener(this); panel.add(saveDataButton); JLabel label = new JLabel(" inputfields :"); panel.add(label); panel.add(label1); panel.add(textField1); panel.add(label2); panel.add(textField2); panel.add(label3); panel.add(textField3); panel.add(label4); panel.add(textField4); JLabel returnStatus = new JLabel("return status: "); panel.add (returnStatus); panel.add (returnField); //Display the window. frame.pack(); frame.setSize(500,200); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { System.out.println("textField1 :" + textField1.getText()); System.out.println("textField2 :" + textField2.getText()); System.out.println("textField3 :" + textField3.getText()); System.out.println("textField4 :" + textField4.getText()); String [] array = {textField1.getText(), textField2.getText(), textField3.getText(), textField4.getText()}; StoreData storeData = new StoreData(); returnMsg = storeData.store(array); returnField.setText(returnMsg); textField1.setText(""); textField2.setText(""); textField3.setText(""); textField4.setText(""); } }-- OtherDenisRaschpichler - 14 Dec 2004
Topic GuiPgm . { Edit | Attach | Ref-By | Printable | Diffs | 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.