0

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

cat
  • 3
  • 1
  • 4

1 Answers1

2

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);
Community
  • 1
  • 1
Kh.Taheri
  • 946
  • 1
  • 10
  • 25
  • 1
    Thank you so much...so do i just UI manger to also make my message bigger – cat Apr 26 '17 at 01:14
  • 1
    This will however have no effect if a Message Dialog has already been previously displayed (before new dimensions have been put to the UIManager). Also, if and when this code does take affect then all future OptionPanes will be of that new dimension. – DevilsHnd - 退職した Apr 26 '17 at 01:18
  • I mean the letters in the box...The box is bigger but the message is still tiny – cat Apr 26 '17 at 01:21
  • @cat .. I have already updated the answer; if you find it useful, please upvote it and mark it as a correct/accepted answer. – Kh.Taheri Apr 26 '17 at 01:27
  • 1
    You can use simple HTML in your JOptionPane messages. You might want something like this: `"Tic Tac Toe Server is Running"`. The font size is a HTML Font size. It is much larger than you think ;). The and tags makes the text bold. – DevilsHnd - 退職した Apr 26 '17 at 01:28