-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
1.0
-
generic
-
solaris_2.5
Run the following applet within Appletviewer. The same problem occurs within
Hotjava as well, but only on solaris (motif, not tiny) for both.
The intended behavior is to draw a red rectangle around the clip rect
issued to the paint (mostly as debug info) and to draw a series of
short black lines at the bottom edit of the applet window. Note that
the y coordinate of the black lines is computed to be one less than
the height of the window (which should be correct.)
(This app is cannibalized from hangman)
Resize the window.
When the window is resized, (at least about every other time) the cliprect
for the Graphics object passed into the paint routine is one pixel too small,
and as a result, the black lines are not drawn on the screen.
The debug output displays information about the window size and clip rectangle
size.
--------- ClipTest.html ------------
<html>
<head>
<title>
Cliptest demo
</title>
</head>
<body>
<h1>
Clip Test
</h1>
<hr>
<p>
<applet code="ClipTest.class" width="300" height="150">
This doesn't work for you.
</applet>
</p>
</body>
</html>
--------- ClipTest.java ---------
import java.awt.*;
import java.applet.*;
import java.io.*;
import java.net.*;
public class ClipTest extends java.applet.Applet {
/**
* Initialize the applet. Resize and load images.
*/
public void init() {
resize(375, 140);
}
/**
* Paint the screen.
*/
public void paint(Graphics g) {
int i, x, y;
Rectangle r = g.getClipRect();
g.setColor(Color.red);
g.drawRect(r.x, r.y, r.width - 1, r.height - 1);
g.setColor(Color.black);
int Mwidth = 12;
y = size().height - 1;
System.out.println("y = " + y);
System.out.println("Size = " + size());
System.out.println("Clip = " + g.getClipRect());
x = 0;
for (i=0; i<8; i++) {
g.drawLine(x, y, x + Mwidth, y);
x += Mwidth + 3;
}
}
public void update(Graphics g) {
g.clearRect(0, 0, size().width, size().height);
paint(g);
}
/**
* Start the applet.
*/
public void start() {
requestFocus();
}
public String getAppletInfo() {
return "created by cannibalizing Hangman";
}
}
Hotjava as well, but only on solaris (motif, not tiny) for both.
The intended behavior is to draw a red rectangle around the clip rect
issued to the paint (mostly as debug info) and to draw a series of
short black lines at the bottom edit of the applet window. Note that
the y coordinate of the black lines is computed to be one less than
the height of the window (which should be correct.)
(This app is cannibalized from hangman)
Resize the window.
When the window is resized, (at least about every other time) the cliprect
for the Graphics object passed into the paint routine is one pixel too small,
and as a result, the black lines are not drawn on the screen.
The debug output displays information about the window size and clip rectangle
size.
--------- ClipTest.html ------------
<html>
<head>
<title>
Cliptest demo
</title>
</head>
<body>
<h1>
Clip Test
</h1>
<hr>
<p>
<applet code="ClipTest.class" width="300" height="150">
This doesn't work for you.
</applet>
</p>
</body>
</html>
--------- ClipTest.java ---------
import java.awt.*;
import java.applet.*;
import java.io.*;
import java.net.*;
public class ClipTest extends java.applet.Applet {
/**
* Initialize the applet. Resize and load images.
*/
public void init() {
resize(375, 140);
}
/**
* Paint the screen.
*/
public void paint(Graphics g) {
int i, x, y;
Rectangle r = g.getClipRect();
g.setColor(Color.red);
g.drawRect(r.x, r.y, r.width - 1, r.height - 1);
g.setColor(Color.black);
int Mwidth = 12;
y = size().height - 1;
System.out.println("y = " + y);
System.out.println("Size = " + size());
System.out.println("Clip = " + g.getClipRect());
x = 0;
for (i=0; i<8; i++) {
g.drawLine(x, y, x + Mwidth, y);
x += Mwidth + 3;
}
}
public void update(Graphics g) {
g.clearRect(0, 0, size().width, size().height);
paint(g);
}
/**
* Start the applet.
*/
public void start() {
requestFocus();
}
public String getAppletInfo() {
return "created by cannibalizing Hangman";
}
}