简体   繁体   中英

Java swing Header & Footer background color

在此处输入图片说明 Is there any way to set Header and Footer in Java Swing?

Actually I am using theme in my application and I have set fixed background color for all panels. But now the work is to set different background color of Header and Footer panel. Can you give me any suggestion?

Thanks in advance..

Header and Footer are probably just JPanel s, so you can do setBackground(Color.YELLOW) or such. As you probably have several header and footes (seeing those tabs), you could make a single class:

public class HeaderOrFooter extends JPanel {
    private static final Color bg = new Color(0xFFFF66);
    public HeaderOrFooter() {
       setBackground(bg);
    }
}

You can even use a http://docs.oracle.com/javase/6/docs/api/java/awt/SystemColor.html (for theming), like SystemColor.info .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM