java.lang.IllegalArgumentException:Container必须为非null

时间:2018-04-14 17:47:39

标签: java eclipse grouplayout

以下错误无处不在。我试图检查空值但找不到它。所有变量都设置为全局私有变量。有谁知道错误是什么?

 GroupLayout gl_pnlIntroToQuiz = new GroupLayout(pnlIntroToQuiz);
    gl_pnlIntroToQuiz.setHorizontalGroup(
        gl_pnlIntroToQuiz.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_pnlIntroToQuiz.createSequentialGroup()
                .addGap(171)
                .addComponent(txtAreaIntro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addContainerGap(192, Short.MAX_VALUE))
            .addGroup(Alignment.TRAILING, gl_pnlIntroToQuiz.createSequentialGroup()
                .addContainerGap(602, Short.MAX_VALUE)
                .addComponent(btnBeginQuiz)
                .addContainerGap())
    );
    gl_pnlIntroToQuiz.setVerticalGroup(
        gl_pnlIntroToQuiz.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_pnlIntroToQuiz.createSequentialGroup()
                .addGap(93)
                .addComponent(txtAreaIntro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED, 121, Short.MAX_VALUE)
                .addComponent(btnBeginQuiz)
                .addContainerGap())
    );
    pnlIntroToQuiz.setLayout(gl_pnlIntroToQuiz);

给出的错误低于

java.lang.IllegalArgumentException: Container must be non-null
at javax.swing.GroupLayout.<init>(Unknown Source)
at IT_IA_Quiz.views.quizPsychology2.<init>(quizPsychology2.java:282)
at IT_IA_Quiz.views.quizPsychology2$1.run(quizPsychology2.java:59)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

提前感谢您的帮助!

0 个答案:

没有答案