When I run the below code, font size of the text doesn't change to "new Font("Tahoma", Font.BOLD, 48)". I am running this program in windows 7 OS and jdk 1.7.25.
I even tested with very old jdk version jdk 1.3.0 the behaviour is still the same.
Has any one faced similar issue, Can you please help regarding this?
import java.awt.Component;
import java.awt.Font;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class Joption {
/**
* @param args
*/
public static void main(
String[] args) {
// TODO Auto-generated method stub
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
System.out.println("Exception:"+e);
}
JFrame parentFrame = new JFrame();
showDialogCheckBox(parentFrame, "Message Testing", "Title",
JOptionPane.OK_CANCEL_OPTION,// JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, null, null,
new Font("Tahoma", Font.BOLD, 48),
"Never show this Dialog again!", "", "");
}
public static int showDialogCheckBox(Component parentComponent,
Object message, String title, int optionType, int messageType,
Icon icon, Object[] options, Object initialValue, Font fontMessage,
String checkBoxText, String key, String type) {
UIManager.put("Label.font", fontMessage);
final JCheckBox checkBox = new JCheckBox(checkBoxText);
Object[] msgs = { message, checkBox };
final JOptionPane optionPane = new JOptionPane(msgs, messageType,
optionType, icon, options, initialValue);
final JDialog dialog = optionPane.createDialog(parentComponent, title);
dialog.setVisible(true);
UIManager.put("Label.font", fontMessage);
return 1;
}
}