java - How to change font with showconfirmdialog? -
i have tried many different tutorials , none have worked have. help?
uimanager.put("optionpane.font", new fontuiresource(new font("press start 2p", font.plain, 11))); if (questionnumber == questions.size()) { triviagui.questionframe.setvisible(false); joptionpane.showmessagedialog(null, "your score level : " + levelscore + " out of 10. \n total score " + triviagui.totalscore, "scores", joptionpane.information_message, pokeballicon); }
this how change font in jlabel, maybe help?
message = new jlabel(textmessage); // create bigger text (to-times-bigger) font f = message.getfont(); message.setfont(new font(f.getname(), font.plain, f.getsize()*2)); // put text in middle of vertical space message.setverticaltextposition(jlabel.center);
you take font label, , reset font like. maybe can same jdialog?
i found working answer here: formatting text in jdialog box
this method called actionlistener of button:
public void openpopup(){ string t = "<html>the quick <font color=#a62a2a>brown</font> fox."; joptionpane.showmessagedialog(null, t); }
gives result:
Comments
Post a Comment