This is the code for my GUI:
public TLGUI(){
final int x=500,y=600;
JFrame frame=new JFrame();
frame.setSize(x, y);
frame.setVisible(true);
frame.setResizable(false);
JLabel labelTL=new JLabel("This is a test label");
JScrollPane pane = new JScrollPane(labelTL,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JPanel panel=new JPanel();
panel.add(labelTL);
frame.add(panel);
frame.add(pane);
}
I have a huge problem right now regarding the line marked with the ** **.
This code does indeed add a scrollbar to my window, but the problem is that if I place it in front of the TLFrame.add(panel), I wont see it at all (I guess the panel is covering it in this order), and as soon as I turn it around, I can see a scrollbar but the whole frame other than the scrollbar is grey (I suppose the scrollbar is covering the panels contents here).
However, I want both of them to be visible at once, of course. Because my Label is bigger than the Frame, I want to be able to scroll down at least.