From: KUBO H. <hi...@sf...> - 2005-06-09 06:57:20
|
Felix, At Tue, 7 Jun 2005 14:36:59 -0400, Felix Berger wrote: > > Proposition: Instead of allowing to create your own action, just provide a > protected method in FileChooserPanel which is called by the FileChooserAction > in its actionPerformed method. This way the action's text and icon is always > persistent. See DefaultDialog for a similar pattern. I see. > I'd still be interested to know why you would like to subclass the action, > maybe this would help me better understand your motivation. Well, I had no special idea about subclassing the action... But I think it will be required to make subclass of FileChooserDelegator which delegates method calls to a JFileChooser instances or an DirectoryChooser instance or something else chooser instance. http://sqs.cmr.sfc.keio.ac.jp/tdiary/files/xnap-commons-20050608-FileChooserPanel.patch In this new patch, FileChooserDelegator is separated from FileChooserAction. private FileChooserDelegator fileChooserDelegator; private FileChooserAction fileChooserAction; public void launchFileChooserDialog() { fileChooserDelegator.launchFileChooserDialog(); } protected class FileChooserDelegator{ protected JFileChooser fileChooser; protected DirectoryChooser directoryChooser; .... public void launchFileChooserDialog() { ..... } } private class FileChooserAction extends AbstractXNapAction { FileChooserAction() { putValue(ICON_FILENAME, "fileopen.png"); putValue(SHORT_DESCRIPTION, I18n.tr("Choose a file")); } public void actionPerformed(ActionEvent event) { launchFileChooserDialog(); } } ...How about this? KUBO Hiroya hi...@sf... |