• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is possible change icon of Ok's botton in JOPtionPane, How?

Thanks.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But in my case is showMessageDialog.
It's possible??

Thanks.
 
Rob Spoor
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic