JFrame背风景设置.docVIP

  • 2
  • 0
  • 约2.72万字
  • 约 5页
  • 2017-05-25 发布于河南
  • 举报
JFrame背风景设置

在Java的GUI设计中,Frame和JFrame两者之间有很大差别, 如果不认真会有不必要的麻烦,例如GUI背景色的添加为例: import java.lang.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MainWindows extends JFrame{ ??private MainWindows ContentPane; ? ? public MainWindows(){ ??this.setLayout(null); ??this.setTitle(题库抽题系统); ??this.setBounds(0,0,800,600); ??this.setBackground(Color.RED);//改成this.getContentPane().setBackground(Color.RED);即可 ? this.addWindowListener( new WindowAdapter(){ ???? public void windowClosing(WindowEvent e){ ??????? System.exit(0); ???? }); ? } ??this.setVisible(true); ??ContentPane=this; ???

文档评论(0)

1亿VIP精品文档

相关文档