Since the font size is too small by default LookAndFeel , I used a few lines of code to set it to Nimbus , and my JOptionPane > shows a Yes and No button with different sizes. Yes, it’s still very small, and “No” - with the size that I assign to him. Does anyone know why and how to fix it?
public static void setUIFont(Font a){
FontUIResource ax=new FontUIResource(a);
javax.swing.UIManager.put("OptionPane.messageFont", ax);
javax.swing.UIManager.put("OptionPane.buttonFont", ax);
javax.swing.UIManager.put("OptionPane.Font", ax);
javax.swing.UIManager.put("InternalFrame.titleFont", ax);
javax.swing.UIManager.put("TextField.font", ax);
javax.swing.UIManager.put("ComboBox.font", ax);
}
...
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
class UseNimBus extends SwingInvoker{
public void run(){
JDialog.setDefaultLookAndFeelDecorated(true);
setUIFont(new FontUIResource(new Font(ufont, Font.PLAIN, 20)));
}
}
(new UseNimBus()).execute();
The next line displays the options bar, but it has Yes and No with different sizes. Is this normal or is it just my problem?
inputValuex=JOptionPane.showConfirmDialog(
myWin, "Are you exiting?", "You clicked X", JOptionPane.YES_NO_OPTION);
Update
Still not working. I tried to use the code
javax.swing.UIManager.put("OptionPane.isYesLast", true);
"", . , , boolean.
, UIManager.getDefaults(), optionpane, , 20. Yes .