http://www.docin.com/p-52563828.html


vincint810923 發表在 痞客邦 留言(0) 人氣()

比爾蓋茲在一所高中所發表的演說,提出學子們在學校學不到的十一件事

Rule 1.人生並不公平─你要適應它。
Rule 1: Life is not fair - get used to it! 

Rule 2. 這個世界並不在乎你的自尊,你想要對自己感到滿意,就得先成就些什麼事。
Rule 2:The world won't care about your self-esteem. The world will expect you to accomplish something BEFORE you feel good about yourself.

vincint810923 發表在 痞客邦 留言(0) 人氣()

//指針旋轉繪圖

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class zebra extends JFrame {
  int rx = 300, ry = 300; //旋轉中心點
  int crd = 133; //圓弧半徑
  int arcAng = 10; //圓弧角度
  int dAng = 0; //遞增角度
  int sumAng = 300; //總共旋轉角度,若設0為一直轉
  int startAng = 240; //起始角度
  int rAng = 1;//動畫間隔旋轉角度 順:負值 ,逆:正值
  boolean chk = false;
  int cx,cy;//圓弧中心點
  int cd = 10;//圓弧偏移旋轉中心點的距離
  int ww = 660, hh = 550;

 public static void main(String args[]){
    new zebra();
 }
 public zebra(){
   cx = (int)(Math.cos(startAng *(Math.PI / 180)) * (crd + cd));
   cy = (int)(Math.sin(startAng * (Math.PI / 180)) * (crd + cd) * -1);

   setTitle("Arc & Oval");
   setSize(ww,hh);
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setVisible(true);
   addMouseListener(new MouseAdapter(){
      public void mousePressed(MouseEvent e){
         chk = !chk;
         if (!chk) return;
         (new Thread(){
               public void run(){
                  while(chk){
                     dAng += rAng;
                     redraw();
                     if ((sumAng > 0) && (dAng % sumAng == 0)){
                         chk = false;
                     }
                     try{Thread.sleep(10);}catch(Exception e){}
                  }
               }
         }).start();
      }
   });

 }
 public void redraw(){
    repaint();
 }
 public void paint(Graphics g)
 {
   Graphics2D g2d = (Graphics2D)g;
   g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g2d.clearRect(0,0,ww,hh);

   g2d.translate(rx,ry);
   g2d.setColor(Color.red);
   g2d.fillOval(-5, -5, 10, 10);

   g2d.setColor(Color.blue);
   double rr = dAng * (Math.PI / 180);
   int cpx= (int)(cx * Math.cos(rr) + cy * Math.sin(rr));
   int cpy= (int)(cx * -1 * Math.sin(rr) + cy * Math.cos(rr));

   g2d.fillArc(cpx-crd,cpy-crd,crd * 2,crd * 2, dAng + startAng - 180 - (arcAng / 2) ,arcAng);

  }
}

此程式是以旋轉中心點為原點,抓角度-120距離133的點作為圓弧中心點
按滑鼠啟動,逆時針旋轉300度就會自動停止~大概是停在你要的位置 

vincint810923 發表在 痞客邦 留言(0) 人氣()

一個基本入門的介紹:

http://cysky.blog.hexun.com.tw/6387182_d.html

vincint810923 發表在 痞客邦 留言(0) 人氣()

在司庫歐這個地方,住著一個男人和他的孫子,只有兩個人…。這地方四周是一道環形的巨牆,它高四公里,有時候某些部份會自己長大成五公里,相當高的牆,男人和孫子插翅也難以飛離…。

他們靠這一個蘋果樹為生,每天長出兩顆蘋果,通常不多也不少而他們通常餓的連種子也一起吃了。

vincint810923 發表在 痞客邦 留言(0) 人氣()

 

如何從鍵盤讀值 並 output到command window上

vincint810923 發表在 痞客邦 留言(0) 人氣()

初學Java

 

vincint810923 發表在 痞客邦 留言(0) 人氣()