JWindow没有出现

时间:2012-03-12 00:59:19

标签: java swing layout look-and-feel

当我尝试将其与SeaGlass Look and Feel一起使用时,我的JWindow根本没有显示,即使我将其设置为可见。

import java.awt.EventQueue;
import javax.swing.UIManager;
import javax.swing.*;
import com.seaglasslookandfeel.*;
public class SEAGLASS {

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    UIManager.setLookAndFeel(
                        "com.seaglasslookandfeel.SeaGlassLookAndFeel");

                    SEAGLASS demo = new SEAGLASS();
                  } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public SEAGLASS(){
        JWindow window = new JWindow();

        window.setVisible(true); //IT WAS NOT VISIBLE WHEN I RUN IT??//

        window.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
        JButton bu1 = new JButton("MY BUTTON");
        bu1.setBounds(100, 100, 120, 50);
        window.getContentPane().add(bu1);
        window.getContentPane().setLayout(null);
    }
}

1 个答案:

答案 0 :(得分:3)

    window.setSize(500,500); // set it to a non 0 size!