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 189031 - JFileChooser: setApproveButtonText() must be called after setDialogType()
Summary: JFileChooser: setApproveButtonText() must be called after setDialogType()
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC All
: P3 normal with 1 vote (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-28 18:02 UTC by rost
Modified: 2011-09-07 15:03 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 rost 2010-07-28 18:02:18 UTC
I have added a JFileChooser to my application and changed its dialogType to SAVE_DIALOG and customized the approveButtonText property.

Unfortunately, my customized approveButtonText never shows up because NetBeans positions the source code like this:

        fileChooser.setApproveButtonText("Save me");
        fileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);

If you look at the source of JFileChooser.setDialogType() you will notice the following code block:

	if(dialogType == OPEN_DIALOG || dialogType == SAVE_DIALOG) {
	    setApproveButtonText(null);
	}

This means that calling JFileChooser.setDialogType() nulls the customized approveButtonText.

Therefore NetBeans must position setApproveButtonText() after setDialogType(), like this:

        fileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);
        fileChooser.setApproveButtonText("Save me");
Comment 1 Jan Stola 2011-09-07 15:03:12 UTC
Fixed.

Modified file: http://hg.netbeans.org/jet-main/rev/a767879a5b85