问题
I am working on a Tic Tac Toe game on Java (eclipse). On my computer my dialog box is really small. I been trying to make it bigger. I didn't have any luck. I was hoping someone here can lead me in the right direction. The code below is my dialog box code:
JOptionPane.showMessageDialog(frame, "Tic Tac Toe Server is Running");
Thank you in Advance
回答1:
As mentioned here, you can do this:
UIManager.put("OptionPane.minimumSize",new Dimension(500,500));
JOptionPane.showMessageDialog(frame, "Tic Tac Toe Server is Running" );
Update:
For making the font size bigger, you could add a component, for exampe JLabel
, to the pane; as the following:
JLabel label = new JLabel("Tic Tac Toe Server is Running");
label.setFont(new Font("Arial", Font.BOLD, 18));
JOptionPane.showMessageDialog(frame, label);
来源:https://stackoverflow.com/questions/43623278/joptionpane-bigger