Click to See Complete Forum and Search --> : Changing images in TextField


KingCobra220
06-02-2006, 05:39 PM
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.


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.

KingCobra220
06-02-2006, 05:45 PM
Me, being the idiot that I am, figured out the problem a full five minutes after asking here. I'll just change images thru g.drawstring...duh! Thanks for those who would have responded.