activating the class need help.... :)
        Posted  
        
            by 
                asm_debuger
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by asm_debuger
        
        
        
        Published on 2010-12-22T17:51:29Z
        Indexed on 
            2010/12/22
            17:53 UTC
        
        
        Read the original article
        Hit count: 185
        
this is my code... i dont anderstend way the class dont work...
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Panel;
public class Caldesinger 
{
 public Panel p1=new Panel();
 public Button[] arr=new Button[20];
 public String[] name = {"9","8","7","6","5","4","3","2","1","0","+","-","*","/",".","cos","sin","=","pow"};
 public Caldesinger()
 {
  for (int i = 0; i < arr.length; i++) 
  {
   this.arr[i]=new Button(""+name[i]);
  }
 }
 public Panel getP1() {
  return p1;
 }
 public void setP1(Panel p1) {
  this.p1 = p1;
 }
 public Button[] getArr() {
  return arr;
 }
 public void setArr(Button[] arr) {
  this.arr = arr;
 }
 public Object c()
 {
  this.p1.setLayout(new GridLayout(4,15));
  for (int i = 0; i < arr.length; i++) 
  {
   arr[i].setBackground(Color.LIGHT_GRAY);
   arr[i].setForeground(Color.orange);
   p1.add(arr[i]);
  }
  this.p1.setLayout(new GridLayout(4,15));
  return this;
 }
}
the class desinge the applet
this is the main:
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Mainapp extends Applet implements ActionListener
{
 Caldesinger desinge=new Caldesinger ();
 public void init()
 {
  this.setLayout(new BorderLayout()); 
  this.desinge.c();
 }
 public void ActionPerformed(ActionEvent arg0)
 {
  for (int i = 0; i <20; i++)
  {
   if(arg0.getSource()== this.desinge.arr[i]);
  } 
 } 
}
way the method c does not work? the method desinge the applet
© Stack Overflow or respective owner