Results 1 to 1 of 1
- 04-01-2012, 06:16 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 13
- Rep Power
- 0
screen saver ? Jgrasp message no main methods applets or midlets found
can anyone help me how to and where to put main method on here ?
is that the reason why Im getting this message ?
Java Code:import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.JFrame; import java.util.Random; public class saver extends JPanel implements ActionListener { private Random generator = new Random(); Timer t, x; int x1, y1, count; saver() { t = new Timer(1000,this); t.setInitialDelay(1000); t.setDelay(1000); t.start(); } public void paintComponent(Graphics screen) { super.paintComponent(screen); Graphics2D screen2d = (Graphics2D)screen; screen.setColor(Color.black); screen.fillRect(0, 0, getWidth(), getHeight()); int rd, grn, bl, shape, count; for(int i = 20; i > 0; i--) { shape = generator.nextInt(12); if(shape == 0) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillArc(x1, y1, 100, 100, 360, 180); } if(shape == 1) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillRect(x1, y1, 100, 100); } if(shape == 2) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillOval(x1, y1, 100, 100); } if(shape == 3) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillRoundRect(x1, y1, 100, 100, 50, 50); } if(shape == 4) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillArc(x1, y1, 100, 100, 90, 180); } if(shape == 5) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillArc(x1, y1, 100, 100, 180, 180); } if(shape == 6) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillArc(x1, y1, 100, 100, 270, 180); } if(shape == 7) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillRect(x1, y1, 200, 200); } if(shape == 8) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillRect(x1, y1, 300, 100); } if(shape == 9) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillRect(x1, y1, 100, 300); } if(shape == 10) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillOval(x1, y1, 300, 100); } if(shape == 11) { rd = (int) (Math.random()*255); grn = (int)(Math.random()*255); bl = (int) (Math.random()*255); screen.setColor(new Color(rd,grn,bl,255)); x1 = (int)(Math.random()*getWidth()); y1 = (int)(Math.random()*getHeight()); screen.fillOval(x1, y1, 100, 300); } } } public void actionPerformed(ActionEvent e) { repaint(); } }
Similar Threads
-
-jGRASP wedge2 error: command "javac" not found.
By ncneeds in forum New To JavaReplies: 0Last Post: 09-28-2011, 09:21 PM -
Applet compiles and tests fine in jGrasp... blank white screen when placed into HTML
By AlphaWhelp in forum Java AppletsReplies: 6Last Post: 07-01-2011, 03:20 AM -
Displaying error message if no text found
By jdg951 in forum New To JavaReplies: 3Last Post: 01-17-2011, 10:52 PM -
Main Class not found
By Draugnar in forum New To JavaReplies: 3Last Post: 01-09-2010, 03:12 AM -
main class not found
By abhijit in forum NetworkingReplies: 3Last Post: 10-01-2009, 09:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks