-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b09
-
x86
-
windows_2000
Name: rmT116609 Date: 07/13/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Widows 2000 sp4
A DESCRIPTION OF THE PROBLEM :
SynthLookAndFeel configured to change the background-color on focus of a JTextField doesn't refresh the component when the focus change happens.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just modify the example1.xml from the SyntLookAndFeel example, by adding a state for focused and change background in it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the whole component should repaint to comply with the focus change adn the xml conf
ACTUAL -
component doesn't refresh at all, so while using the application only the parts marked dirty, and repainted for some other reason get the background it should have
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//the source is one I downloaded from Sun
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.synth.*;
public class Example1 {
public static void main(String[] args) throws Throwable {
String xmlFile = "example1.xml";
if (args.length > 0) {
xmlFile = args[0];
}
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(Example1.class.getResourceAsStream(xmlFile),
Example1.class);
UIManager.setLookAndFeel(laf);
JFrame frame = new JFrame("Test");
frame.getContentPane().setLayout(new FlowLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JTextField("example"));
//another JTF to be able to simulate focus change
frame.getContentPane().add(new JTextField("example2"));
frame.pack();
frame.show();
}
}
// THE xml, is part of the downloaded example, but with a little change
<synth>
<style id="default">
<opaque value="true"/>
<state>
<color value="#404F97" type="BACKGROUND"/>
</state>
<font name="Lucida" size="12"/>
</style>
<bind style="default" type="region" key=".*"/>
<style id="textfield">
<state>
<color value="white" type="BACKGROUND"/>
</state>
<!--state added to ake the JTF to change bgcolor on focus change -->
<state value="FOCUSED">
<color value="RED" type="BACKGROUND"/>
</state>
<imagePainter method="textFieldBorder" path="textfieldborder.png"
sourceInsets="5 6 6 7" paintCenter="false"/>
<insets top="5" bottom="6" right="7" left="6"/>
</style>
<bind style="textfield" type="region" key="TextField"/>
</synth>
---------- END SOURCE ----------
(Incident Review ID: 285460)
======================================================================
###@###.### 10/8/04 00:40 GMT
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Widows 2000 sp4
A DESCRIPTION OF THE PROBLEM :
SynthLookAndFeel configured to change the background-color on focus of a JTextField doesn't refresh the component when the focus change happens.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just modify the example1.xml from the SyntLookAndFeel example, by adding a state for focused and change background in it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the whole component should repaint to comply with the focus change adn the xml conf
ACTUAL -
component doesn't refresh at all, so while using the application only the parts marked dirty, and repainted for some other reason get the background it should have
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//the source is one I downloaded from Sun
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.synth.*;
public class Example1 {
public static void main(String[] args) throws Throwable {
String xmlFile = "example1.xml";
if (args.length > 0) {
xmlFile = args[0];
}
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(Example1.class.getResourceAsStream(xmlFile),
Example1.class);
UIManager.setLookAndFeel(laf);
JFrame frame = new JFrame("Test");
frame.getContentPane().setLayout(new FlowLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JTextField("example"));
//another JTF to be able to simulate focus change
frame.getContentPane().add(new JTextField("example2"));
frame.pack();
frame.show();
}
}
// THE xml, is part of the downloaded example, but with a little change
<synth>
<style id="default">
<opaque value="true"/>
<state>
<color value="#404F97" type="BACKGROUND"/>
</state>
<font name="Lucida" size="12"/>
</style>
<bind style="default" type="region" key=".*"/>
<style id="textfield">
<state>
<color value="white" type="BACKGROUND"/>
</state>
<!--state added to ake the JTF to change bgcolor on focus change -->
<state value="FOCUSED">
<color value="RED" type="BACKGROUND"/>
</state>
<imagePainter method="textFieldBorder" path="textfieldborder.png"
sourceInsets="5 6 6 7" paintCenter="false"/>
<insets top="5" bottom="6" right="7" left="6"/>
</style>
<bind style="textfield" type="region" key="TextField"/>
</synth>
---------- END SOURCE ----------
(Incident Review ID: 285460)
======================================================================
###@###.### 10/8/04 00:40 GMT
- relates to
-
JDK-5107826 JComponent needs support method to retrieve ComponentUI
-
- Closed
-