簡體   English   中英

Java Swing在Jlabel中出現問題

[英]java swing getting issue in Jlabel

我正在用JAVA學習Swing。通過這種方式,我嘗試了簡單的標簽

package testswing;

import java.awt.EventQueue;
public class tt {

    private JFrame frame;

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

    /**
     * Create the application.
     */
    public tt() {
        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);

        JLabel Pragna = new JLabel("Lblll");
        frame.getContentPane().add(Pragna, BorderLayout.NORTH);
    }

}

我收到此錯誤

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at com.ibm.icu.text.BreakDictionary.main(BreakDictionary.java:44)

您正在運行BreakDictionary的主要方法。 換句話說:您正在運行一個完全不同的程序,而不是您發布的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM