-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.2
-
x86
-
windows_nt
Name: joT67522 Date: 09/16/97
Problem lies around the setFont method. When invoked it only
sets the font of the component but not the graphics context of
the component. I have included the two source files which
should help you to reproduce the bug.
/**
* @author Mohammed Akbar Khan
*/
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Font;
public class G extends Component
{
public void update(Graphics g)
{
paint(g);
}
public void paint(Graphics g)
{
g.setColor(Color.black);
g.drawString("Mohammed Akbar Khan", 10, 10);
}
}
/**
* @author Mohammed Akbar Khan
*/
import java.awt.*;
import java.awt.event.*;
public class M extends Frame
{
public M()
{
setBackground(Color.lightGray);
setTitle("Graphic Button Test");
setLayout(null);
String[] strFontList = Toolkit.getDefaultToolkit().getFontList();
for(int j = 0; j < strFontList.length; j++)
{
System.out.println(strFontList[j] + " = " + j);
}
Font gf = new Font(strFontList[1], Font.BOLD, 11);
System.out.println(gf.toString());
G gb0 = new G();
gb0.setSize(200, 200);
gb0.setLocation(100, 100);
gb0.setFont(gf);
add(gb0);
addWindowListener(new WindowEventClass());
}
class WindowEventClass extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
dispose();
System.exit(0);
}
}
public static void main(String[] arg)
{
Frame f = new M();
f.setSize(600, 300);
f.setVisible(true);
}
}
company - Sabre Technology Solutions. , email - Work: ###@###.### Home: ###@###.###
======================================================================
- relates to
-
JDK-4137092 setFont() in Applet paint() causes infinite loop if called more than once(win32)
-
- Closed
-