I have specified the width and height with f.setSize();
but it is not making any difference.
Here is the code:
public class MTGSAMPServerReference extends JPanel{
public static Toolkit tk = Toolkit.getDefaultToolkit();
static int ScrnWidth = ((int) tk.getScreenSize().getWidth());
static int ScrnHeight = ((int) tk.getScreenSize().getHeight());
public static void main(String[] args) {
MTGSAMPServerReference gui = new MTGSAMPServerReference();
gui.launchFrame();
}
public void launchFrame() {
String[]listContents={"Vehicles","Houses","Companies","Objects","Jobs"};
JFrame f = new JFrame("MTG SAMP Server Reference");
JList list1=new JList(listContents);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
f.setSize(1200, 800);
f.setLocationRelativeTo(null);
f.add(list1);
list1.setSize(500, 500);
Container contentPaneMain = f.getContentPane();
contentPaneMain.add(new MTGSAMPServerReference());
f.pack();
}
}
What is it that I am doing wrong, or forgetting?