Why this code works with sdk 1.4 and jdk 1.5 throws a NullPointerException?
(c4moreInformation@ http://forum.java.sun.com/thread.jspa?threadID=615803&tstart=15)
import java.awt.Font;
import java.awt.FontMetrics;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class JBlubbWindow extends JPanel {
/** Creates a new instance of JBlubbWindow */
public JBlubbWindow() {
}
private JLabel jBlubb = new JLabel() {
public void setFont(Font font) {
super.setFont(font);
if (JBlubbWindow.this != null) {
JBlubbWindow.this.resize();
JBlubbWindow.this.repaint();
}
}
};
private void resize() {
FontMetrics fm = jBlubb.getFontMetrics(jBlubb.getFont());
};
public static void main(String args[]) {
System.out.println("JBlubbWindow");
JBlubbWindow jbw = new JBlubbWindow();
}
}
(c4moreInformation@ http://forum.java.sun.com/thread.jspa?threadID=615803&tstart=15)
import java.awt.Font;
import java.awt.FontMetrics;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class JBlubbWindow extends JPanel {
/** Creates a new instance of JBlubbWindow */
public JBlubbWindow() {
}
private JLabel jBlubb = new JLabel() {
public void setFont(Font font) {
super.setFont(font);
if (JBlubbWindow.this != null) {
JBlubbWindow.this.resize();
JBlubbWindow.this.repaint();
}
}
};
private void resize() {
FontMetrics fm = jBlubb.getFontMetrics(jBlubb.getFont());
};
public static void main(String args[]) {
System.out.println("JBlubbWindow");
JBlubbWindow jbw = new JBlubbWindow();
}
}