File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes disappearing text on disabled buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "disappearing text on disabled buttons" Watch "disappearing text on disabled buttons" New topic

disappearing text on disabled buttons

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
Hi Guys,

Until now I've not had an issue with JButtons on an interface retaining their text label, but since I've recently added a plugin app to my main applicaton it has had a strange effect on those buttons that are initially disabled on the main application. I've been trying to figure out what is different about this plugin application that is affecting the main application in this manner, but it eludes me. I'm hoping someone can just suggest setting some property on the buttons in question to ensure they always display their text label whether they're enabled or not.

Allow me to explain that the main application has a Language menu with three submenus (JMenuRadioButtons) that allow the user to select to a different language. They each call a method named changeMenus_Buttons(). Like so:

The changeMenus_Buttons() method simply accesses every menu and button and changes its text from a Resource file to the appropriate text in accordance to the language selected. Under normal operation I can switch between each language and all menus and buttons change as expected. But the minute I launch my plugin and then close it, then change the language, all those buttons that were disabled lose their text label. If I enable those buttons, then their text labels appear. So I know that the method call to changeMenus_Buttons() is doing its job, I just can't figure out what it is that my plugin is doing to change the behavior of the disabled buttons. I have other plugins that I use but none of them affect the buttons in the same way.

If you look at the code above, you'll notice that I'm calling revalidate() and repaint() on the JPanel. In this case, it appears those calls don't affect those buttons that are disabled after having launched the new plugin. This is a baffling situation. I'm hoping someone their has encountered a similar phenomenon and can help out.

Please advise,

Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 122

What kind of plugin is that? Eclipse plugin? java native dll? etc.?
Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
It's a plugin I wrote for my own application.

I agree. Here's the link:
subject: disappearing text on disabled buttons
Similar Threads
can't add to JPanel after removeAll() is triggered by another swing component
JRadioButton labels don't change on repaint()
getting Properties file in MessageBundle
ItemStateChanged Event