gpt4 book ai didi

Java WindowsBuilder 应用程序编译时带有终止消息

转载 作者:行者123 更新时间:2023-12-02 13:40:36 24 4
gpt4 key购买 nike

我正在尝试在运行 8.121 JRE 的 Eclipse Neon 2 IDE 中编译代码(如下所示)。我已经创建了一个带有 Swing Designer 应用程序窗口的 SWT Designer 项目。当我运行程序时我没有看到空白应用程序,(但我看到我的测试控制台输出消息 Console Output)。我想知道是否有人可以告诉我我的 eclipse 软件发生了什么?我重新安装了软件,并尝试了许多其他解决方案。我已经做了几个小时的研究,但我仍然不明白为什么会发生这种情况? (旁注:我在想当我用 C++ 编码时,当我尝试制作我使用的控制台应用程序时,也会发生这种类型的错误 系统(“暂停”)解决这个问题)

package test;

import java.awt.EventQueue;

import javax.swing.JFrame;

public class test {

private JFrame frame;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
test window = new test();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public test() {
System.out.println("Test");
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

}

最佳答案

我遇到的问题是我创建了一个

WindowBuilder->SWT Designer->SWT/Jface

Java 项目。因此,当我编译应用程序窗口文件时,它没有显示该应用程序。

为了解决这个问题,我刚刚创建了一个普通的 Java 项目,并添加了应用程序窗口文件。因此,只需确保您的文件类型和项目类型对于程序编译而言是正确的。

关于Java WindowsBuilder 应用程序编译时带有终止消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42755202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com