Most posts I've seen about this seem to be related to the user resizing it, however I want the program itself to resize it.
I'm trying to make a titled border in a program, and I only want it to be a certain size. However it seems to be the size of the whole window, which is not what I want. I tried setting the size and the preferred size, however it doesn't seem to be affecting anything.
Here's the code, by the way:
private JFrame Frame;
private JPanel Main;
private TitledBorder Border;
Frame = new JFrame("Window Title");
Frame.setSize(600,400);
Frame.setResizable(false);
Main = new JPanel();
Main.setSize(new Dimension(30,30)); // I also tried using ints to set the size
Border = BorderFactory.createTitledBorder("Border Title");
Main.setBorder(Border);
Frame.add(Main);
Frame.setVisible(true);