为 JFrame 设置背景颜色 [英] Setting background color for a JFrame
本文介绍了为 JFrame 设置背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你如何为 JFrame 设置背景颜色?
Just how do you set the background color for a JFrame?
推荐答案
检索框架的内容窗格并使用 setBackground() 方法继承自 Component 改变颜色.
Retrieve the content pane for the frame and use the setBackground() method inherited from Component to change the color.
示例:
myJFrame.getContentPane().setBackground( desiredColor );
这篇关于为 JFrame 设置背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文