【发布时间】:2014-05-04 07:12:02
【问题描述】:
当我在 Netbeans 中选择“运行”时,我的 GUI 不显示。它只是在屏幕底部显示一个框,上面写着“构建成功”。
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package modelrange;
import javax.swing.DefaultBoundedRangeModel;
public class RangedModel extends javax.swing.JPanel {
DefaultBoundedRangeModel myModel;
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new RangedModel().setVisible(true);
}
});
}
/**
* Creates new form RangedModel
*/
public RangedModel() {
myModel = new DefaultBoundedRangeModel(123, 100, 0, 1000);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initComponents() {
This is just the automated netbeans code from the GUI builder (edited out for the post)
}
【问题讨论】:
-
您的
main方法中没有任何内容 -
我使用了我构建的另一个 GUI 中的 main 方法,但它仍然不显示