Menu

#550 Adding subclass of JSlider causes exception

4: Serious
open-wont-fix
nobody
5
2008-01-18
2006-11-17
bwbecker
No

Users of my library reported an exception when it displayed a window. I reduced it down to the following code, which produces the exception that follows the code. This was on a friend's PowerBook running Tiger and Java 1.5. She has DrJava version 20060918-1737.

Thanks!
Byron

Here's the code:

import javax.swing.*;

public class TestUI
{
public static void main(String[] args)
{ JPanel p = new JPanel();
p.add(new SpeedSlider());

JFrame f = new JFrame("TestUI");
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(100, 100);
f.setVisible(true);
}
}

class SpeedSlider extends JSlider
{
public SpeedSlider()
{ super(JSlider.VERTICAL, 0, 100, 20);
}
}

Here's the exception generated:

UIDefaults.getUI() failed: createUI() failed for
SpeedSlider[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,isInverted=false,majorTickSpacing=0,minorTickSpacing=0,orientation=VERTICAL,paintLabels=false,paintTicks=false,paintTrack=true,snapToTicks=false,snapToValue=true]
java.lang.reflect.InvocationTargetException
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:691)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:117)
at javax.swing.UIDefaults.getUI(UIDefaults.java:737)
at javax.swing.UIManager.getUI(UIManager.java:868)
at javax.swing.JSlider.updateUI(JSlider.java:244)
at javax.swing.JSlider.<init>(JSlider.java:194)
at SpeedSlider.<init>(TestUI.java:24)
at TestUI.main(TestUI.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
koala.dynamicjava.interpreter.EvaluationVisitor.visit(EvaluationVisitor.java:1105)
at
edu.rice.cs.drjava.model.repl.EvaluationVisitorExtension.visit(EvaluationVisitorExtension.java:254)
at koala.dynamicjava.tree.StaticMethodCall.acceptVisitor(StaticMethodCall.java:109)
at
edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$InterpreterExtension.interpret(DynamicJavaAdapter.java:429)
at
edu.rice.cs.drjava.model.repl.DynamicJavaAdapter.interpret(DynamicJavaAdapter.java:93)
at
edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM$4.run(InterpreterJVM.java:249)

Discussion

  • Robert Cartwright

    • status: open --> open-wont-fix
     
  • Robert Cartwright

    Logged In: YES
    user_id=430590
    Originator: NO

    This looks like a Mac OS X JVM bug. We can reproduce the bug on Mac OS X but it does not occur on other platforms (Linux or Windows). If we can figure out how to condense this example to a few files (instead of all of DrJava plus your program file), we will file a bug report with Apple. Unfortunately, it happens in the Mac OS X Java 6.0 beta release as well.

     
  • Mathias Ricken

    Mathias Ricken - 2008-01-18

    Logged In: YES
    user_id=1075744
    Originator: NO

    We cannot attempt to fix this bug without more information. Please post another comment detailing what you were doing to cause this to happen. If you have it, please include the information from the DrJava error window.

    Thanks,
    The DrJava Team

     
  • Mathias Ricken

    Mathias Ricken - 2008-01-18
    • status: open-wont-fix --> pending-wont-fix
     
  • bwbecker

    bwbecker - 2008-01-18
    • status: pending-wont-fix --> open-wont-fix
     
  • bwbecker

    bwbecker - 2008-01-18

    Logged In: YES
    user_id=1619828
    Originator: YES

    I'm not sure what additional information is needed. I attached the complete source code necessary to reproduce the bug. The code above works fine if compiled and run from the command line. Compile and run from within DrJava and you get the exception listed above (from the DrJava console window). The DrJava error window is empty.

    Byron

     
  • bwbecker

    bwbecker - 2008-01-18

    Logged In: YES
    user_id=1619828
    Originator: YES

    PS: I should have mentioned in my previous post that this still occurs under MacOSX 10.5.1 (Leopard) with the most recent version of DrJava (20080112-0033).

    Byron

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.