This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 26014 - property sheets behaving oddly when run outside the IDE
Summary: property sheets behaving oddly when run outside the IDE
Status: CLOSED DUPLICATE of bug 26013
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-25 13:42 UTC by jarecsni
Modified: 2008-12-22 19:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jarecsni 2002-07-25 13:44:30 UTC
A simple program that creates a NetBeans property sheet 
using a BeanNode wrapper produces strange behavior when 
run independently from the IDE.

1. The editors like JFileCooser and String editor dialog 
cannot be closed with the cancel button

2. the editor dialog for indexed properties cannot be used 
at all (cannot create a new item)

I haven't tried others like ColorChooser but I suppose 
there are problems with them too.

I attach the sources for both the simple program (PTest2) 
and the bean (TestBean3). Execution environment is as 
follows:

CLASSPATH: 
myclasses;openide-explorer.jar;openide-fs.jar;openide-
nodes.jar;openide-util.jar;d:\java\netbeans\lib\core.jar;

JDK=1.4.0


Sources:
//////////////////////////////////////////////////
public class PTest2 extends JFrame  {
    
    /** Creates a new instance of PTest2 */
    public PTest2(String title) throws Exception {
        super(title);
        
        
        Container c = this.getContentPane();
        TestBean3 testBean = new TestBean3();
        
        final BeanNode bn = new BeanNode(testBean);
        
        final PropertySheet ps = new PropertySheet();
        
        c.add(ps);
        this.setSize(300, 400);
        this.setVisible(true);
        
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                ps.setNodes(new Node[] { bn } );
            }
        });
        
    }
    
    public static void main(String[] args) throws 
Exception {

        System.out.println("instantiate...");
        java.beans.PropertyEditor pe =
	java.beans.PropertyEditorManager.findEditor
(java.lang.Byte.TYPE);

        // this must be placed after the call to 
findEditor, otherwise
        // the primitive editors does not get loaded 
(oddly enough for me :)
        
java.beans.PropertyEditorManager.setEditorSearchPath(
        new String[] 
{ "org.netbeans.beaninfo.editors",    // NOI18N
        "org.openide.explorer.propertysheet.editors" }); //
 NOI18N
        
        ///Class.forName
("org.netbeans.beaninfo.editors.ByteEditor").newInstance();
        System.out.println("-ok");
        
        new PTest2("Test");
    }
}
////////////////////////////////////////////////
import java.beans.*;
import java.io.*;

/**
 *
 * @author  jani
 */
public class TestBean3 extends Object implements 
java.io.Serializable {
    
    private static final String PROP_SAMPLE_PROPERTY 
= "SampleProperty";
    
    private String sampleProperty;
    
    private PropertyChangeSupport propertySupport;
    
    /** Holds value of property freeTimeActivity. */
    private String[] freeTimeActivity;
    
    /** Creates new TestBean3 */
    public TestBean3() {
        propertySupport = new PropertyChangeSupport( 
this );
    }
    
    public String getSampleProperty() {
        return sampleProperty;
    }
    
    public void setSampleProperty(String value) {
        String oldValue = sampleProperty;
        sampleProperty = value;
        propertySupport.firePropertyChange
(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty);
    }
    
    
    public void addPropertyChangeListener
(PropertyChangeListener listener) {
        propertySupport.addPropertyChangeListener
(listener);
    }
    
    public void removePropertyChangeListener
(PropertyChangeListener listener) {
        propertySupport.removePropertyChangeListener
(listener);
    }
    
    /** Indexed getter for property freeTimeActivity.
     * @param index Index of the property.
     * @return Value of the property at <CODE>index</CODE>.
     */
    public String getFreeTimeActivity(int index) {
        return this.freeTimeActivity[index];
    }
    
    /** Getter for property freeTimeActivity.
     * @return Value of property freeTimeActivity.
     */
    public String[] getFreeTimeActivity() {
        return this.freeTimeActivity;
    }
    
    /** Indexed setter for property freeTimeActivity.
     * @param index Index of the property.
     * @param freeTimeActivity New value of the property 
at <CODE>index</CODE>.
     */
    public void setFreeTimeActivity(int index, String 
freeTimeActivity) {
        this.freeTimeActivity[index] = freeTimeActivity;
    }
    
    /** Setter for property freeTimeActivity.
     * @param freeTimeActivity New value of property 
freeTimeActivity.
     */
    public void setFreeTimeActivity(String[] 
freeTimeActivity) {
        this.freeTimeActivity = freeTimeActivity;
    }
    
    private File file;
    
    /** Holds value of property isPressed. */
    private boolean isPressed;
    
    public File getFile() { return this.file; }
    
    public void setFile(File file) { this.file = file; }
    
    /** Getter for property isPressed.
     * @return Value of property isPressed.
     */
    public boolean isIsPressed() {
        return this.isPressed;
    }    
    
    /** Setter for property isPressed.
     * @param isPressed New value of property isPressed.
     */
    public void setIsPressed(boolean isPressed) {
        this.isPressed = isPressed;
    }    
}
////////////////////////////////////////////////
Comment 1 Marian Mirilovic 2002-07-25 14:18:22 UTC

*** This issue has been marked as a duplicate of 26013 ***
Comment 2 Marian Mirilovic 2003-07-22 10:15:20 UTC
verified, closed - it's duplicate.