The default layout manager for a JFrame
is BorderLayout
. BorderLayout
only allows a single component to occupy any of the available spaces it managers.
Instead, try changing the layout manager to something like GridLayout
Something like frame.setLayout(new GridLayout(9, 9));
for example might help
You should not be using setBounds
as it will have no effect on components under the control of layout managers. Instead, you should use the cols and rows constructor of JTextArea
to provide details about how you want the text area sized to
Update with GridLayout
example

Each JTextArea
will be give equal amount of the available space, so as you resize the window, the fields will also change size...
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TestLayout101 {
public static void main(String[] args) {
new TestLayout101();
}
public TestLayout101() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
JFrame frame = new JFrame();
frame.setTitle("Sudoku");
frame.setLocation(500, 0);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setLayout(new GridLayout(9, 9));
JTextArea[][] field = new JTextArea[9][9];
//Initiate faces
for (int j = 0; j < 9; j++) {
for (int i = 0; i < 9; i++) {
field[i][j] = new JTextArea(1, 3);
field[i][j].setBorder(BorderFactory.createLineBorder(Color.BLACK));
field[i][j].setText(i + " " + j);
frame.add(field[i][j]);
}
}
frame.pack();
frame.setVisible(true);
}
});
}
}
Updated with GridBagLayout
example
This will provide each JTextArea
with it's preferred size, if enough space is available.

This will mean as you resize the window, the fields won't change in size, unless there isn't enough space available to honour the preferred or minimum size...
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TestLayout101 {
public static void main(String[] args) {
new TestLayout101();
}
public TestLayout101() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
}
JFrame frame = new JFrame();
frame.setTitle("Sudoku");
frame.setLocation(500, 0);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setLayout(new GridBagLayout());
JTextArea[][] field = new JTextArea[9][9];
//Initiate faces
GridBagConstraints gbc = new GridBagConstraints();
for (int j = 0; j < 9; j++) {
gbc.gridy = j;
for (int i = 0; i < 9; i++) {
gbc.gridx = i;
field[i][j] = new JTextArea(1, 3);
field[i][j].setBorder(BorderFactory.createLineBorder(Color.BLACK));
field[i][j].setText(i + " " + j);
frame.add(field[i][j], gbc);
}
}
frame.pack();
frame.setVisible(true);
}
});
}
}