Screensaver with Java 2 Big Problems

Discussion in 'Java' started by hagemann.k@googlemail.com, Jun 13, 2007.

  1. Guest

    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);

    }
    }
     
    , Jun 13, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    11
    Views:
    719
    Roedy Green
    Sep 18, 2005
  2. Shaguf
    Replies:
    0
    Views:
    363
    Shaguf
    Dec 24, 2008
  3. Shaguf
    Replies:
    0
    Views:
    459
    Shaguf
    Dec 26, 2008
  4. Shaguf
    Replies:
    0
    Views:
    245
    Shaguf
    Dec 26, 2008
  5. Shaguf
    Replies:
    0
    Views:
    221
    Shaguf
    Dec 24, 2008
Loading...

Share This Page