• Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane,with user defined Buttons

 
vinaya kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I wanna have an Error Message OptionPane
with "Details" as one more button apart from YES_NO Option in JOption,which when pressed
opens a one more window.
But it sounds, like for these buttons
i can't have the Listeners ,I tried using
YES_NO_CANCEL Option to YES NO and DETAILS
but i have no clue ,what so ever to listen to this button..
any other method where i can have the errormessage
and also have the details button.
when i press detail button one more window should be displayed
well,i am looking for screen as in windows (hmm !
i think something like Dr.Watson Error )
TIA
vinaya
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
the API of JOptionPane says about the options argument:

options
A more detailed description of the set of option buttons that will appear at the bottom of the dialog box. The usual value for the options parameter is an array of Strings. But the parameter type is an array of Objects. A button is created for each object depending on its type:
Component
The component is added to the button row directly. Icon
A JButton is created with this as its label. other
The Object is converted to a string using its toString method and the result is used to label a JButton.

That means you can provide you own button to the JOptionPane that can have attached to it an ActionListener.
chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!