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屏保代碼 java刷屏代碼

      求助!java設(shè)計(jì)windows屏保問題!!

      說明屏幕保護(hù)是自動(dòng)切換的。可以調(diào)整下: 第一步:在桌面空白位置右擊,選擇“個(gè)性化”。 第二步:在個(gè)性化頁面,選擇“桌面背景”。 第三步:之后在“背景設(shè)置”頁面中,勾選上想設(shè)置背景的圖片(一張的話,不需要設(shè)置切換時(shí)間,多張的話,設(shè)置下切換...

      創(chuàng)新互聯(lián)專注于橫山網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供橫山營銷型網(wǎng)站建設(shè),橫山網(wǎng)站制作、橫山網(wǎng)頁設(shè)計(jì)、橫山網(wǎng)站官網(wǎng)定制、成都微信小程序服務(wù),打造橫山網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供橫山網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

      如何用java實(shí)現(xiàn)類似windows屏保

      看看這個(gè)試試!

      import java.text.*;

      import java.awt.*;

      import javax.swing.*;

      import java.awt.geom.*;

      import java.util.*;

      import java.awt.event.*;

      /**

      *

      *

      */

      public class ScreenTest extends JPanel implements Runnable{

      /** Creates a new instance of ScreenTest */

      private String time;

      private Rectangle2D rd;

      private int x,y,a,b;//座標(biāo)值和方向值

      private int rgb=0;//顏色的值

      private Color color;//字體的顏色

      private int width,height;//屏幕的大小

      public ScreenTest(int width,int height) {

      this.width=width;

      this.height=height;

      initWindow();

      }

      private void initWindow(){

      x=(int)(Math.random()*300);

      y=(int)(Math.random()*500);

      a=1;

      b=1;

      this.setBackground(Color.BLACK);

      this.setOpaque(true);

      rd=new Rectangle2D.Double(10,10,101,10);

      color=Color.YELLOW;

      }

      private void doColor(){

      rgb=(int)(Math.random()*0xFFFFFF);

      color=new Color(rgb);

      }

      public void paintComponent(Graphics g){

      g.setColor(Color.BLACK);

      g.fillRect(0,0,width,height);

      g.setColor(color);

      g.setFont(new Font("楷書",Font.BOLD,150));

      FontMetrics fm=g.getFontMetrics();

      rd=fm.getStringBounds(time,g);

      g.drawString(time,x,(int)(y+rd.getHeight()));

      }

      private void doTime(){

      Calendar cal=Calendar.getInstance();

      DateFormat df=DateFormat.getTimeInstance(DateFormat.MEDIUM);

      Date date=cal.getTime();

      time=df.format(date);

      x+=a;

      y+=b;

      double width1=rd.getWidth();

      double height1=rd.getHeight();

      rd.setRect(x,y,width1,height1);

      if(rd.intersectsLine(width,0,width,height)){

      doColor();

      a=-1;

      }

      else if(rd.intersectsLine(0,0,0,height)){

      doColor();

      a=1;

      }

      else if(rd.getY()=-80){

      doColor();

      b=1;

      }

      else if(rd.intersectsLine(0,height,width,height)){

      doColor();

      b=-1;

      }

      }

      public void run(){

      while(true){

      try{

      Thread.sleep(2);

      doTime();

      repaint();

      }

      catch(InterruptedException ie){

      ie.printStackTrace();

      }

      }

      }

      public static void main(String arsg[]){

      GraphicsDevice gd=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

      DisplayMode dm=gd.getDisplayMode();

      int width=dm.getWidth();

      int height=dm.getHeight();

      System.out.println("width="+width+"\nheight="+height);

      ScreenTest st=new ScreenTest(width,height);

      final JFrame jf=new JFrame();

      jf.getContentPane().add(st,BorderLayout.CENTER);

      jf.setUndecorated(true);

      gd.setFullScreenWindow(jf);

      new Thread(st).start();

      jf.addKeyListener(new KeyAdapter(){

      public void keyReleased(KeyEvent ke){

      if(ke.getKeyCode()==KeyEvent.VK_NUMPAD0)

      System.exit(0);

      }

      });

      }

      }

      求一個(gè)簡單的java屏保小程序,要求代碼簡單,易理解,要獨(dú)創(chuàng)的,沒有的,或者直接從網(wǎng)上蕩的,直接別來!

      protected void paint(Graphics g) {

      // TODO Auto-generated method stub

      g.setColor(255,0,0);

      g.fillRect(0, 0, this.getWidth(), this.getHeight());

      g.setColor(0,0, 255);

      g.fillArc(x,y,d,d,0,360);

      this.repaint();

      }//畫一個(gè)圓當(dāng)做屏保圖案坐標(biāo)是x,y 大小是d

      public void run() {

      // TODO Auto-generated method stub

      while(true){

      if(x=0){

      dir=ran.nextInt(8);

      while(dir==0||dir==3||dir==5)

      dir=ran.nextInt(8);

      }else if(y=0){

      dir=ran.nextInt(8);

      while(dir==0||dir==1||dir==2)

      dir=ran.nextInt(8);

      }else if(x=w){

      dir=ran.nextInt(8);

      while(dir==2||dir==4||dir==7)

      dir=ran.nextInt(8);

      }else if(y=h){

      dir=ran.nextInt(8);

      while(dir==5||dir==6||dir==7)

      dir=ran.nextInt(8);

      }

      switch(dir)

      {

      case 0: y-=5;x-=5; break;

      case 1: y-=5; break;

      case 2: y-=5;x+=5; break;

      case 3: x-=5; break;

      case 4: x+=5; break;

      case 5: y+=5;x-=5; break;

      case 6: y+=5; break;

      case 7: y+=5;x+=5; break;

      }

      try {

      Thread.currentThread().sleep(30);

      } catch (InterruptedException e) {

      // TODO Auto-generated catch block

      e.printStackTrace();

      }

      this.repaint();

      }

      //這個(gè)撞到墻壁小球就會(huì)隨機(jī)變換方向 達(dá)到屏保的效果

      給你個(gè)思路啊 自己填完整了他


      名稱欄目:java屏保代碼 java刷屏代碼
      網(wǎng)頁URL:http://www.ef60e0e.cn/article/dohsiec.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>

        鄂州市| 突泉县| 永城市| 聊城市| 综艺| 高邑县| 樟树市| 贵定县| 威宁| 和静县| 耒阳市| 江门市| 松潘县| 华安县| 农安县| 娱乐| 海伦市| 水富县| 土默特右旗| 南涧| 高阳县| 正阳县| 平果县| 塘沽区| 东台市| 建瓯市| 女性| 高平市| 云南省| 万全县| 峡江县| 昌江| 榆社县| 潜江市| 兴业县| 波密县| 宝鸡市| 镇远县| 高陵县| 马鞍山市| 巴东县|