Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Disabled JButton text appears blank!!  RSS feed

 
Michael Mendelson
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a vexing question, and not having done much desktop application development I'm not sure which direction to go.
My application has a number of javax.swing.JButton's. These are enabled/disabled from time to time during use of the application.
The problem is that when I execute the program using jdk 1.4.1, DISABLED BUTTONS APPEAR BLANK. see:

When I use 1.3 (I think 1.3.1), buttons appear as I would expect:

These buttons are all created using similar code:

...and enabled disabled using:

This all seems pretty standard to me. How can I fix this problem?
Thanks!!
[ November 27, 2002: Message edited by: Michael Mendelson ]
 
Ed Tidwell
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had some weird behavior happen to me on XP with 1.4 when it came to JSplitPanes.
I run on Linux, Solaris, NT and XP. It only showed up on XP with JDK 1.4. I noticed a new JDK 1.4.1 and after putting that on my machine the problem went away.
Any time you see different behavior for a standard Swing control between two JVMs on the same platform I would assume a bug.
Here is where you can go look it up...
http://developer.java.sun.com/developer/bugParade/index.jshtml
On a side note you can learn some very good stuff there as well. Work arounds to bugs as well as comments by Sun developers on internals and what needs to be done to fix it.
Hope this is helpful.
Ed
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to see what happens, as I have not had this problem with 1.4.1_01 on XP or Linux, instead of using the setText(String) method to place text on your Button, try doing that in the Buttons constructor, ie:
JButton button = new JButton("Some Text")
and see if you get the same results as before or not.
 
Michael Mendelson
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Ed and Gregg,
Gregg, I tried your suggestion and it does not seem to make a difference.
Ed, I spent some time searching through that knowledge base, and there was SO MUCH information, my time might be better spent installing the latest jdk.
In case it matters, I'm on win2k, and use the following code to set the look and feel:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!