JOptionPane bigger

微笑、不失礼 提交于 2021-02-08 10:10:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!