Results 1 to 5 of 5
Thread: Help with JAVA Address Book Demo
- 04-27-2011, 01:24 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 29
- Rep Power
- 0
Help with JAVA Address Book Demo
Hello!
I'm trying to modify JAVA Address Book Demo from Using Java DB in Desktop Applications so the contacts will be saved in a text file and not using DB? I tried modifying this program but I didn't managed to save contacts in a txt file.
- 04-27-2011, 02:01 PM #2
Why not? What did you try? Where did you get stuck?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-27-2011, 02:05 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 29
- Rep Power
- 0
Java Code:Thread salvareFisier=new Thread() { public void run(){ for(int i=0; i<5; i%=5){ try { Thread.sleep(300000); } catch (InterruptedException ex) { JOptionPane.showMessageDialog(null,"Salvarea automata a esuat!","Eroare",JOptionPane.ERROR_MESSAGE); } FileOutputStream fos2=null; try { fos2 = new FileOutputStream(fisier); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(null,"Salvarea automata a esuat!","Eroare",JOptionPane.ERROR_MESSAGE); } ObjectOutputStream oos2=null; try { oos2 = new ObjectOutputStream(fos2); oos2.writeObject(agenda); oos2.close(); } catch (IOException ex) { JOptionPane.showMessageDialog(null,"Salvarea automata a esuat!","Eroare",JOptionPane.ERROR_MESSAGE); } } }; };
- 04-27-2011, 02:11 PM #4
...okay, and what was the problem? What does that do? What would you expect it to do?
If you want help, you have to be specific. Post an SSCCE that demonstrates exactly what you're doing and the problem you're having. That doesn't mean post your whole project- boil it down to the bare minimum.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-27-2011, 02:29 PM #5
Member
- Join Date
- Dec 2009
- Posts
- 29
- Rep Power
- 0
That is the thread that save the DB in the choosen file, once at every 5 minutes.
This is the what the save button action must do:
I also attached the entire program.Java Code:private void jMenuItemSaveActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JFileChooser fc=new JFileChooser(); int rezultat=fc.showSaveDialog(this); FileOutputStream fos=null; if(rezultat==JFileChooser.APPROVE_OPTION){ try { fos = new FileOutputStream(fc.getSelectedFile()); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(this,"Fisier invalid!","Eroare",JOptionPane.ERROR_MESSAGE); } try { ObjectOutputStream oos=new ObjectOutputStream(fos); oos.writeObject(agenda); oos.close(); } catch (IOException ex) { JOptionPane.showMessageDialog(this,"Eroare de scriere!","Eroare",JOptionPane.ERROR_MESSAGE); } } }
Similar Threads
-
hi, i want to access the address book of yahoo,gmail from java
By madhumca_k in forum New To JavaReplies: 1Last Post: 02-17-2010, 06:28 AM -
java address book problems
By Ekul in forum AWT / SwingReplies: 3Last Post: 11-11-2009, 07:14 PM -
An address book, using a wizard to add a new entry
By Java Tip in forum SWTReplies: 0Last Post: 07-02-2008, 08:11 PM -
Programming an Address book
By d.anthonii in forum New To JavaReplies: 0Last Post: 12-31-2007, 05:26 PM -
Address Book Server RC1 - 20 June 2007
By JavaBean in forum Java SoftwareReplies: 0Last Post: 06-22-2007, 06:03 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks