RomeScape
March 29, 2024, 03:31:55 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: My new email:
Pankers7@gmail.com
email me if u need anything Tongue
 
  Home   Forum   Help Search Arcade Staff List Login Register  

JEditorPane text file as html

Pages: [1]   Go Down
  Print  
Author Topic: JEditorPane text file as html  (Read 255 times)
0 Members and 1 Guest are viewing this topic.
Mazead
New-Member


Reputation +0/-0
Offline Offline

Posts: 10


View Profile
« on: October 11, 2014, 06:43:15 pm »

I would like my JEditorPane to process any text file as html file.

Quote
String file = "cube.obj";
JEditorPane t = new JEditorPane();
t.setEditable(true);
try {
   URL url = new URL(getCodeBase(), file);
   t.setPage(url);
} catch (NumberFormatException | IOException e) {
   e.printStackTrace();
}


Is it possible? My first idea was to read my text file line by line and add these lines to editor pane, but is there any more "elegant" solution?
Report Spam   Logged

Share on Facebook Share on Twitter



Pages: [1]   Go Up
  Print  
 
Jump to:  

Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum
Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy