Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Swing / AWT / SWT
arabic RTF viewer problem
nuur alif
Greenhorn
Posts: 10
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hello dear friends...
i do have done this code to view
RTF
file:
import java.awt.*; import java.io.*; import javax.swing.*; import javax.swing.text.*; import javax.swing.text.rtf.*; class RTFViewextends JFrame { public RTFView() { setTitle( "RTF Text Application" ); setSize( 400, 240 ); setBackground( Color.gray ); getContentPane().setLayout( new BorderLayout() ); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel, BorderLayout.CENTER ); // Create an RTF editor window RTFEditorKit rtf = new RTFEditorKit(); JEditorPane editor = new JEditorPane(); editor.setEditorKit( rtf ); editor.setBackground( Color.white ); // This text could be big so add a scroll pane JScrollPane scroller = new JScrollPane(); scroller.getViewport().add( editor ); topPanel.add( scroller, BorderLayout.CENTER ); // Load an RTF file into the editor try { FileInputStream fi = new FileInputStream( "C:\\source\\arabic.rtf" ); rtf.read( fi, editor.getDocument(), 0 ); } catch( FileNotFoundException e ) { System.out.println( "File not found" ); } catch( IOException e ) { System.out.println( "I/O error" ); } catch( BadLocationException e ) { } } public static void main( String args[] ) { // Create an instance of the test application RTFView mainFrame= new RTFView(); mainFrame.setVisible( true ); } }
the output in a frame viewer is : ����� ���� ����
hmm... for the arabic.rtf, i had type a arabic text ..but why it display that type of character?
can anybody explain to me?
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How To Read RTF file in JAVA? Using iText?
Passing variables to different classes
writing rtf
how to read rtf file and display in console?
parsing .rtf file to a string
More...