Results 1 to 2 of 2
Thread: Store values in arrays
- 03-21-2010, 07:48 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 80
- Rep Power
- 0
Store values in arrays
Hi
I'm trying to store any string value in an array but there is a problem which is when I press "Save" button it doesn't store the value in the array
Java Code:import javax.swing.*; import java.awt.*; import java.awt.event.*; public class ArraysApplet extends JApplet implements ActionListener{ private JTextField text; private JButton save; private JButton retrieve; private JLabel label; public void init(){ text = new JTextField(10); save = new JButton("Save"); retrieve = new JButton("Retrieve"); label= new JLabel("Here is the name"); save.addActionListener(this); retrieve.addActionListener(this); Container contentPane = getContentPane(); contentPane.setLayout(new FlowLayout()); contentPane.add(text); contentPane.add(save); contentPane.add(retrieve); contentPane.add(label); } public void actionPerformed(ActionEvent e){ String fullName[] = {""}; if(e.getSource()==save){ String t = text.getText(); fullName[0]= ""+t; }if(e.getSource()==retrieve){ label.setText(""+fullName[0]); } } }
- 03-21-2010, 07:53 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
How do I list values of an arrays in a comma seperted list
By nmvictor in forum New To JavaReplies: 2Last Post: 11-22-2009, 05:24 PM -
How do I list values of an arrays in a comma seperted list
By nmvictor in forum New To JavaReplies: 3Last Post: 11-21-2009, 05:48 PM -
Adding Values of 2 Arrays
By core2duo5252 in forum Java 2DReplies: 7Last Post: 09-05-2009, 03:50 AM -
How to store extracted xml values in a database?
By palanikumark in forum Advanced JavaReplies: 6Last Post: 05-30-2008, 12:14 PM -
Retaining DB values as well as Dynamically generated Values.. Help Needed !
By rajivjha in forum Advanced JavaReplies: 0Last Post: 05-22-2008, 10:53 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks