|
Description
|
/*
The JProgressBar Metal PLAF implementation as
shipped in JDK 1.2rc1 overwites an empty border
placed around it. The following code recreates
the problem. When you run this example, you will
see the border that the Metal PLAF is trying to
draw around the customer bar. The paint routine
in MetalProgressBarUI.java is the culprit.
*/
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class pb_bug {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
JProgressBar pb = new JProgressBar();
pb.setBorder(new EmptyBorder(10, 10, 10, 10));
frame.getContentPane().add(pb, BorderLayout.CENTER);
frame.show();
}
}
(Review ID: 41450)
======================================================================
FULL PRODUCT VERSION :
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
FULL OPERATING SYSTEM VERSION :
customer Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
If you set any type of border on a JProgressBar, extra
lines are drawn on top and on the left of the bar. That is
troublesome when you decide to use a line border. The bug
can be easily seen when you for instance use a titled
border.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a customer bar
2. select a line border for it
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
When a line border is selected, there should not be any
extra line drawn inside the component along the border.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class ProgressSample {
public static void main (String args[]) {
JFrame f = new JFrame("JProgressBar Sample");
Container content = f.getContentPane();
JProgressBar progressBar = new JProgressBar();
progressBar.setValue(25);
progressBar.setStringPainted(true);
Border border = BorderFactory.createTitledBorder("Reading...");
progressBar.setBorder(border);
content.add(progressBar, BorderLayout.NORTH);
f.setSize (300, 100);
f.setVisible (true);
}
}
---------- END SOURCE ----------
(Review ID: 138612)
======================================================================
Posted Date : 2005-09-09 19:19:06.0
|