I have a mostly swing app which has problems such as AWT, QTJ and
com.apple.eawt.CocoaComponent components don't redraw after a resize
or layout change. In the very simple code below, which just utilizes
an AWT component, I sometimes have trouble. Sometimes the AWT button
shows up, sometimes it doesn't. AWT components are always supposed to
draw on top of swing (http://java.sun.com/products/jfc/tsc/articles/
mixing/) so this looks like a pretty serious bug to me. I don't care
so much about AWT, or even QTJ (which exhibits similar behavior in my
app, but as soon as the user hits play all is well again) but I'm
having serious trouble with my custom cocoa components.
Anyone know a workaround?
-------------
public static void main( String[] args ) {
System.setProperty
( "com.apple.eawt.CocoaComponent.CompatibilityMode", "false" );
final JFrame f = new JFrame( "TestWindow" );
f.getContentPane().setBackground( java.awt.Color.YELLOW );
JPanel p = new JPanel();
p.add( new JLabel( "JLabel" ) );
p.add( new Button( "Button" ) );
f.getContentPane().add( p );
f.pack();
f.show();
Thread t = new Thread() {
public void run() {
easySleep( 1000 );
SwingUtilities.invokeLater( new Runnable() {
public void run() {
f.hide();
}
} );
easySleep( 1000 );
SwingUtilities.invokeLater( new Runnable() {
public void run() {
f.show();
}
} );
easySleep( 1000 );
SwingUtilities.invokeLater( new Runnable() {
public void run() {
f.setSize( 500, 400 );
//f.repaint();
//f.invalidate();
//f.validate();
}
} );
}
public void easySleep( long ms )
{
try{ sleep(ms); } catch(InterruptedException ie) {}
}
};
t.start();
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden