1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      java中模擬風(fēng)扇的代碼 模擬風(fēng)扇控制系統(tǒng)原理圖

      用java做個(gè)風(fēng)扇,求幫助

      import java.awt.event.ActionEvent;

      目前創(chuàng)新互聯(lián)已為千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、綏芬河網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

      import java.awt.event.ActionListener;

      import javax.swing.*;

      import javax.swing.event.ChangeEvent;

      import java.awt.*;

      import java.awt.geom.*;

      import java.awt.event.*;

      import java.applet.AudioClip;

      public class Fan extends JFrame implements ActionListener{

      static int time=1;

      static int ti;

      Timer time_1 = new Timer(100,this);

      x1 x=new x1() ;

      static TransPane jp;

      JButton add=new JButton("加速");

      JButton stop=new JButton("暫停/開始");

      JButton low=new JButton("減速");

      JButton dingshi=new JButton("定時(shí)1分鐘");

      JTextField TextIn = new JTextField("100");

      JPanel p=new JPanel();

      public Fan(){

      super("旋銷友宏轉(zhuǎn)");

      add(jp);

      p.setLayout(new FlowLayout(FlowLayout.CENTER,30,30));

      p.add(add);

      p.add(stop);

      p.add(low);

      p.add(dingshi);

      add(p,BorderLayout.SOUTH);

      add.addActionListener(new ButtonHandler());

      low.addActionListener(new ButtonHandler());

      stop.addActionListener(new ButtonHandler());

      dingshi.addActionListener(new ButtonHandler());

      time_1=new Timer(1,x);

      time_1.start();

      }

      class ButtonHandler implements ActionListener{

      public void actionPerformed(ActionEvent e) {

      // TODO Auto-generated method stub

      if(e.getSource()==add){

      if(time=0)

      time++;

      else if(time告凳0)

      time--;

      }else if(e.getSource()==low){

      if(time0)

      time--;

      else if(time虧冊(cè)0)

      time++;

      }else if(e.getSource()==stop){

      if(time!=0){

      ti=time;

      time=0;}

      else

      time=ti;

      }

      else if(e.getSource()==dingshi){

      if(time!=1){

      ti=time;

      time=1;}

      else time++;

      }

      }

      }

      public static void main(String[] args){

      jp=new TransPane();

      Fan tran=new Fan();

      tran.setSize(250,300);

      tran.setVisible(true);

      tran.pack();

      }

      public void actionPerformed(ActionEvent arg0) {

      }

      class x1 implements ActionListener{

      public void actionPerformed(ActionEvent e){

      TransPane t1=new TransPane();

      jp.i+=time;

      jp.repaint();

      }

      }

      }

      class TransPane extends JPanel{

      int i=0;

      protected void paintComponent(Graphics g){

      super.paintComponent(g);

      Graphics2D g2d=(Graphics2D) g;

      int xCenter=getWidth()/2;

      int yCenter=getHeight()/2;

      int radius=(int)(Math.min(getWidth(),getHeight()*0.4));

      int x=xCenter-radius;

      int y=yCenter-radius;

      AffineTransform trans=new AffineTransform();

      g2d.fillArc(x,y,2*radius,2*radius,i,30); g2d.setColor(Color.red);

      g2d.fillArc(x,y,2*radius,2*radius,i+60,30); g2d.setColor(Color.yellow);

      g2d.fillArc(x,y,2*radius,2*radius,i+120,30); g2d.setColor(Color.green);

      g2d.fillArc(x,y,2*radius,2*radius,i+180,30); g2d.setColor(Color.gray);

      g2d.fillArc(x,y,2*radius,2*radius,i+240,30); g2d.setColor(Color.blue);

      g2d.fillArc(x,y,2*radius,2*radius,i+300,30); g2d.setColor(Color.black);

      }

      JAVA一道題,有個(gè)小問題。

      這涉及到作用域的問題,還有成員變量和類變量的問題。你定義的SLOW應(yīng)該用static修飾,并應(yīng)該是虛或李public的。如public static final int SLOW = 1;這樣定義就ok了。引用的時(shí)候,用Fan.SLOW引團(tuán)判用此變量差遲


      網(wǎng)站題目:java中模擬風(fēng)扇的代碼 模擬風(fēng)扇控制系統(tǒng)原理圖
      文章分享:http://ef60e0e.cn/article/dspgpod.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        故城县| 内乡县| 嘉义市| 保定市| 清水县| 德钦县| 尉氏县| 威宁| 岳池县| 娄底市| 肥东县| 湛江市| 丹阳市| 诏安县| 鄂尔多斯市| 长丰县| 包头市| 利川市| 河东区| 焦作市| 南陵县| 安吉县| 宜昌市| 湄潭县| 北辰区| 确山县| 绥化市| 富裕县| 简阳市| 洞口县| 扶风县| 鸡泽县| 牙克石市| 湄潭县| 台东县| 镇赉县| 鄄城县| 克东县| 博野县| 城固县| 靖西县|