java - Applet Not Initialized -


i trying make java applet on eclipse print array of bars of random lengths, sort them length , print new array. however, when run program, says applet not initialized. code below. can me? thank much!

import java.awt.*;  import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.random; import java.applet.applet;  public abstract class proj1_1 extends applet implements actionlistener {       private static int[] numbers = new int[10];       public void init()        {       button startbutton = new button("sort");       startbutton.addactionlistener(this);       add(startbutton);        setsize(300,300);       setvisible(true);       }        public void paint(graphics screen)       {           numbers = proj1_1.myrandom(numbers);            int i;              (i = 0; <= numbers.length - 1; i++)             {                    screen.fillrect(20, 20 + 10 * i, numbers[i] + 30, 6);             }        }        public static  int[] myrandom(int[] numbers)       {         random random = new random();         for(int = 0; < numbers.length; i++)             numbers[i] = random.nextint(20);         return numbers;       }         public static int[] selectionsort (int[] numbers)       {           mysort sort = new mysort();           int[] numbers2 = sort.selectionsort(numbers);           return numbers2;       }        public void actionperformed(actionevent e)       {            int[] numbers2 = proj1_1.selectionsort(numbers);             int i;            (i = 0; <= numbers2.length - 1; i++)            {                 graphics screen = null;             screen.fillrect(20, 20 + 10 * i, numbers2[i] + 30, 6);           }       } }   public class mysort {      int [] numbers;     public mysort()     {      }      public mysort(int[] numbers)      {         selectionsort(numbers);     }      public int[] selectionsort (int[] numbers)     {         for(int i=0; i<numbers.length; i++)                 {                     for(int j=0; j<numbers.length; j++)                     {                         if(numbers[i] < numbers[j])                         {                             int temp = numbers[i];                             numbers[i] = numbers[j];                             numbers[j] = temp;                         }                     }                 }         return numbers;       }  } 

you're declaring class abstract can't instantiated:

public abstract class proj1_1 extends applet 

remove abstract keyword


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -