Re: Java MouseMotionListener
Sorry, the screensaver test class shouldn't implement mouselistener. i was uploading the working code.
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseEvent;
public class ScreensaverTest implements MouseMotionListener
{
// execute application
public static void main( String[] args )
{
// create frame for ScreensaverJPanel
MouseMotionListener e = new MouseMotionListener();
JFrame frame =
new JFrame();
frame.setUndecorated( true );
frame.setVisible( true ); // display frame
frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
Screensaver screensaver =
new Screensaver();
screensaver.setBackground( Color.BLACK );
frame.add( screensaver ); // add panel to frame
// set frame size
}
} // end main
// end class Screensaver
Re: Java MouseMotionListener
once again sorry, forgot to edit it.
Code:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
public class ScreensaverTest
{
// execute application
public static void main( String[] args )
{
// create frame for ScreensaverJPanel
JFrame frame =
new JFrame();
frame.setUndecorated( true );
frame.setVisible( true ); // display frame
frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
Screensaver screensaver =
new Screensaver();
screensaver.setBackground( Color.BLACK );
frame.add( screensaver ); // add panel to frame
// set frame size
}
} // end main
// end class Screensaver
Re: Java MouseMotionListener
Quote:
I have set the screen to not display the JFrame
If the JFrame is not displayed, what is shown?
If there is nothing visible, can the program receive any GUI type events?
What are the three versions of ScreensaverTest for? Which one is to be used for testing?
How do you compile and execute the program?
Re: Java MouseMotionListener
Please make a single program the compiles, executes and show the problem. Your posted code does not compile.
Also be sure to use proper indentation. Do NOT have all the statements start in the first column. Indent the statements to reflect the logic/nesting levels.