[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Messages posted by: anotsu
Forum Index » Profile for anotsu » Messages posted by anotsu
Author Message
i don't know what is wrong with my applet but it seems that it is not working

can you help me fix the problem please?

i didnt implement the applet into a html file yet

the applet is a ball that is bouncing and we can choose if we want to see it with its trails or with fading trail

thank you very much





I would like to change this screensaver that draw multiple lines in different and color in different positions, to a screensaver that put a picture (let's call it pict01) in the screensaver and change its position.
but i am new in java, can somebody help me

file number 1----->saver1.java

import javax.swing.JFrame;

public class Saver1
{
public static void main( String args[] )
{
// create frame for Saver1JPanel
JFrame frame = new JFrame( "Saver1" );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

Saver1JPanel saver1JPanel = new Saver1JPanel();
frame.add( saver1JPanel ); // add saver1JPanel to frame
frame.setSize( 300, 300 ); // set frame size
frame.setVisible( true ); // display frame
} // end main
}



file number 2-------->Saver1JPanel

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;

public class Saver1JPanel extends JPanel
{
private final int DELAY = 9999999;

// draw lines
public void paintComponent( Graphics g )
{
super.paintComponent( g ); // call superclass's paintComponent

int x, y, x1, y1;

// draw 100 random lines
for ( int i = 0; i < 100; i++ )
{
x = ( int ) ( Math.random() * 300 );
y = ( int ) ( Math.random() * 300 );
x1 = ( int ) ( Math.random() * 300 );
y1 = ( int ) ( Math.random() * 300 );

g.setColor( new Color( ( float ) Math.random(),
( float ) Math.random(), ( float ) Math.random() ) );
g.drawLine( x, y, x1, y1 );

// slow the drawing down. the body of the for loop is empty
for ( int q = 1; q < DELAY; q++ ) ;
} // end outer for

repaint(); // repaint component
} // end method paintComponent
}


thank you
 
Forum Index » Profile for anotsu » Messages posted by anotsu
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle