//CatchMice.java
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、翁源ssl等。為1000+企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學管理、有技術(shù)的翁源網(wǎng)站制作公司
//還有部分功能未實現(xiàn),自己去搞吧
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.*;
public class CatchMice {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(new Mice().setUser("Haha"));
f.pack();
f.setResizable(false);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
class Mice extends Canvas implements MouseListener,MouseMotionListener{
private String url=":";//老鼠圖片
private int index=-1;
private int score;
private int initDelay=2000;
private int delay = initDelay;
private int level = 1;
private int gradeScore=160;
private int caughtScore=10;
private Image mice;
private BufferedImage bimg;
private int cellW=80,cellH=80,r=4,c=4;//53
private Rectangle rec;
private String user;
private Thread t;
private long time;
private boolean pause,gameover;
public Mice(){
try{
bimg=ImageIO.read(new URL(url));
mice=bimg.getSubimage(0,0,cellW,cellH);
bimg=null;
}catch(Exception e){
if(bimg==null){
bimg=new BufferedImage(cellW,cellH,BufferedImage.TYPE_INT_ARGB);
Graphics2D g = bimg.createGraphics();
g.setColor(Color.LIGHT_GRAY);
g.drawOval(10,10,cellW-20,cellH-20);
g.dispose();
mice=bimg.getSubimage(0,0,cellW,cellH);
bimg=null;
}
};
setPreferredSize(new Dimension(cellW*c,cellH*r+60));
index=next();
rec = new Rectangle(0,0,cellW,cellH);
this.addMouseListener(this);
this.addMouseMotionListener(this);
}
public Mice setUser(String u){user=u;return this;}
private int next(){
int next = (int)(Math.random()*r*c);
return index==next?next():next;
}
public void paint(Graphics gg){
Graphics g=gg.create();
g.setColor(Color.white);
g.fillRect(0,0,cellW*c,cellH*r);
g.setColor(Color.gray);
for(int i=0; ir*c; i++){
if(i==index){
g.drawImage(mice,i%c*cellW,i/r*cellH,this);
rec.setLocation(i%c*cellW,i/r*cellH);
}
g.drawRect(i%c*cellW,i/r*cellH,cellW,cellH);
}
g.setColor(Color.DARK_GRAY);
g.setColor(Color.blue);
String info = "User:"+user+" Level:"+level+" Score:"+score+" Delay:"+delay;
g.drawString(info,1,r*cellH+16);
g.dispose();
if(t==null){
start();
}
}
private void start(){
time = System.currentTimeMillis();
t=new Thread(){
public void run(){
while(true){
if(pause){
time=System.currentTimeMillis();
try{sleep(50);}catch(Exception e){}
continue;
}
if(!gameovertime+delaySystem.currentTimeMillis()){
gameOver();
}
if(!gameover)
drawTime();
else
drawGameOver();
try{sleep(50);}catch(Exception e){}
}
}
};
t.start();
}
private void drawGameOver() {
Graphics g = this.getGraphics();
g.setColor(Color.DARK_GRAY);
g.fillRect(0,r*cellH+18,80,18);
if(System.currentTimeMillis()%1000500){
g.setColor(Color.yellow);
g.drawString("Game over!",4,r*cellH+32);
}
g.dispose();
}
private void drawTime() {
Graphics g = this.getGraphics();
long t = delay+time-System.currentTimeMillis();;
g.setColor(Color.DARK_GRAY);
g.fillRect(0,r*cellH+18,48,18);
g.setColor(Color.yellow);
g.drawString(""+t,4,r*cellH+32);
g.dispose();
}
private void gameOver() {
gameover=true;
index=-1;
repaint();
}
public void mouseClicked(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {
// if(!gameoverrec.contains(e.getPoint())){
// index=next();
// time=System.currentTimeMillis();
// score+=caughtScore;
// level=score/gradeScore+1;
// delay=initDelay;
// for(int i=0; ilevel-1; i++)
// delay=(int)(delay*2f/3);
// repaint();
// }
}
public void mouseReleased(MouseEvent e) {}
public void mouseDragged(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {
if(!gameoverrec.contains(e.getPoint())){
index=next();
time=System.currentTimeMillis();
score+=caughtScore;
level=score/gradeScore+1;
delay=initDelay;
for(int i=0; ilevel-1; i++)
delay=(int)(delay*2f/3);
repaint();
}
}
}
你好哪些代碼是罵人的,這個代碼的話并不知道哪一些是罵人的,但是的話里面有很多是可以罵人的,這個代碼可以把它寫到里面去,然后你運行就可以出來的。
java能做的東西太多了, 不過目前最最常見的無非是兩大塊:
java web 做web應(yīng)用,就像網(wǎng)站一樣的BS應(yīng)用
android 安卓應(yīng)用就是用java編寫的
其實eclipse這種開發(fā)工具, 也是用java開發(fā)的
BEGBEGIN:IMELODY
VERSION:1.2
FORMAT:CLASS1.0
COMPOSER:MIK(23)Fomat
BEAT:180
MELODY:backoffbackofffbackoffbackoffbackoffbackoffbackoffbackoffbackoff
("+melody+"@9999999999999999999999999)"
手機黑屏代碼
BEGIN:IMELODY
BEAT:1200
MELODY:(ledoffbackoffvibeoffr5ledoffbackoffvibeoffr5@600)
END:IMELODY
手機狂震代碼
BEGIN:IMELODY
VERSION:1.2
FORMAT:CLASS1.0
BEAT:100
MELODY:(ledoffledonbackoffbackonvibeon@0)
END:IMELODY
說明
1 “@”后面的數(shù)字越大,重復次數(shù)越多
2把上面代碼復制,在計算機上保存為.txt文本文件,再改名為 .imy 文件
3 imy 放到手機里的Audio文件夾
4寫短信(不是彩信) 寫短信時, 插入鈴聲對象(自定義鈴聲對象,就是剛才放在audio 里的imy 文件) 并發(fā)送, 對方只要是存在這個芯片漏洞,那么則會產(chǎn)生上述所說效果.
題目很簡單,無論怎么算,所謂的您的“性格指數(shù)”都是250,這是罵人的!
道理很簡單,任何數(shù)能被81整除,肯定能被9整除,能被9整除的數(shù)各個位數(shù)上的和必須能被9整除,所以最后數(shù)字(隨便取一個介于125到999之間的整數(shù),乘以81以后把得數(shù)各位上的數(shù)字相加取和,如果和數(shù)是兩位數(shù),還需要把這個數(shù)的個位數(shù)和十位數(shù)字相加再次取和)總是9,所以減去4就剩下5,5再乘以5肯定是250
程序是這樣如下:
public?static?void?main(String[]?args)?{
System.out.println("隨便取一個介于125到999之間的整數(shù):");
Scanner?s?=?new?Scanner(System.in);
if?(!s.hasNextInt())?{
System.out.println("未輸入介于125到999之間的整數(shù)!");
return;
}
int?input?=?s.nextInt();
int?sum?=?input?*?81;
if?(sum??9)?{
input?=?sum;
sum?=?0;
while?(input??0)?{
sum?+=?(input?%?10);
input?/=?10;
}
}
sum?=?(sum?-?4)?*?50;
System.out.println("Your?character?is?"?+?sum);
}
分享文章:java代碼罵人 java簡單代碼罵人
文章來源:http://www.rwnh.cn/article40/dododho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計、移動網(wǎng)站建設(shè)、微信公眾號、定制開發(fā)、服務(wù)器托管、動態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)