harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tharindu Mathew" <mcclou...@gmail.com>
Subject Re: [classlib][swing] the method called via reflection in UIDefaults is undefined Re: JRootPane NPE
Date Fri, 04 Apr 2008 16:59:05 GMT
Before digging deep on the problem, I feel I should understand the Swing
subsystem more. I'm reading the following article to get a proper idea.

http://java.sun.com/products/jfc/tsc/articles/architecture/

Please tell me if there is more relevant articles that will help me along
the way. Thanks for the help.


On Fri, Apr 4, 2008 at 7:17 PM, Alexei Fedotov <alexei.fedotov@gmail.com>
wrote:

> Tharindu,
> Thanks for the question. If I understand you correctly UIDefaults hash
> table does not contain a proper value for a method to call for the key
> corresponding to JRootPane.class. Why? The brief answer is "I don't
> know". Keep digging deeper. BTW, do we have swing gurus on the list
> who could shed the light on the problem?
>
> To guess what should be in the method variable I suggest you setting a
> breakpoint on this line and try to collect a statistics for working
> swing demos. Why do they work? If JRootPanne would work, it probably
> has a different look and feel or setup in standard demos.
>
> I like that you have come with the guess. I checked how setUI() is
> called from java/common/javax/swing/JRootPane.java: it is mentioned
> three times as in other components. So, keeping an eye on this method
> does not help. I believe someone should register a method for this
> class in UIDefaults, for example, call new UIDefaults(a proper array).
> I found that this is done in the following places.
>
> $  grep -rlI 'new UIDefaults' ./java/common/javax/swing/* | grep -v svn
> ./java/common/javax/swing/LookAndFeel.java
> ./java/common/javax/swing/UIManager.java
> ./java/common/javax/swing/plaf/basic/BasicLookAndFeel.java
> ./java/common/javax/swing/plaf/metal/MetalLookAndFeel.java
> ./java/common/javax/swing/plaf/multi/MultiLookAndFeel.java
> ./java/common/javax/swing/plaf/synth/SynthLookAndFeel.java
> ./java/common/javax/swing/text/AbstractDocument.java
>
> Based on this list I may guess that the chosen look and feel does not
> register JRootPane look and feel correctly. Please, keep us posted on
> your advances.
>
> Thanks!
>
> On Fri, Apr 4, 2008 at 10:12 AM, Tharindu Mathew <mccloud35@gmail.com>
> wrote:
> > ERROR: UIDefaults.getUI() failed: java.lang.NullPointerException
> >     at javax.swing.UIDefaults.getUI(UIDefaults.java:339)
> >     at javax.swing.UIManager.getUI(UIManager.java:222)
> >     at javax.swing.JPanel.updateUI(JPanel.java:141)
> >     at javax.swing.JPanel.<init>(JPanel.java:56)
> >     at javax.swing.JPanel.<init>(JPanel.java:76)
> >     at javax.swing.JRootPane.createGlassPane(JRootPane.java:278)
> >     at javax.swing.JRootPane.<init>(JRootPane.java:78)
> >     at javax.swing.JFrame.createRootPane(JFrame.java:175)
> >     at javax.swing.JFrame.frameInit(JFrame.java:393)
> >     at javax.swing.JFrame.<init>(JFrame.java:123)
> >     at
> >
>  net.sf.freecol.client.gui.FullScreenFrame.<init>(FullScreenFrame.java:34)
> >     at
> net.sf.freecol.client.FreeColClient.startGUI(FreeColClient.java:218)
> >     at
> net.sf.freecol.client.FreeColClient.access$000(FreeColClient.java:31)
> >     at net.sf.freecol.client.FreeColClient$1.run(FreeColClient.java:142)
> >     at
> java.awt.event.InvocationEvent.runAndNotify(InvocationEvent.java:98)
> >     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:78)
> >     at
> java.awt.EventQueueCore.dispatchEventImpl(EventQueueCore.java:138)
> >     at java.awt.EventQueue.dispatchEvent(EventQueue.java:144)
> >     at
> >  java.awt.EventDispatchThread.runModalLoop(EventDispatchThread.java:74)
> >     at java.awt.EventDispatchThread.run(EventDispatchThread.java:48)
> >
> >
> >  In the UI defaults class:
> >
> >   Method method = null;
> >             if (uiClass == null) {
> >                 uiClass = getUIClass(classID,
> >  comp.getClass().getClassLoader());
> >                 method = getCreateUIMethodPriveledged(uiClass);
> >
> >                 put(fullClassName, uiClass);
> >                 put(uiClass, method);
> >             } else {
> >                 method = (Method)get(uiClass); *<--- method is null,
> because
> >  no value exists for the uiClass key*
> >             }
> >             return (ComponentUI)method.invoke(null, new Object[] { comp
> });
> >  *<--- causes NPE when tryin to invoke*
> >
> >  What is supposed to return to the method variable? Does this return
> null
> >  because the setUI() method is not called from within JRootPane?
> >
> >  --
> >  Regards,
> >
> >  Tharindu
> >
>
>
>
> --
> With best regards,
> Alexei
>



-- 
Regards,

Tharindu

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message