qq_33607098 2017-11-14 03:22 采纳率: 0%
浏览 1864

windowbuilder新建项目时出现错误,求各位大神指点迷津

错误内容如下The selected wizard could not be started.
Plug-in org.eclipse.wb.swing was unable to load class org.eclipse.wb.internal.swing.wizards.application.NewSwingApplicationWizard.
An error occurred while automatically activating bundle org.eclipse.wb.swing (482).

  • 写回答

1条回答 默认 最新

  • 无明之徒 2018-08-28 09:42
    关注

    package swing;

    import java.awt.EventQueue;

    import javax.swing.JFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JPasswordField;

    import java.awt.SystemColor;

    import javax.swing.JButton;
    import javax.swing.LayoutStyle.ComponentPlacement;

    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.Font;

    public class LogIn {

    private JFrame frame;
    private JTextField textField;
    private JPasswordField passwordField;
    /*adminclass a1 = new adminclass("123", 666666);
    salerclass s1 = new salerclass(001, 666666, 0, 0);
    salerclass s2 = new salerclass(002, 666666, 0, 0);
    salerclass s3 = new salerclass(003, 666666, 0, 0);
    salerclass s4 = new salerclass(004, 666666, 0, 0);
    salerclass s5 = new salerclass(005, 666666, 0, 0);*/
    
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    LogIn window = new LogIn();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    
    /**
     * Create the application.
     */
    public LogIn() {
        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);
    
        JTextArea textArea = new JTextArea();
        textArea.setFont(new Font("新宋体", Font.BOLD, 18));
        textArea.setBackground(SystemColor.control);
        textArea.setText("\u82F9\u679C\u9500\u552E\u7BA1\u7406\u8F6F\u4EF6");
    
        JTextArea textArea_1 = new JTextArea();
        textArea_1.setFont(new Font("新宋体", Font.PLAIN, 13));
        textArea_1.setBackground(SystemColor.control);
        textArea_1.setText("\u7528\u6237\u540D\uFF1A");
    
        JTextArea textArea_2 = new JTextArea();
        textArea_2.setFont(new Font("新宋体", Font.PLAIN, 13));
        textArea_2.setBackground(SystemColor.control);
        textArea_2.setText("\u5BC6\u7801\uFF1A");
    
        textField = new JTextField();
        textField.setColumns(10);
    
        passwordField = new JPasswordField();
    
        JButton button = new JButton("\u767B\u5F55");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                System.out.println("chenggong");
    
                admin ai = new admin();
                frame.dispose();//看这里,一点建议,建议你还是手写,看API,这个生成的真心不怎么好,还有建议把frame封装构造方法中
    
            }
        });
    
        JButton button_1 = new JButton("\u6E05\u7A7A");
        button_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                textField.setText(null);
                passwordField.setText(null);
            }
        });
        GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
        groupLayout
                .setHorizontalGroup(groupLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(
                                groupLayout
                                        .createSequentialGroup()
                                        .addGroup(
                                                groupLayout
                                                        .createParallelGroup(
                                                                Alignment.LEADING)
                                                        .addGroup(
                                                                groupLayout
                                                                        .createSequentialGroup()
                                                                        .addGap(114)
                                                                        .addComponent(
                                                                                textArea,
                                                                                GroupLayout.PREFERRED_SIZE,
                                                                                186,
                                                                                GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(
                                                                groupLayout
                                                                        .createSequentialGroup()
                                                                        .addGap(57)
                                                                        .addGroup(
                                                                                groupLayout
                                                                                        .createParallelGroup(
                                                                                                Alignment.TRAILING,
                                                                                                false)
                                                                                        .addComponent(
                                                                                                textArea_2,
                                                                                                Alignment.LEADING)
                                                                                        .addComponent(
                                                                                                textArea_1,
                                                                                                Alignment.LEADING,
                                                                                                GroupLayout.DEFAULT_SIZE,
                                                                                                80,
                                                                                                Short.MAX_VALUE))
                                                                        .addGap(53)
                                                                        .addGroup(
                                                                                groupLayout
                                                                                        .createParallelGroup(
                                                                                                Alignment.LEADING)
                                                                                        .addComponent(
                                                                                                passwordField,
                                                                                                GroupLayout.PREFERRED_SIZE,
                                                                                                112,
                                                                                                GroupLayout.PREFERRED_SIZE)
                                                                                        .addComponent(
                                                                                                textField)))
                                                        .addGroup(
                                                                Alignment.TRAILING,
                                                                groupLayout
                                                                        .createSequentialGroup()
                                                                        .addContainerGap()
                                                                        .addComponent(
                                                                                button)
                                                                        .addGap(18)
                                                                        .addComponent(
                                                                                button_1)))
                                        .addContainerGap(130, Short.MAX_VALUE)));
        groupLayout
                .setVerticalGroup(groupLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(
                                groupLayout
                                        .createSequentialGroup()
                                        .addGap(31)
                                        .addComponent(textArea,
                                                GroupLayout.PREFERRED_SIZE, 31,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGap(18)
                                        .addGroup(
                                                groupLayout
                                                        .createParallelGroup(
                                                                Alignment.BASELINE)
                                                        .addComponent(
                                                                textArea_1,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(
                                                                textField,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE))
                                        .addGap(33)
                                        .addGroup(
                                                groupLayout
                                                        .createParallelGroup(
                                                                Alignment.BASELINE)
                                                        .addComponent(
                                                                textArea_2,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                26,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(
                                                                passwordField,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                25,
                                                                GroupLayout.PREFERRED_SIZE))
                                        .addGap(18)
                                        .addGroup(
                                                groupLayout
                                                        .createParallelGroup(
                                                                Alignment.BASELINE)
                                                        .addComponent(button_1)
                                                        .addComponent(button))
                                        .addContainerGap(45, Short.MAX_VALUE)));
        frame.getContentPane().setLayout(groupLayout);
    }
    

    }

    评论

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥15 如何修改pca中的feature函数
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况