幅と高さを指定しましたf.setSize();
が、違いはありません。
コードは次のとおりです。
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();
}
}
私が間違っていること、または忘れていることは何ですか?