Results 1 to 2 of 2
- 09-30-2012, 06:03 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
Reading .txt contents and printing them to java GUI
Hello All,
As the title of my forum states, I'm looking for a way to read the contents of *.txt file, and display the in a Java JFrame using JLabel. I'm new to object oriented programming. I have a very solid background in procedural programming (mostly writing perl scripts), but Java is a little shaky to me. My text file has contents:
hinkey/documents/videos/action
hinkey/documents/videos/drama
hinkey/documents/videos/comedy
hinkey/documents/videos/romance
What is the best way to read that into a java program, and paste it to a GUI JFrame so that it's in the left hand corner. Thanks for any help
-
Re: Reading .txt contents and printing them to java GUI
You have two issues here: 1) reading in data from a file, and 2) displaying information in a Swing GUI. These two issues should be solved separately and then after being solved, combined. So for the reading in of data, consider using a Scanner object. For displaying multi-lined information, I prefer to use a JTextArea rather than a JLabel.
Similar Threads
-
printing problem of all contents of a canvas
By mitra in forum Advanced JavaReplies: 0Last Post: 08-05-2011, 08:24 AM -
Printing contents of Arraylist -- strange issue
By YeeP in forum New To JavaReplies: 19Last Post: 08-10-2010, 08:36 AM -
Problems saving a file and printing its contents.
By gth05 in forum New To JavaReplies: 3Last Post: 12-03-2009, 10:05 PM -
Printing the contents of an array of objects
By Mr.Paplu in forum New To JavaReplies: 1Last Post: 03-19-2009, 04:49 PM -
Printing contents of a web page
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 12:37 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks