Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Focus and Style problems  RSS feed

Randall Twede
Ranch Hand
Posts: 4683
Java Scala
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have two problems with my new project. let's start with the focus problem. the tutorial i am using as a stating point works the way i want. when you run it the focus is on the JTextPane. mine it is not. i have to click on the JTextPane to give it the focus. also when using the menu, or in my case the toolbar, the focus returns to the JTextPane, but not in mine. again, i have to click on the JTextPane.

the other problem is when changing the Style. the example program works fine. you change the style to bold for instance. from that point on it is bold until you change it. mine works that way too(because i am using an Action). but for the Styles that i can't use a pre-defined Action for(like color which i use an Action listener for), it changes the entire paragraph to that color.

i will try to figure this out on my own, but i am handicapped by a laptop battery that only holds 30 minutes, and a library with limited hours.

here is the entire code for the tutorial and my code. they are both very long...sorry
their code:

my code so far:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!