我正在研究 GUI,我是一名业余程序员。我对这段代码有疑问。我看不到框架上的任何东西。
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1366, 768);
JPanel contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
Container midPanel = new JPanel();
midPanel.setLayout(null);
Dimension preferredSize = new Dimension(700, 700);
midPanel.setPreferredSize(preferredSize);
.....
Container k1 = new JPanel();
k1.setSize(50, 700);
k1.setLocation(0, 0);
k1.setLayout(new GridLayout(rowNum, 1));
k1.setVisible(true);
midPanel.add(k1);
.......
Dimension jspD = new Dimension(500,500);
JScrollPane jsp = new JScrollPane(midPanel);
jsp.setPreferredSize(jspD);
jsp.setLocation(0, 0);
jsp.setVisible(true);
contentPane.add(jsp);
我会很感激你的帮助。