MUHAKEME.NET FORUMU > Webmasterlar > Pc-Internet-Msn-Gsm > Programlar > Java > JAVA'da DXBall Uygulaması

JAVA'da DXBall Uygulaması

Java icinde JAVA'da DXBall Uygulaması konusu , DxBall uygulaması Kucuk bir calisma bir bolumluk import java.awt.*; import java.awt.event.*; public class DXBall extends Frame implements KeyListener { Button b; Panel p; static int x,y,w,h; static DXBall d; DXBall(){ ...

Yeni Konu aç  Cevapla
 
Seçenekler Stil
Alt 01-29-2008, 23:33   #1
Moderator

 
oguzhan - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Jan 2008
Yaş: 21
Mesajlar: 918
Tesekkür etti: 573
288 Mesajına 433 tesekkür aldı
Blog Başlıkları: 1
Tecrübe Puanı: 58 oguzhan has much to be proud of
oguzhan has much to be proud ofoguzhan has much to be proud ofoguzhan has much to be proud ofoguzhan has much to be proud ofoguzhan has much to be proud of

Ruh Hali:
JAVA'da DXBall Uygulaması

DxBall uygulaması


Kucuk bir calisma bir bolumluk


import java.awt.*;
import java.awt.event.*;

public class DXBall extends Frame implements KeyListener {
Button b;
Panel p;
static int x,y,w,h;
static DXBall d;
DXBall(){
this.setTitle("JAVABALL");
this.setSize(400,400);
x=200;y=370; w=100; h=15;
this.setLayout(null);
b=new Button("\t\t\t\t\t\t\t");
b.setEnabled(false);

b.setBounds(x,y,w,h);
this.add(b);
new Stone(this);
this.addKeyListener(this);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
this.setVisible(true);
new Top(d,this.getGraphics());

}
public void keyTyped(KeyEvent ke){
}
public void keyPressed(KeyEvent ke){

if (KeyEvent.VK_LEFT==ke.getKeyCode()){
x=x-4;
b.setBounds(x,y,w,h);

}
if (KeyEvent.VK_RIGHT==ke.getKeyCode()){
x=x+4;
b.setBounds(x,y,w,h);

}

}
public void keyReleased(KeyEvent ke){
}
public static void main(String[] args){
d=new DXBall();

}

}
class Top extends Thread {
static DXBall b;
static Graphics g;
static int x,y,w,h,dx,dy;
Stone s;
Thread t;
int oldy;
boolean durdur=false;
Top(DXBall a,Graphics g){
this.b=a;
this.g=g;
x=250;y=370;w=10;h=10;
dx=6;
dy=3;

this.start();
draw();
}
public void draw(){
g.setColor(Color.black);
g.fillOval(x,y,w,h);

}
public void run(){
try {
while(true){
move();
Thread.sleep(1);


vur(x,y);
this.sleep(2);

}
}
catch (InterruptedException ex) {
System.out.println ("Problem var!!");
}

}
public void move(){
try {
g.fillOval(x,y,w,h);
Thread.sleep(15);
g.clearRect(0,0,(int)Toolkit.getDefaultToolkit().g etScreenSize().getWidth(),(int)Toolkit.getDefaultT oolkit().getScreenSize().getHeight());
if (x<10){
x=10; dx=-dx;
}
if (x+dx>400){
x=390; dx=-dx;
}
if (y<10){
y=10; dy=-dy;}
if ((y+dy)>(b.y-15)){
if (((x-b.x)<90) && (x-b.x>0)) {
y=b.y-20; dy=-dy;
}else this.destroy();
}



x=x+dx;
y=y+dy;
}
catch (Exception ex) {}
}
public void vur(int x,int y){
for (int i = 0; i<5; i++) {
for (int j = 0; j<5; j++) {
if (s.stone[i][j].getBounds().contains(x,y) && s.stone[i][j].isVisible()){

s.stone[i][j].setVisible(false);
dx=-dx;
dy=-dy;
}
}
}
}

}
class Stone{
static Button[][] stone;
static int x,y,w,h;
static DXBall a;
static int siray[]=new int[5];
Stone(DXBall d){
this.a=d;
stone=new Button[5][5];
x=0;
y=40;
w=80;
h=20;
for(int j=0;j<5;j++)
for(int i=0;i<5;i++){
stone[j][i]=new Button("\t\t\t\t");
stone[j][i].setBackground(Color.blue);
stone[j][i].setEnabled(false);
stone[j][i].setBounds(x+80*i,y+20*j,w,h);
siray[i]=y+20*j;

d.add(stone[j][i]);



}
y=stone[4][1].getY();

}
}
__________________
__________________
FARK ETMELI: Ölüm dedigin üc gündür, dün geldi gecti yarin mechuldür, O halde Ömür dedigin 1 gündür o da BUGÜN dür...
oguzhan isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Alt 05-24-2008, 13:38   #2
Cok taze burda o

Avatar Seçmemiş
 
Üyelik tarihi: May 2008
Mesajlar: 10
Tesekkür etti: 0
0 Mesajına 0 tesekkür aldı
Tecrübe Puanı: 7 UAlincoln will become famous soon enoughUAlincoln will become famous soon enough

ellerine sağlık çok güzel
UAlincoln isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Cevapla

Bookmarks

Tags
javada, dxball, uygulamasi

Seçenekler
Stil

Yetkileriniz
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-KodlarıKapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Kapalı

MUHAKEME.net

Bütün Zaman Ayarları WEZ +2 olarak düzenlenmiştir. Şu Anki Saat: 04:18 .

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Tüm bağışıklıklar ve idelerden bağımsız olan sözcükleri sarfetmeye mahkumdur özgürlük

Muhakeme.net Adsense Gizlilik Politikası

Muhteva.com Religion Blogs - Blog Top Sites Religion Religion Blogs
| İslamiyet | Siyaset | Almanca Eğitim | Müzikler | Sanat Kültür | Kişisel Gelişim | Sesli Kütüphane |
Sayfa 0.12325 saniyede 12 query kullanılarak yaratıldı.