I have an issue with positioning of a JList in a JPanel, I am using absolute positioning, and I don't want to switch to gridlayout or any of that stuff cuz the whole program is in absolute positioning and it wud mess everything up.
The problem is that once the list is positioned, it will sometimes move to the position it is supposed to be in, but sometimes, for example when I recompile, without changing anything, It will move to the top left of the screen.
Then the list might return to where it is supposed to be after a while.
This all seems very random, and it happens even if I dont change a single character in the code.
Here's the code for the positioning of the list.
This is part of the constructor.
model = new DefaultListModel(); // declares the list model
list = new JList(model); // adds the list model to the list
for( int i = 0; i < numAudiobooks; i++)
{
// adds elements to the list here
}
list.setSelectedIndex(0);
scrolling = new JScrollPane(list);
thepanel.add(scrolling);
list.setBounds(500, 500, 200, 200);
thepanel.add( list );
Please help