• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help setting Styles  RSS feed

 
Randall Twede
Ranch Hand
Posts: 4692
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have had this problem since i first started this project. the code is a lot easier to read now so i hope someone can tell me what i am doing wrong. in my app, the styles that are set by Actions work fine. bold + underline etc. three of the Styles i have to write myself are for the font family, the font size, and the color. i have an action listener for this. the problems with them are two(but they might be related). instead of starting the new style at the caret, my code changes the entire paragraph. second. my styles will mix with the Action ones but not each other. i can have red and underline but not red and font size 72. when i change the font size the color goes back to black. the tutorials don't seem to help me much. here is the code in question.

here is the entire class
 
Rob Camick
Ranch Foreman
Posts: 2820
15
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my app, the styles that are set by Actions work fine.


Use the Actions from the editor kit. Create the Action dynamically when an item from the combo box is selected and invoke it manually:



Or you can always look at the source code for the existing Actions to see what you are doing differently.
 
Randall Twede
Ranch Hand
Posts: 4692
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Rob
Use the Actions from the editor kit. Create the Action dynamically when an item from the combo box is selected and invoke it manually:

i hadn't thought of that. i will give it a try
Or you can always look at the source code for the existing Actions to see what you are doing differently.

i did think of that but the API source didn't seem to come with my copy of java7EE
i found it seperately and downloaded it, but i forgot where i put it at
 
Randall Twede
Ranch Hand
Posts: 4692
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that works just fine. maybe i will try to figure out what was wrong with my code someday, but there is no point in re-inventing the wheel.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!