Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Screensaver with Java 2 Big Problems

Reply
Thread Tools

Screensaver with Java 2 Big Problems

 
 
hagemann.k@googlemail.com
Guest
Posts: n/a
 
      06-13-2007
hello everybody,

i have 2 big problems. i want to code a screensaver with java a very
simple one, but i don't have so much experience with java. the
programm code is from many sites on the internet. but it doesen't
work. Can you look over this and correct it for me, please. or tell me
how i can fix the problems? please it is very important for me.

import java.awt.*;
import java.awt.event.*;
import java.awt.Graphics.*;
import java.awt.Image.*;

public class bildschirmschoner2 extends Window {

Image bild;

public static void main(String[] args) {

final bildschirmschoner schoner = new
bildschirmschoner();
schoner.setSize(schoner.getToolkit().getScreenSize ());
schoner.setVisible(true);
Component cp = schoner.getContentPane();
cp.setFocusable(true);
cp.requestFocusInWindow();
cp.addKeyListener(
new KeyAdapter() {
public void keyPressed(KeyEvent event)
{
schoner.setVisible(false);
schoner.dispose();
System.exit(0);
}
}
);

}

public bildschirmschoner2() {
super(new Frame());
setBackground(Color.black);
}

public void init() {

// Bild laden
bild = getImage(getCodeBase(), "bild.jpg");

}

public void paint(Graphics ausgabe) {

ausgabe.setColor(Color.white);
ausgabe.drawString("Mann eh wasn hhier los warum sieht
man das denn nicht",10,10);
ausgabe.drawImage(bild,20,40,this);

}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
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 On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net 0 12-26-2008 09:29 AM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net Web Controls 0 12-26-2008 06:11 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Python 0 12-24-2008 07:35 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Ruby 0 12-24-2008 05:07 AM
Big JARs = Big Problems? kk_oop@yahoo.com Java 11 09-18-2005 05:54 PM



Advertisments