Positioning/Resizing JList Help
I have a JList that lists files in a certain directory, i cannot get it to setLocation or setSize.
Code :
import java.awt.*;
import java.swing.*;
public class b extends JFrame
...
...Gets what the list disaplys....
<initiated JList>
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSize(575, 375); //no matter what parameters i put in its always center
list.setVisibleRowCount(15);
add (new JScrollPane(list));
its the same way with a button...
Re: Positioning/Resizing JList Help
What Layout Manager are you using? Recommended reading: Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
Also, have you tried setting the size of the JScrollPane instead?
Re: Positioning/Resizing JList Help
Usually to set the size and position of an element, you need to set the layout manager of the container that you are putting it in to null.