I’m making an applet right now and have come to a sudden roadblock. I cant seem to be able to change an image based on something inputted in a textfield I have. I tried changing the image inside a button, but that didn’t work. Then I tried a textfield and I got:
Image:
sun.awt.image.ToolkitImage@1d86fd3
Here’s what I got down so far.
[code=html]
Image one;
Image two;
URL base;
MediaTracker mt;
public void init()
{
mt = new MediaTracker(this);
try
{
base = getDocumentBase();
}
catch (Exception e) {}
one = getImage(base,”one.jpg”);
two = getImage(base,”two.jpg”);
mt.addImage(one,1);
mt.addImage(two,2);
try
{
mt.waitForAll();
}
catch (InterruptedException e) {}
//added textArea
//added button
//ActionPerformed
if(seriesField.getText().equalsIgnoreCase(“xxxx”))
{
area1.setText(one);
area2.setText(two);
}
when I try this, I keep getting “sun.awt.image.ToolkitImage@1d86fd3” in the textarea instead of an image. I’m a self-taught applet maker so I must be looking over some minor detail. Any help is appreciated.