Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Mark Sintrel

Greenhorn
+ Follow
since Jun 29, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Sintrel

Check out the packages and tutorials on http://www.jgoodies.com

Their forms jar is pretty good.
18 years ago
If you have a look at Java 1.5 you'll see that Sun has made great efforts to improve Swing. I don't see them giving up on it anytime soon either.
18 years ago
Here's the Java API code (javax.swing.text.FlowView) that gives me the NPE:



The line in bold above is line 264 which gives me the exception:

Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.text.FlowView.changedUpdate(FlowView.java:264)
at javax.swing.text.ParagraphView.changedUpdate(ParagraphView.java:680)
at javax.swing.text.View.forwardUpdateToView(View.java:1221)
at javax.swing.text.View.forwardUpdate(View.java:1192)
at javax.swing.text.BoxView.forwardUpdate(BoxView.java:222)
at javax.swing.text.View.changedUpdate(View.java:798)
at javax.swing.plaf.basic.BasicTextUI$RootView.changedUpdate(BasicTextUI.java:1515)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.changedUpdate(BasicTextUI.java:1756)
at javax.swing.text.AbstractDocument.fireChangedUpdate(AbstractDocument.java:213)
at javax.swing.text.DefaultStyledDocument$ChangeUpdateRunnable.run(DefaultStyledDocument.java:2477)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
at java.awt.Dialog$1.run(Dialog.java:540)
at java.awt.Dialog.show(Dialog.java:561)
at mypackage.dialogs.TemplateDialog.show(TemplateDialog.java:282)
at mypackage.program.initOpenTemplate(designondemand.java:574)
at mypackage.commands.cmdOpenTemplate.actionPerformed(cmdOpenTemplate.java:29)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)



The exception occurs sometimes when I set a lot of paragraph attributes and character attributes on a DefaultStyledDocument (or at least that's where I think it happens, haven't been able to trace it to a specific source).

So I tried moving all code where I update the DefaultStyledDocument into SwingUtilities.invokeAndWait() but that didn't change anything.

Can anyone see what's happening here?
18 years ago
Yes, that is true .. however, the person who wrote it seem to be aware of this, look at the Boolean constructor documentation:

Note: It is rarely appropriate to use this constructor. Unless a new instance is required, the static factory valueOf(boolean) is generally a better choice. It is likely to yield significantly better space and time performance.



.. but I can't think of any use either.

Thanks for answering
18 years ago
You'll need to change the mime type of your script so that JWS knows it's a file it should handle.

This can be done pretty easily by modifying the headers in your jsp file to say that it's an jnlp file .. I don't have the jsp code for this, but here's the php code - and it should be pretty similar:



- Mark
18 years ago
The JNLP file is actually called "BrowserLauncher.jnlp" (case sensitive!), and you're running your webserver right?
18 years ago
I get that one should try to use Boolean.valueOf() instead of new Boolean() as much as possible since creating new instances of Boolean wastes memory.

However, the Boolean API for valueOf() states:

If a new Boolean instance is not required, this method should generally be used in preference to the constructor Boolean(boolean), (...)



When would a new Boolean instance be required? Boolean objects are immutable, and there are only two useful values; Boolean.TRUE and Boolean.FALSE ..

Am I missing something here?
[ June 29, 2004: Message edited by: Mark Sintrel ]
18 years ago