0

在此处输入图像描述有没有办法在 Java Swing 中设置页眉和页脚?

实际上我在我的应用程序中使用主题,并且我为所有面板设置了固定的背景颜色。但现在的工作是为 Header 和 Footer 面板设置不同的背景颜色。你能给我什么建议吗?

提前致谢..

4

1 回答 1

1

Header and Footer are probably just JPanels, 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.

于 2012-01-24T05:37:23.743 回答