设置JFrame的背景颜色 [英] Setting background color for the JFrame

查看:506
本文介绍了设置JFrame的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为JFrame设置背景颜色?

How to set a background color for a JFrame ?

推荐答案

检索框架的内容窗格并使用 setBackground()继承自组件的方法更改颜色。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆