我eclipse新建了一个frame,然后为什么他的design 啥都没有呢
应该是有东西的,你这是第一次吗?你下载windowbuilder插件后,eclipse-->help-->Install New Software打开:
Name:随便写一个名字,最好是见名知意,如:windowbuilder
Locatioin:就是写根据eclipse版本获取的http栏中的地址,然后重启eclipse
通过windowbuilder创建java项目
添加jar包:DJNativeSwing-1.0.0.jar、DJNativeSwing-SWT-1.0.0.jar、org.eclipse.swt.win32.win32.x86_64-4.3.jar
通过windowbuilder创建java实体类:new--->other 。。。。。。。。。。。。。
这些上面这些步骤你是不是少了什么,尤其是安装后重启和导入依赖
package view;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class LoginFrame extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginFrame frame = new LoginFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public LoginFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
}
}
这是新建之后自行出现的代码。