java - How to convert a JOptionPane to a JDialog -


i need convert joptionpage jdialog, because need rid of quirky "ok" button. below code...

joptionpane.showmessagedialog(null, interface, caption, joptionpane.warning_message, icon); 

interface gui, "caption" title, have warning message, have custom icon.

this might not possible given info, need rid of ok. appreciated.

why not create jdialog , put interface object contentpane, pack , display it. simple.


you state:

obviously joptionpane small, jdialog i'd have create window , more stuff. gui created, , can import joptionpane. can't jdialog believe.

i'm confused. mean "the gui"? again, if jpanel, again, put jdialog.

for instance if in actionlistener

public void actionperformed(actionevent e) {   // assuming being called within jframe named myframe   jdialog dialog = new jdialog(myframe, "dialog title", modalitytype.application_modal);   dialog.getcontentpane().add(interface);   dialog.pack();   dialog.setlocationrelativeto(myframe);   dialog.setvisible(true); } 

another option use joptionpane constructor, , create without showing it, , convert jdialog joptionpane api shows how do, may still have ok or similar button deal with.


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -