1

Sea-Glass Look and Feelを使用してJFrameの背景に変更する適切な方法は何ですか?これまでのところ、両方を試しました:

frame.getContentPane().setBackground(Color.blue);

JPanel x = new JPanel();
x.setBackground(Color.red);
frame.setContentPane(x);

しかし、それは何の効果もありませんでした:

import javax.swing.*;
import com.seaglasslookandfeel.*;
import java.awt.*;
import java.awt.Color.*; 
public class BORDER_TEST {
public static void main(String[] a){

        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {

                    UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
                    JFrame frame = new JFrame();
                    JPanel x = new JPanel();
                    x.setBackground(Color.red);
                    frame.setContentPane(x);

                    //frame.getContentPane().setBackground(Color.blue);
                    frame.setPreferredSize(new Dimension(900,350));
                    frame.setAlwaysOnTop(true);
                    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
                    } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }    

}

4

1 に答える 1

2

Seaglass Look and Feelはに基づいておりNimbus、組み込みのテーマを受け入れるか、プログラムでニンバスの色を設定する必要があります

于 2012-03-26T07:21:07.007 に答える