Java Appletde Menu

kirpimusti

Uzman üye
21 Haz 2007
1,132
9
İst/Kayaşehr
Java Appletde grafik menu. HTML kodundaki parametreleri degistirerek ozellestire bilirsiniz

Kod:
import java.awt.*;
import java.applet.*;
import java.net.*;

public class MenuClassic2 extends Applet implements Runnable{
String items[] = new String[5];
Color clr[] = new Color[5];
Color clr_b[] = new Color[5];
URL url[] = new URL[5];
boolean act[] = new boolean[5];
int grad[] = new int[5];
Font font;
String fontname;
int fontsize = 15;
Thread delay;
int delaytime = 10;
Dimension d;
Image img;
Graphics gr;

public **** init() {
int i;
try {
// get font name
fontname = getParameter("fontname");
fontsize = Integer.parseInt(getParameter("fontsize"));
font = new Font(fontname, Font.BOLD, fontsize);
delaytime = Integer.parseInt(getParameter("delaytime"));

for(i = 0; i < 5; i++) {
items = getParameter("item" + String.valueOf(i));
url = new URL(getParameter("url" + String.valueOf(i)));
clr = new Color(Integer.parseInt(getParameter("color" + String.valueOf(i)), 16));
clr_b = new Color(Integer.parseInt(getParameter("backcolor" + String.valueOf(i)), 16));
}
} catch(MalformedURLException e) {
System.err.println("Invalid URL: " + e.getMessage());
}

d = getSize();
img = createImage(d.width, d.height);
gr = img.getGraphics();
gr.setColor(Color.white);
gr.fillRect(0, 0, d.width, d.height);

for(i=0; i<5; i++){
act = false;
grad = 255;
}
setBackground(Color.white);
}

public **** start() {
delay = new Thread(this);
delay.start();
}

public **** stop(){
delay = null;
}

public **** destroy() {
delay = null;
}

public **** run() {
int i;
while(true) {
try {
for(i=0; i<5; i++){
if(act && grad>1){
clr_b = new Color(grad--,grad--,255);
}else
if(!act && grad<255){
clr_b = new Color(grad++,255,grad++);
}
}
repaint();
Thread.sleep(delaytime);
}catch (InterruptedException ie){
stop();
}
}
}

public boolean mouseMove(Event evObj, int x, int y) {
int i;

showStatus("Moving at " + x + ", " + y);
setCursor(Cursor.getPredefinedCursor(12));

for(i=0; i<5; i++){
if(y>35+(i*30) && y<55+(i*30) && x>20 && x<120){
act = true;
clr = Color.red;
return true;
} else{
act = false;
clr = Color.blue;
}
}
return true;
}

public boolean mouseDown(Event evObj, int x, int y) {
int i;
showStatus("Mouse down at " + x + ", " + y);
for(i=0; i<5; i++){
if(y>35+(i*30) && y<55+(i*30) && x>20 && x<120){
getAppletContext().showDocument(url, "_blank");
return true;
}
}
return true;
}

public **** update(Graphics g) {
gr.setColor(Color.white);
gr.clearRect(0, 0, d.width, d.height);
gr.fillRect(0, 0, d.width, d.height);
paint(g);
}

public **** paint(Graphics g) {
int i;
gr.setFont(font);
for(i=0; i<5; i++){
gr.setColor(clr_b);
gr.fillRoundRect(20,i*30+30,140,30, 10, 10);

gr.setColor(clr);
gr.drawString(items, 30, 30*i+50);
}
g.drawImage(img, 0, 0, this);
}
}
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.