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

Mac-savvy Help button  RSS feed

Basil Bourque
Posts: 7
Java Mac Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a bit of code I'm using to get a native-style "Help" in Mac OS X while maintaining compatibility with other Look-and-Feels. A round purple button with a "?" icon appears.

Setting the Client Property "JButton.buttonType" to "help" causes the Mac-savvy button to appear, at least in later versions of Java and Mac OS X.

The next step is to suppress the display of the usual caption if running on a Mac. We accomplish that by overriding the "setText" method.

I'm new to overriding Swing components. So please critique.

This subclass seems to be working well with JFormDesigner 5.

--Basil Bourque
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!