java - JOptionPane: texts message and buttons in the same line -


as title says want achieve pop option message using joptionpane such question , buttons placed on same line. i'm reading following tutorials seems quite difficult:

in sense idea have following confirmation message layout:


the products going removed database.

are sure want perform it? |yes| |no|


where yes , no should buttons. (the text not real one, it's give flavor of message).

any comments or hints welcomed.

thanks lot in advance.

try this

   joptionpane.showconfirmdialog(null,                         getcustompanel(), // return panel design on own                         "joptionpane example : ",                         joptionpane.ok_cancel_option,                         joptionpane.plain_message); //and custom panel  private jpanel getcustompanel() {         jpanel panel = new jpanel();         jlabel label = new jlabel("text message:");         panel.setlayout(null);         jbutton okbtn=new jbutton("ok");         label.setbounds(10,20,200,40); //x,y,width,height         okbtn.setbounds(220,20,80,40); //x,y,width,height         panel.add(label);         panel.add(okbtn);         return panel;     } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -