问题
Is there a way to change the JOptionPane.showMessageDialog
font? I'm trying to write code for a message dialog and I need to change the font if it's possible.
回答1:
JOptionPane jopt = new JOptionPane();
String result;
result = "your message";
JLabel resLabel = new JLabel(result);
resLabel.setFont(new Font("Monospaced", Font.BOLD, 50));
jopt.showMessageDialog( null, resLabel, "Results", JOptionPane.PLAIN_MESSAGE );
Create a new label with your custom font and set the jlabel as a component in joptionpane.
来源:https://stackoverflow.com/questions/36898263/is-there-a-way-to-change-joptionpane-showmessagedialog-font