java - JPanel flipping out, FlowLayout not working as intended -


The code was working the other day. I have changed some things and ran it again and now it does not work as intended. Obviously, I have changed some changes, but I have gone back and all those changes have been returned and it still does not work. To ignore that bit of information (to get started), why does not this code contain JLLL's 15x15 grid inside JNLL?

  gameboard.setLayout (new flow layout ()); For (int i = 0; i & lt; 15; i ++) {for (int j = 0; j & lt; 15; j ++) {JLabel tile = new jlab (""); Tile.setHorizontalAlignment (SwingConstants.CENTER); Tile.setPreferredSize (new dimension (27, 27)); Tile.Setborder (new editborder ()); Tile.setEnabled (wrong); GameBoard.add (tile); }}  

The Gameboard is a JPNL defined by the Netbeans' GUI Builder. Its preferred size, maximum size (similar to preference) is horizontal / vertical resizable options are disabled, however when this code extends horizontally every line without breaks in a row at any time.

If I understand correctly, floating layout elements are wrapped, when they were having their own elements before today, I do not know why this behavior is stopping?

It would be much better to use A.

  GridLayout Grid Layout = New Grid Layout (15, 15);  

A new look and experience may change the flow layout due to the use of various fonts or some Java VM upgrades. Defining a flow layout for this use is not recommended as you trust the underlying sizes which can vary or look in the virtual machines and look.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -