Hi all, I am trying to call a 2D array from another class, and equate the 2D array to a 2D array in the class its at. However, I'm having some problems. I can call the 2D array from the class that I want to, but it seems like my 2D array is empty after it is being called. May I know what went wrong?

import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;

class MatchApplet extends JApplet
{


	TextArea outputArea;
	JButton button;
	JButton reset;

	JTextField tF1;
	JTextField tF2;

	JLabel l1;
	JLabel l2;

	String s1;
	String s2;

	static String display1 = "";
  	static String display2 = "";

        static double[][] myDouble = new double[1000][1000];
	static int x=0, y=0;



	public static void main(String[] args)
	{
		//Application for program
		Frame f = new Frame();
		f.addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent e)
			{
				System.exit(0);
 			};
		});

  		MatchApplet ut = new MatchApplet();
  		ut.setSize(900,900); // same size as defined in the HTML APPLET
  		f.add(ut);
  		f.pack();
  		ut.init();
  		f.setSize(900,900 + 100); // add 20, seems enough for the Frame title,
  		f.show();
		//end of application for program

	}//end of public static void main(String[] args)



  	public void init()
	{

		try
		{
		BufferedReader in1 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a00(50).txt"));	//reading files in specified directory
		BufferedReader in2 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a0a(50).txt"));	//reading files in specified directory
		BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\Testing2.txt"));	//reading files in specified directory


  			String str1;
			while ((str1 = in1.readLine()) != null)	//file reading
			{
				display1 = str1;
				System.out.print(display1);
  			}
  			in1.close();

  			System.out.println("");

			String str2;
			while ((str2 = in2.readLine()) != null)	//file reading
			{
				display2 = str2;
				System.out.print(display2);
  			}
			in2.close();

			System.out.println("");

			String line;
			while ((line = in.readLine()) != null) //file reading
			{

				String[] values = line.split(",");

	        	for (String str : values)
	        	{
	        		double str_double = Double.parseDouble(str);
	        		myDouble[x][y] = str_double;
	        		System.out.print(myDouble[x][y]);
	        		y=y+1;
	        	}
	        	x=x+1;
	        	y=0;
	        	System.out.println("");
			}


			in.close();


		Container c = getContentPane();
		c.setLayout(new FlowLayout());

		outputArea = new TextArea(40,110);
		Font font = new Font("Courier", Font.PLAIN, 12);
		outputArea.setFont(font);
		outputArea.setEditable(false);

		tF1 = new JTextField(display1);
		tF2 = new JTextField(display2);

		l1 = new JLabel("Sequence 1:");
		l2 = new JLabel("Sequence 2:");

		c.add(l1);
		c.add(tF1);
		c.add(l2);
		c.add(tF2);
		c.add(outputArea);


	final Substitution sub = new Blosum50();

		s1 += tF1.getText();
		s2 += tF2.getText();
		Output out = new Output ()
		{
	  		public void print(String s)
	  		{ outputArea.append(s); }

	  		public void println(String s)
	  		{ outputArea.append(s); outputArea.append("\n"); }

	  		public void println()
	  		{ outputArea.append("\n"); }
		};

	outputArea.setText("");
      (new NW      (sub, 8,     s1, s2)).domatch(out, "GLOBAL ALIGNMENT");
      (new SW      (sub, 8,     s1, s2)).domatch(out, "LOCAL ALIGNMENT");


      }catch( IOException ioException ) {}


  }//end of init()

      static double[][] getMyDouble()
      { return myDouble; }

}//end of class




// The class of substitution (scoring) matrices

abstract class Substitution
{
	public double[][] score;

	void buildscore(String residues, String residues2, double[][] residuescores)
	{
	// Allow lowercase and uppercase residues (ASCII code <= 127):
	score = new double[127][127];
	for (int i=0; i<residues.length(); i++)
    {
		char res1 = residues.charAt(i);
		for (int j=0; j<=i; j++)
		{
        char res2 = residues2.charAt(j);
        score[res1][res2] = score[res2][res1]
	  = score[res1][res2+32] = score[res2+32][res1]
	  = score[res1+32][res2] = score[res2][res1+32]
	  = score[res1+32][res2+32] = score[res2+32][res1+32]
	  = residuescores[i][j];
      	}
    }
  	}

	abstract public String getResidues();
	abstract public String getResidues2();
}


// The BLOSUM50 substitution matrix for amino acids (Durbin et al, p 16)

class Blosum50 extends Substitution
{

	private String residues = MatchApplet.display1;
	private String residues2 = MatchApplet.display2;

	public String getResidues()
	{ return residues; }

	public String getResidues2()
	{ return residues2; }

	private double[][] residuescores = MatchApplet.getMyDouble();
	void array()
	{
	System.out.print(residuescores);
	}

	public Blosum50()
	{ buildscore(residues, residues2, residuescores); }
}

Recommended Answers

All 55 Replies

It would be much easier for us if you could post a small example (with just two classes and a get method etc, chances are you will work it out writing it, and we wont have to trawl through hundreds of lines of code)

I belive your problem is with that you seem to be making things static - is this intentional? Do you want the array to be static? I'm not sure when

private double[][] residuescores = MatchApplet.getMyDouble();

is called, as its not static, and I have never seen anything assigned an instance/variable out of a method body if its not static! But the compiler is not complaining - i guess its doing the method before you have set the static

static double[][] myDouble = new double[1000][1000];

to be anything at all, so its going to be empty... I would hold an instance of MatchApplet, and call myMatchAppletInstance.getMyDouble() where getMyDouble() is not static, and neither is myDouble.

Use indentation properly - it makes things alot clearer, also what is this doing??

score[res1][res2] = score[res2][res1]
= score[res1][res2+32] = score[res2+32][res1]
= score[res1+32][res2] = score[res2][res1+32]
= score[res1+32][res2+32] = score[res2+32][res1+32]
= residuescores[i][j];

its identical to:

score[res1][res2] = residuescores[i][j]

If I remove the static, I will have error message from those lines when I'm using the particular variable saying, non-static variable/method cannot be referenced from a static context. What does it mean?

What do you mean why holding an instance of MatchApplet?

Do you know what static and non static methods are? (well, the difference?)

Static methods dont need an instance of the object to be called

here is an example I made of the differences between the two:

public class Number
{
	//this variable is non static, therefore it needs an instance of Number
	//to hold it, all the different instances have different theNumber
	//variables inside them
	public int theNumber;
	
	//this variable is static, all the numbers have the same count variable, a
	//number doesnt even have to be created (if it wasnt private you could say
	//Number.count++; without ever using new Number(2);
	private static int count = 0;
	
	public Number(int integer)
	{
		this.theNumber = integer;

                //this increases the static count variable shared between all the numbers, every time
                //the constructor is called, the same count variable is increased!
		count++;
	}
	
	//these methods are non static, they can be accessed through number.addThisToMe(annotherNumber)
	//where annotherNumber and number were created like this: Number number = new Number(2);
	public void addThisToMe(Number number)
	{
		this.theNumber += number.theNumber;
	}
	
	//annother non static method, that prints out the instances value
	public void printOutMe() {
		System.out.println("I am: " + theNumber);
	}
	
	//this is a static method, its independent of instances like the count variable
	public static int getCount()
	{
		return count;
	}
	
	//the main method is allways static, as its started before you create any instances of
	//anything!
	public static void main(String args[])
	{
		//lets find out how many numbers we have:
		System.out.println("Count: " + Number.getCount());
		
		//we create an instance of number;
		Number number1 = new Number(4);
		number1.printOutMe();
		Number number2 = new Number(3);
		number2.printOutMe();
		
		//now, what's happened to our count:
		System.out.println("Count: " + Number.getCount());
		
		//lets call our usefull non static method to add number2 to number1:
		number1.addThisToMe(number2);
		number1.printOutMe();
		
	}
}

Yup okay I get it. My main method has function calling myDouble, hence I have to make it static. When I remove the static, I will have the error. ): So where is my problem in the whole codes? I still don't get why my array is empty. ):

final Substitution sub = new Blosum50(this);

with the constructor

pubilc Substitution (MatchApplet matchApplet)
{
     this.theReferenceToTheMatchAppletIAmUsing = matchApplet
     //all the other stuff
}

and then call

double[][] myNonStaticVariable = theReferenceToTheMatchAppletIAmUsing.getWhatever();

to access the variables from the instance you are using

Sunshineserene: you are making this very difficult for anyone to help you because your problem description is so vague.
Exactly which array in exactly which class is being "called" from exactly where? Please specify the exact line numbers where the variables and code in question can be found.

public static void main(String[] args)
	{
                //your main method is static, but you are making a new MatchApplet,
                //so you can access the non static values in it,
  		MatchApplet ut = new MatchApplet();
                
                //these are fine in a static main method, because they are performed
                //on the ut instance
                ut.myDouble = new double[1000][1000];
                ut.fillMyDoubleEtc();
                
	}//end of public static void main(String[] args)

Where do I put the constructor at?

Have you ever used a constructor before? They can be placed anywhere, but they should be under the variable declarations like in my Number example

JamesCherrill: I need to call my 2D array myDouble in line 96 (myDouble is in the function init() which is in the class MatchApplet), at the class blosum50 (line 195) and equate it to the 2D array residuescores at line 207.

Which lines do you actually get the errors on when you remove the static modifier?

final Substitution sub = new Blosum50(this);

with the constructor

pubilc Substitution (MatchApplet matchApplet)
{
     this.theReferenceToTheMatchAppletIAmUsing = matchApplet
     //all the other stuff
}

and then call

double[][] myNonStaticVariable = theReferenceToTheMatchAppletIAmUsing.getWhatever();

to access the variables from the instance you are using

What is the reference to the match applet here? Is it MatchApplet?

I would get it at line 207 if I remove the static modifier at lines 26 and 155.

What is the reference to the match applet here? Is it MatchApplet?

yes it is,

MatchApplet theReferenceToTheMatchAppletIAmUsing;

in the Substitution class

I would get it at line 207 if I remove the static modifier at lines 26 and 155.

ah yes, thats fine - you are on your way to solving it now.

Okay I put the constructor under the class Substitution. However, I'm getting errors:
1. cannot find symbol constructor Blosum50(MatchApplet) (line 129)
2. cannot find symbol variable MatchApplet (line 170)
3. non static method getMyDouble()cannot be referenced from a static context (line 218)
4. cannot find symbol constructor Substitution() (line 227)

Here is my codes so far:

import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;

class MatchApplet extends JApplet
{


	TextArea outputArea;
	JButton button;
	JButton reset;

	JTextField tF1;
	JTextField tF2;

	JLabel l1;
	JLabel l2;

	String s1;
	String s2;

	static String display1 = "";
  	static String display2 = "";

        double[][] myDouble = new double[1000][1000];
	int x=0, y=0;



	public static void main(String[] args)
	{
		//Application for program
		Frame f = new Frame();
		f.addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent e)
			{
				System.exit(0);
 			};
		});

  		MatchApplet ut = new MatchApplet();
  		ut.setSize(900,900); // same size as defined in the HTML APPLET
  		f.add(ut);
  		f.pack();
  		ut.init();
  		f.setSize(900,900 + 100); // add 20, seems enough for the Frame title,
  		f.show();
		//end of application for program

	}//end of public static void main(String[] args)



  	public void init()
	{

		try
		{
		BufferedReader in1 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a00(50).txt"));	//reading files in specified directory
		BufferedReader in2 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a0a(50).txt"));	//reading files in specified directory
		BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\Testing2.txt"));	//reading files in specified directory


  			String str1;
			while ((str1 = in1.readLine()) != null)	//file reading
			{
				display1 = str1;
				System.out.print(display1);
  			}
  			in1.close();

  			System.out.println("");

			String str2;
			while ((str2 = in2.readLine()) != null)	//file reading
			{
				display2 = str2;
				System.out.print(display2);
  			}
			in2.close();

			System.out.println("");

			String line;
			while ((line = in.readLine()) != null) //file reading
			{

				String[] values = line.split(",");

	        	for (String str : values)
	        	{
	        		double str_double = Double.parseDouble(str);
	        		myDouble[x][y] = str_double;
	        		System.out.print(myDouble[x][y]);
	        		y=y+1;
	        	}
	        	x=x+1;
	        	y=0;
	        	System.out.println("");
			}


			in.close();


		Container c = getContentPane();
		c.setLayout(new FlowLayout());

		outputArea = new TextArea(40,110);
		Font font = new Font("Courier", Font.PLAIN, 12);
		outputArea.setFont(font);
		outputArea.setEditable(false);

		tF1 = new JTextField(display1);
		tF2 = new JTextField(display2);

		l1 = new JLabel("Sequence 1:");
		l2 = new JLabel("Sequence 2:");

		c.add(l1);
		c.add(tF1);
		c.add(l2);
		c.add(tF2);
		c.add(outputArea);


	final Substitution sub = new Blosum50(this);


		s1 += tF1.getText();
		s2 += tF2.getText();
		Output out = new Output ()
		{
	  		public void print(String s)
	  		{ outputArea.append(s); }

	  		public void println(String s)
	  		{ outputArea.append(s); outputArea.append("\n"); }

	  		public void println()
	  		{ outputArea.append("\n"); }
		};

	outputArea.setText("");
      (new NW      (sub, 8,     s1, s2)).domatch(out, "GLOBAL ALIGNMENT");
      (new SW      (sub, 8,     s1, s2)).domatch(out, "LOCAL ALIGNMENT");


      }catch( IOException ioException ) {}


  }//end of init()

      double[][] getMyDouble()
      { return myDouble; }

}//end of class




// The class of substitution (scoring) matrices

abstract class Substitution
{
	public Substitution (MatchApplet matchApplet)
	{
     this.MatchApplet = matchApplet;
	}


	public double[][] score;

	void buildscore(String residues, String residues2, double[][] residuescores)
	{
	// Allow lowercase and uppercase residues (ASCII code <= 127):
	score = new double[127][127];
	for (int i=0; i<residues.length(); i++)
    {
		char res1 = residues.charAt(i);
		for (int j=0; j<=i; j++)
		{
        char res2 = residues2.charAt(j);
        score[res1][res2] = score[res2][res1]
	  = score[res1][res2+32] = score[res2+32][res1]
	  = score[res1+32][res2] = score[res2][res1+32]
	  = score[res1+32][res2+32] = score[res2+32][res1+32]
	  = residuescores[i][j];
      	}
    }
  	}

	abstract public String getResidues();
	abstract public String getResidues2();




}


// The BLOSUM50 substitution matrix for amino acids (Durbin et al, p 16)

class Blosum50 extends Substitution
{

	private String residues = MatchApplet.display1;
	private String residues2 = MatchApplet.display2;

	public String getResidues()
	{ return residues; }

	public String getResidues2()
	{ return residues2; }

	private double[][] residuescores = MatchApplet.getMyDouble();


	//public void array()
	//{ System.arraycopy(MatchApplet.myDouble, 0, residuescores, 0, 1000); }



	public Blosum50()
	{ buildscore(residues, residues2, residuescores); }
}
public static void main(String[] args)
	{
                //your main method is static, but you are making a new MatchApplet,
                //so you can access the non static values in it,
  		MatchApplet ut = new MatchApplet();
                
                //these are fine in a static main method, because they are performed
                //on the ut instance
                ut.myDouble = new double[1000][1000];
                ut.fillMyDoubleEtc();
                
	}//end of public static void main(String[] args)

Do I need to add the 2 lines you indicate there? ut.myDouble = new double[1000][1000];?
And the next line ut.fillMyDoubleEtc();, what should I replace fillMyDoubleEtc with? =/

Your class Blosum50 extends Substitution, so you need to make a constructor int this too (constructors are not inherited like methods) call super(whatever);


edit - No, you don't need to add those methods, I put them in to illustrate non static access of myDouble. I think you are sorting all that out in your init method (which you will need to call, either in a constructor for that class, or by calling it for that instance by ut.init(); cant be bothered to see if you have allready done this)

So I need to make a constructor under the class blosum50 too?

I add the line

super(MatchApplet);

under the class blosum50, but there's an error saying illegal start of type <identifier> expected.

I add the line

super(MatchApplet);

under the class blosum50, but there's an error saying illegal start of type <identifier> expected.

yes, you need to make a constructor with super(MatchApplet); in it, where MatchApplet is the MatchApplet passed to the constructor (very similar to the other constructor)


take a look at some inheritance examples:

http://download.oracle.com/javase/tutorial/java/IandI/subclasses.html

the mountainbike still needs a constructor

final Substitution sub = new Blosum50(this);

with the constructor

pubilc Substitution (MatchApplet matchApplet)
{
     this.theReferenceToTheMatchAppletIAmUsing = matchApplet
     //all the other stuff
}

and then call

double[][] myNonStaticVariable = theReferenceToTheMatchAppletIAmUsing.getWhatever();

to access the variables from the instance you are using

I can't use this.MatchApplet in the class Substitution right? I have the error cannot find variable symbol MatchApplet.

I can't use this.MatchApplet in the class Substitution right? I have the error cannot find variable symbol MatchApplet.

if you look carefully (assuming you copied my stupid variable names):

this.theReferenceToTheMatchAppletIAmUsing = matchApplet

you to use this, you would call this.theReferenceToTheMatchAppletIAmUsing


Its common to name classes with a capital, and methods and variables with a lower case letter. So a good name for the instance would be: matchApplet, and the name for the class MatchApplet (this may be a little confusing at first, but the case is very important, for example, you will allways know that MatchApplet.method() is static, and matchApplet.method is on the instance matchApplet)

//in the class body, define your MatchApplet reference
MatchApplet matchApplet;

//in the constructor, assign an instance to matchApplet (the insance is passed through the constructor)
this.matchApplet= matchApplet

//where you want to access a method, 
matchApplet.getMyDoubles();
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;

class MatchApplet extends JApplet
{
	MatchApplet matchApplet;

	TextArea outputArea;
	JButton button;
	JButton reset;

	JTextField tF1;
	JTextField tF2;

	JLabel l1;
	JLabel l2;

	String s1;
	String s2;

	static String display1 = "";
  	static String display2 = "";


	double[][] myDouble = new double[1000][1000];
	int x=0, y=0;



	public static void main(String[] args)
	{
		//Application for program
		Frame f = new Frame();
		f.addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent e)
			{
				System.exit(0);
 			};
		});

  		MatchApplet ut = new MatchApplet();
  		ut.setSize(900,900); // same size as defined in the HTML APPLET
  		f.add(ut);
  		f.pack();
  		ut.init();
  		f.setSize(900,900 + 100); // add 20, seems enough for the Frame title,
  		f.show();
		//end of application for program

	}//end of public static void main(String[] args)



  	public void init()
	{

		try
		{
		BufferedReader in1 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a00(50).txt"));	//reading files in specified directory
		BufferedReader in2 = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\1a0a(50).txt"));	//reading files in specified directory
		BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\Testing2.txt"));	//reading files in specified directory


  			String str1;
			while ((str1 = in1.readLine()) != null)	//file reading
			{
				display1 = str1;
				System.out.print(display1);
  			}
  			in1.close();

  			System.out.println("");

			String str2;
			while ((str2 = in2.readLine()) != null)	//file reading
			{
				display2 = str2;
				System.out.print(display2);
  			}
			in2.close();

			System.out.println("");

			String line;
			while ((line = in.readLine()) != null) //file reading
			{

				String[] values = line.split(",");

	        	for (String str : values)
	        	{
	        		double str_double = Double.parseDouble(str);
	        		myDouble[x][y] = str_double;
	        		System.out.print(myDouble[x][y]);
	        		y=y+1;
	        	}
	        	x=x+1;
	        	y=0;
	        	System.out.println("");
			}


			in.close();


		Container c = getContentPane();
		c.setLayout(new FlowLayout());

		outputArea = new TextArea(40,110);
		Font font = new Font("Courier", Font.PLAIN, 12);
		outputArea.setFont(font);
		outputArea.setEditable(false);

		tF1 = new JTextField(display1);
		tF2 = new JTextField(display2);

		l1 = new JLabel("Sequence 1:");
		l2 = new JLabel("Sequence 2:");

		c.add(l1);
		c.add(tF1);
		c.add(l2);
		c.add(tF2);
		c.add(outputArea);


	final Substitution sub = new Blosum50(this);


		s1 += tF1.getText();
		s2 += tF2.getText();
		Output out = new Output ()
		{
	  		public void print(String s)
	  		{ outputArea.append(s); }

	  		public void println(String s)
	  		{ outputArea.append(s); outputArea.append("\n"); }

	  		public void println()
	  		{ outputArea.append("\n"); }
		};

	outputArea.setText("");
      (new NW      (sub, 8,     s1, s2)).domatch(out, "GLOBAL ALIGNMENT");
      (new SW      (sub, 8,     s1, s2)).domatch(out, "LOCAL ALIGNMENT");


      }catch( IOException ioException ) {}


  }//end of init()

      double[][] getMyDouble()
      { return myDouble; }

}//end of class




// The class of substitution (scoring) matrices

abstract class Substitution
{
	public Substitution (MatchApplet matchApplet)
	{
     this.matchApplet = matchApplet;
	}


	public double[][] score;

	void buildscore(String residues, String residues2, double[][] residuescores)
	{
	// Allow lowercase and uppercase residues (ASCII code <= 127):
	score = new double[127][127];
	for (int i=0; i<residues.length(); i++)
    {
		char res1 = residues.charAt(i);
		for (int j=0; j<=i; j++)
		{
        char res2 = residues2.charAt(j);
        score[res1][res2] = score[res2][res1]
	  = score[res1][res2+32] = score[res2+32][res1]
	  = score[res1+32][res2] = score[res2][res1+32]
	  = score[res1+32][res2+32] = score[res2+32][res1+32]
	  = residuescores[i][j];
      	}
    }
  	}

	abstract public String getResidues();
	abstract public String getResidues2();




}


// The BLOSUM50 substitution matrix for amino acids (Durbin et al, p 16)

class Blosum50 extends Substitution
{
	super(matchApplet);

	private String residues = MatchApplet.display1;
	private String residues2 = MatchApplet.display2;

	public String getResidues()
	{ return residues; }

	public String getResidues2()
	{ return residues2; }

	private double[][] residuescores = matchApplet.getMyDouble();

	public Blosum50()
	{ buildscore(residues, residues2, residuescores); }
}

I added line 169 to 172, 209.
This is what I have so far, but there are errors. ):

abstract class Substitution
{
    public Substitution (MatchApplet matchApplet)
    {
        //you need to make a field to hold matchApplet
        this.matchApplet = matchApplet;
    }
class Blosum50 extends Substitution
{
   //you need to make a constructor to put this super into
   super(matchApplet);

try doing the above two things

for the constructor, look the examplpe code:

public class MountainBike extends Bicycle {
	
    // the MountainBike subclass adds one field
    public int seatHeight;

    // the MountainBike subclass has one constructor
    public MountainBike(int startHeight, int startCadence, int startSpeed, int startGear) {
        super(startCadence, startSpeed, startGear);
        seatHeight = startHeight;
    }
abstract class Substitution
{
    public Substitution (MatchApplet matchApplet)
    {
        //you need to make a field to hold matchApplet
        this.matchApplet = matchApplet;
    }
class Blosum50 extends Substitution
{
   //you need to make a constructor to put this super into
   super(matchApplet);

try doing the above two things

Okay, then in this case, what should the field of my matchApplet be?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.