The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

problem with drawstring

Posted by Glenn Olshefsky on November 09, 2001 at 10:46 PM

When I envoke an instance of the following class, the program freezes on the drawString command. I am using this class in a stand alone application. Any thoughts?

class taction extends Canvas {
Dimension size = new Dimension(150,480);
String[] fnames = new String[100];
int curfile = 1;
int i=1;

public void startup(String[] fns) {
fnames = fns;
}

public void findcur(int j) {
curfile = j;
}

public Dimension getPreferredSize() {
return getMinimumSize(); }
public Dimension getMinimumSize() {
return size; }

public void paint(Graphics g) {
update(g);
}
public void update (Graphics g) {
g.setColor(Color.black);
g.drawRect(3,3,145,475);
g.drawRect(4,4,143,473);

while (fnames[i-1] != null) {
if (i==curfile) g.setColor(Color.blue);
else g.setColor(Color.black);
g.drawString(fnames[i-1],10,i*20);
i++;
}
}
}

Thanks.




Replies:
  • Jay November 12, 2001 at 5:49 PM (1)
    • Freeze?? Jay November 12, 2001 at 5:52 PM (0)
  • more info Glenn November 10, 2001 at 10:18 AM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us