我尝试将其与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);
    }
}

最佳答案

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

07-26 09:06