TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG-DEVEL:175] Absolute positioning in Java AWT?
Quoting Perry Hoekstra (dutchman@uswest.net):
> > I have a basic graphic and I want to put a TextField in the upper-right
> > corner of the graphic.
> >
>
> the code would look like this:
>
> g.drawImage(t_textField, 0, 600, Color.WHITE, this)
>
> where t_textField is an instance of the TextField,
> 0, 600 is the absolute position,
> Color.WHITE is the background
> this refers to the Panel, Applet, whatever that implements ImageObserver
Hmmmmm...
$ javac DaytimeApplet.java
DaytimeApplet.java:78: Incompatible type for method. Can't convert
java.awt.TextField to java.awt.Image.
g.drawImage(bob, 10, 0, Color.white, this);
Code:
TextField bob = new TextField(35);
g.drawImage(bob, 10, 0, Color.white, this);
--
Bob Tanner <tanner@real-time.com> | Phone : (612)943-8700
http://www.real-time.com | Fax : (612)943-8500
Key fingerprint = 6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9