亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請教paintComponents()和paint()方法的區別

請教paintComponents()和paint()方法的區別

月亮島Superman 2017-06-03 00:31:05
public class TankClient extends Frame { public void paintComponents(Graphics g) { Color c = g.getColor(); g.setColor(Color.RED); g.fillOval(50, 50, 30, 30); g.setColor(c); } public void lauchFrame() { this.setBounds(80, 80, 800, 600); this.setVisible(true); this.setResizable(false); this.setTitle("TankWar"); this.setBackground(Color.GREEN); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); }}); } public static void main(String[] args) { new TankClient().lauchFrame(); }}請教下paintComponents()方法和paint()方法的區別在這個程序中使用paintComponents 劃不出來圓 ? 但是用paint()方法就可以這是為什么?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1677 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號