/**
 * 画板
 * 
 * @time 3:38:10 PM
 * @author retacn yue
 * @Email zhenhuayue@sina.com
 */
public class Test_FrameWithPanel extends Frame {


private static final long serialVersionUID = 1L;


private Test_FrameWithPanel(String str) {
super(str);
}


public static void main(String[] args) {
// 初始化窗口(帧)
Test_FrameWithPanel frameWithPanel = new Test_FrameWithPanel("Frame with Panel");


// 生成画板
Panel panel = new Panel();
// 设置窗体大小
frameWithPanel.setSize(400, 300);


frameWithPanel.setLayout(null);
// 设置画板的大小
panel.setSize(200, 150);
// 设置画板颜色
panel.setBackground(Color.white);
// 设置窗体背景颜色
frameWithPanel.setBackground(Color.black);
// 设置窗体布局


frameWithPanel.add(panel);
frameWithPanel.setVisible(true);


}
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-11-18
  • 2021-06-04
  • 2021-12-27
  • 2021-08-06
猜你喜欢
  • 2022-12-23
  • 2022-02-11
  • 2021-05-04
  • 2021-10-26
  • 2022-12-23
  • 2021-05-22
  • 2021-07-07
相关资源
相似解决方案