我有一个主类,它在某些时候调用另一个类,构造函数如下。
构造函数创建了 GUI,我认为应该显示它,但它没有。为什么会这样?
public ModPackManager(){
System.out.println("New modpackmanager");
setUndecorated(true);
setBounds(100, 100, 350, 87);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(null);
{
JLabel lblDownloadingModPack = new JLabel("Downloading and installing modpack, please wait...");
lblDownloadingModPack.setHorizontalAlignment(SwingConstants.CENTER);
lblDownloadingModPack.setBounds(10, 11, 330, 14);
contentPanel.add(lblDownloadingModPack);
}
progressBar = new JProgressBar();
progressBar.setBounds(10, 48, 330, 24);
contentPanel.add(progressBar);
label = new JLabel("0%");
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setBounds(10, 29, 330, 14);
contentPanel.add(label);
try {
installMods(getSelectedModPack());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}