Hi,
The code below gives the NullPointerException from
javax.swing.plaf.metal.MetalLookAndFeel.getControlDarkShadow(MetalLookAndFee
l.java:1071)
in JDK 1.3.1_12. However, the error is not given in JDK 1.4.2_04 . To be
compatible with Java plugins for browsers on the Mac, I need to compile with
1.3.1.
Below the code is the stack trace.
Any suggestions are welcome!
// SliderPaintError.java
import javax.swing.*;
import java.awt.*;
public class SliderPaintError extends JApplet {
public void init() throws NullPointerException {
try {
Container contentPane = getContentPane();
SliderPanel sliderPanel = new SliderPanel();
contentPane.add(sliderPanel);
}
catch (Exception e) {
e.printStackTrace();
}
}
private class SliderPanel extends JPanel {
SliderPanel(){
setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
JSlider eValSldr = new JSlider(JSlider.HORIZONTAL, 0, 5, 0);
add(eValSldr);
}
}
}
Exception occurred during event dispatching:
java.lang.NullPointerException
at
javax.swing.plaf.metal.MetalLookAndFeel.getControlDarkShadow(MetalLookAndFee
l.java:1071)
at javax.swing.plaf.metal.MetalSliderUI.paintTrack(MetalSliderUI.java:153)
at javax.swing.plaf.basic.BasicSliderUI.paint(BasicSliderUI.java:718)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:34)
at javax.swing.JComponent.paintComponent(JComponent.java:390)
at javax.swing.JComponent.paint(JComponent.java:682)
at javax.swing.JComponent.paintWithBuffer(JComponent.java:3873)
at javax.swing.JComponent._paintImmediately(JComponent.java:3816)
at javax.swing.JComponent.paintImmediately(JComponent.java:3667)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQu
eueUtilities.java:119)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:149)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:332)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:126)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:93)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
Roedy Green - 15 Jun 2004 20:10 GMT
>javax.swing.plaf.metal.MetalLookAndFeel.getControlDarkShadow(MetalLookAndFee
>l.java:1071)
That is a Swing method, which is relatively new. It can be
retrofitted into 1.3, but that is more trouble than upgrading to 1.4.
We really should say NO to clients who insist on staying many
generations behind in JVMs and expecting service. They are holding
EVERYONE back.
What we need is something to almost automatically install the latest
Java if it is missing.
This living with IE 1.1.5 Java is like co-operating with your rapist.

Signature
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.