MichaelJakubec / gtkjfilechooser

Automatically exported from code.google.com/p/gtkjfilechooser
1 stars 0 forks source link

Exception with Save dialog #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)

Unbuntu 8.10, 32 bits.

Run:

java -jar gtkjfilechooser-demo.jar

Select "Dialog Type" Save, select "Show FileChooser"...thread exception:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at
eu.kostia.gtkjfilechooser.ui.GtkFileChooserUI.pack(GtkFileChooserUI.java:1524)
    at
eu.kostia.gtkjfilechooser.ui.GtkFileChooserUI.doAncestorChanged(GtkFileChooserUI
.java:1585)
    at
eu.kostia.gtkjfilechooser.ui.GtkFileChooserUI.propertyChange(GtkFileChooserUI.ja
va:1491)
    at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:3
39)
    at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:2
76)
    at java.awt.Component.firePropertyChange(Component.java:8128)
    at javax.swing.JComponent.addNotify(JComponent.java:4686)
    at java.awt.Container.addNotify(Container.java:2578)
    at javax.swing.JComponent.addNotify(JComponent.java:4685)
    at java.awt.Container.addNotify(Container.java:2578)
    at javax.swing.JComponent.addNotify(JComponent.java:4685)
    at java.awt.Container.addNotify(Container.java:2578)
    at javax.swing.JComponent.addNotify(JComponent.java:4685)
    at javax.swing.JRootPane.addNotify(JRootPane.java:739)
    at java.awt.Container.addNotify(Container.java:2578)
    at java.awt.Window.addNotify(Window.java:662)
    at java.awt.Dialog.addNotify(Dialog.java:742)
    at java.awt.Window.pack(Window.java:703)
    at javax.swing.JFileChooser.createDialog(JFileChooser.java:781)
    at javax.swing.JFileChooser.showDialog(JFileChooser.java:714)
    at
eu.kostia.gtkjfilechooser.demo.FileChooserDemo.actionPerformed(FileChooserDemo.j
ava:363)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.jav
a:236)
    at java.awt.Component.processMouseEvent(Component.java:6263)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269
)
    at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174
)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Works okay with "Dialog Type" "Open".

Original issue reported on code.google.com by stephen....@gmail.com on 10 Nov 2009 at 1:23

GoogleCodeExporter commented 9 years ago
This bug occurs because not always ~/.config/gtk-2.0/gtkfilechooser.ini 
contains the
Geometry entries

[Filechooser Settings]
LocationMode=filename-entry
ShowHidden=false
ExpandFolders=true
ShowSizeColumn=false
GeometryX=496
GeometryY=261
GeometryWidth=687
GeometryHeight=550
SortColumn=name
SortOrder=ascending

Fix: in these cases init the value with MIN_EXPANDED_HEIGHT:
  expandedHeight = bound != null ? bound.height : MIN_EXPANDED_HEIGHT;

Fixed in the upcoming release (1.3.2)

Original comment by c.ce...@gmail.com on 12 Nov 2009 at 10:11

GoogleCodeExporter commented 9 years ago

Original comment by c.ce...@gmail.com on 12 Nov 2009 at 11:14