/    Sign up×
Community /Pin to ProfileBookmark

Changing images in TextField

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);
}
[/code]

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.

to post a comment
Java

1 Comments(s)

Copy linkTweet thisAlerts:
@KingCobra220authorJun 02.2006 — 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.
×

Success!

Help @KingCobra220 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...