hello guyz,,do you know best sites to recommend that has a tutorials on "swing" about:
a.) sample writing a file on "text file"
b.) the saved text file will be read by the main class in JOptionPane (java file)

actually, i has on it on bufferedreader,,but i really like to use JOptionPane,,do it has something like this???i hope you can help me guyzz,,thank you!!

Recommended Answers

All 3 Replies

Creating a GUI with JFC/Swing
Reading/writing is basic process you should already know, you will pass or retrieve from/to Swing components - no magic other then Java

actually this is how we make it:

we will be saving any texts in a "text file",,example i save in the text file like this:

i think that i shall never see
a poem lovely as a tree

then i save it in "poem.txt"

however,,if we will now start a program,,of course it will be in a "java file",,,i will make a code to read and call the "poem.txt",,so that when i want to output it, the output will be:

i think that i shall never see
a poem lovely as a tree

i only know buffered reader who read the file that i saved "text file"..but does the swing have this??i really want to have it on JOptionPane...

There is always a method that can return String value of the reader and this can be easily pass to Swing components to output it...
For example JTextArea(String text) initialize JTextArea with text tring or method append(String str) of same class that can add additional text to already presented one

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.