<Swing Dev> redefenition isValid() method from Component
sablintolya at gmail.com
sablintolya at gmail.com
Thu Jan 6 16:37:53 UTC 2011
import javax.swing.WindowConstants;
public class Main {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.add(new NewPanel());
frame.setPreferredSize(new Dimension(400, 300));
frame.pack();
frame.setVisible(true);
}
});
}
}
class NewPanel extends JPanel {
public NewPanel() {
add(new JLabel("Test"));
}
@Override
public boolean isValid() {
return true;
}
}
And if I run this code under openjdk it shows panel with label, but if I run
this code under propriertary sunjdk it shows panel without label.
If comment isValid() method, it works equally.
Why such a difference and who is working correctly?
sun jdk:
$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
openjdk:
$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.3) (6b18-1.8.3-2)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)
my system:
$ uname -a
Linux sablin 2.6.32-5-amd64 #1 SMP Fri Dec 10 15:35:08 UTC 2010 x86_64
GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 5.0.7 (lenny)
Release: 5.0.7
Codename: lenny
$ cat /etc/debian_version
squeeze/sid
With regards, Anatoliy
More information about the swing-dev
mailing list