Find the answer to your Linux question:
Results 1 to 4 of 4
while running a graphics program in linux with j2sdk i get a error message....can aneone help me...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15

    graphics with java in fedora 1


    while running a graphics program in linux with j2sdk i get a error message....can aneone help me

  2. #2
    Linux Engineer
    Join Date
    May 2003
    Location
    Greece / Athens
    Posts
    1,169
    it would be more helpful if you tell us what is the message that you get...
    Linux For Ever!

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15
    Code:
    import java.applet.*;
    import java.awt.*;
    
    public class Ballbewegung1 extends Applet implements Runnable
    {
    	// Initialisierung der Variablen
    	int x_pos = 10;		// x - Position des Balles
    	int y_pos = 100;	// y - Position des Balles
    	int radius = 20;	// Radius des Balles
    
    	public void init()
    	{
    		setBackground (Color.blue);
    	}
    
    	public void start ()
    	{
    		// Schaffen eines neuen Threads, in dem das Spiel läuft
    		Thread th = new Thread (this);
    		// Starten des Threads
    		th.start ();
    	}
    
    	public void stop()
    	{
    
    	}
    
    	public void destroy()
    	{
    
    	}
    
    	public void run ()
    	{
    		// Erniedrigen der ThreadPriority um zeichnen zu erleichtern
    		Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    
    		// Solange true ist läuft der Thread weiter
    		while (true)
    		{
    			// Verändern der x- Koordinate
    			x_pos ++;
    
    			// Neuzeichnen des Applets
    			repaint();
    
    			try
    			{
    				// Stoppen des Threads für in Klammern angegebene Millisekunden
    				Thread.sleep (20);
    			}
    			catch (InterruptedException ex)
    			{
    				// do nothing
    			}
    
    			// Zurücksetzen der ThreadPriority auf Maximalwert
    			Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    		}
    	}
    
    
    	public void paint (Graphics g)
    	{
    		g.setColor  (Color.red);
    
    		g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
    	}
    Exception in thread "main" java.lang.NoSuchMethodError: main

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer
    Join Date
    May 2003
    Location
    Greece / Athens
    Posts
    1,169
    i don;t know about java,maybe you should post it in a java forum..
    Linux For Ever!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •