This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is possible change icon of Ok's botton in JOPtionPane, How?

 
Daniel Faria
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is possible change icon of Ok's botton in JOPtionPane, How?

Thanks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Is possible change icon of Ok's botton in JOPtionPane, How?

as far as I know, the 'OK' button only has text.

can you post an example of one with the icon you want changed
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Is possible change icon of Ok's botton in JOPtionPane, How?

as far as I know, the 'OK' button only has text.

Perhaps the look&feel adds an icon to that. In GTK for instance it's quite normal to have a little check icon (v) on the OK button, and an X on the Cancel button.

I've checked the source of JOptionPane and BasicOptionPaneUI, and I think you can do this by using the showOptionPane method, providing your own custom buttons to the method as the options. You'll need to handle which button was clicked manually. For instance:
 
Daniel Faria
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But in my case is showMessageDialog.
It's possible??

Thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
showMessageDialog, and all other methods, eventually delegate to showOptionDialog.

A part of JOptionPane's source:
Just use the same as the last one but with your custom options.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic