aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes need help with StlyedDocument Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help with StlyedDocument" Watch "need help with StlyedDocument" New topic
Author

need help with StlyedDocument

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4339
    
    2

i am writing a simple word processor using the "using text components" tutorial as a starting point.
some of it was straightforward copy and paste: bold, italic, underline. others i figured out by extrapolation: left center right. i am having problems though with font type, font size, and color.
these i am changing from the tutorial. i use JComboBox for type and size, and JColorChooser for color.

i need help! it is all too confusing.
i think i need to use this method from StyledDocument
doc.setLogicalStyle(pane.getCaretPosition(), style);
but Style is an Interface as are the rest of this motly crew.
their code:

my code:





also, why did they do this?

if i need to use setLogicalStyle() i can't do it using and AbstractDocument

please supply some code or link to useful information.

SCJP
Visit my download page
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4339
    
    2

i found something that might be usefull here

your help still appreciated
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4339
    
    2

i found some more help:


however, i need to set the font not the font family
it is obviously possible to set the font since i could do it for the entire JTextPane.

however for the document all i can find is FontFamily
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 150
not sure if isn't threre an issue with LabelView & FONT.getStyle

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4339
    
    2

i figured it out for the most part. i was misled sort of by the tutorial. i was under the impression that FontFamily could be only "serif" or "sans serif" and the font name was something different. as it turns out the font names(Arial, Times New Roman, etc) are font families. i still have a couple of problems, but i will start a different thread for them. i would do it now, but i don't have my laptop with me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with StlyedDocument
 
Similar Threads
JPopupButton
Need Help with starting a timer in Javascript
Can you send post method with javascript?
What is/the point of, a secure thread?