I went off and started messing around and it seems that I messed up somehow. I’m attempting to place a JTextArea onto a JPanel as I usually do but it’s not showing up; does anyone see where I messed up?
import javax.swing.*;
import java.awt.*;
class Window extends JFrame
{
private Insets insets;
public Window()
{
JFrame mainFrame = new JFrame();
mainFrame.setSize(1024, 786);
mainFrame.setLocationRelativeTo(null); //Centers the window on the users screen.
mainFrame.setTitle("Temp Name");
mainFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
mainFrame.setResizable(false);
insets = mainFrame.getInsets();
mainFrame.setLayout(null); //Makes it so you can manually positon everything on the JPanel using XY coords.
JPanel mainPanel = new JPanel(); //Creates a new JPanel to put everything on.
mainFrame.getContentPane().add(mainPanel);
TextArea gameTextArea = new TextArea();
gameTextArea.setEditable(false);
gameTextArea.setBounds(50, 30, 100, 20); //X position, Y Position, Length in pixels, Height in pixels.
mainPanel.add(gameTextArea);
mainFrame.setVisible(true);
}
}
Example: http://i.imgur.com/RSB3HkV.png
I’ve probably just forgotten a statement or something but I’m not sure.