The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Help Adding flatfile data store
Discuss Help Adding flatfile data store in the Java Help forum on Dev Shed. Help Adding flatfile data store Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 10th, 2013, 02:56 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
|
Help Adding flatfile data store
please me i want to add a textfile data storage .. what can i do ...
public class Queue extends JFrame
{
public Queue()
{
super();
initializeComponent();
this.setVisible(true);
}
private void initializeComponent()
{
Que = new JLabel();
jTextField1 = new JTextField();
Ok = new JButton();
contentPane = (JPanel)this.getContentPane();
//
// Que
//
Que.setText("Queue # :");
//
// jTextField1
//
jTextField1.setToolTipText("String");
jTextField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField1_actionPerformed(e);
}
});
//
// Ok
//
Ok.setText("Send");
Ok.setToolTipText("Send");
Ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
Ok_actionPerformed(e);
}
});
//
// contentPane
//
contentPane.setLayout(null);
contentPane.setBorder(BorderFactory.createEtchedBorder());
addComponent(contentPane, Que, 22,11,60,20);
addComponent(contentPane, jTextField1, 92,9,110,25);
addComponent(contentPane, Ok, 66,44,63,26);
//
// Queue
//
this.setTitle("Queue");
this.setLocation(new Point(110, 177));
this.setSize(new Dimension(231, 122));
this.setResizable(false);
}
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
private void jTextField1_actionPerformed(ActionEvent e)
{
System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");
}
private void Ok_actionPerformed(ActionEvent e)
{
System.out.println("\nOk_actionPerformed(ActionEvent e) called.");
}
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
new Queue();
}
}
|

January 10th, 2013, 06:20 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
What will be the contents of the file? Will it be a text file made of lines of text with line end characters separating the lines?
See the PrintWriter or FileWriter classes for ways to write a text file.
Please edit your post and wrap the code in code tags
|

January 11th, 2013, 02:54 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by NormR What will be the contents of the file? |
the file will be the 1 string with delimiter of ";" coming from Jtextfield sir can you help me sir ...
|

January 11th, 2013, 06:19 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
Try writing a small simple program that writes data to the file and then reads that data back before trying to make changes to your current program. The small program will allow you to test the code and get the techniques needed.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|