• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

swing basics..

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm a greenhorn in Java so I need your advices on quite alot of swing basics.
Firstly, I areadly have 3 JButtons onto the JFrame.
The first button is "Add", it should have the functions of able to get the data from the JTextFields and save them to a file. The file will contain 1 line per product.
Secondly, a "Clear" button to clear the text fields.
Thirdly, a "Print" button to read all the data in the file and print to a standard output.
Pls advise and if poss. , wif some egs too...
thanx in advance..
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not just a swing basics but like a small project involve in it
Your code requires to know how of Input/Out as well and when the swing classes and the stream classes will combine to work it would be many lines of code to work with...
Do you need this program completed by us or just wanna hint of the code...
Would be better if you do it yourself so that you can dig into the i/o and swing operations.
What would you like...
Regards
Rashid Ali
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can refer to Sun's Java tutorial for all your problems.
1) For Add:
First do textfield.getText()& assign to some variable. Then create FileOutputStream & ObjectOutputStream objects & write the contents to the file.
2) Clear:
do textfield.setText("")
 
Dinner will be steamed monkey heads with a side of tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic