Hi Friends
Did someone succeed to implement the get_file_name built-in of forms using a
javabean with the wrapper class as suggested by Oracle at Metalink
(Note:74140.1) ?
When I try to compile it, I've got the following error :
MyDialog.java:4: Public class FDialog must be
defined in a file called "FDialog.java".
public class FDialog extends Canvas {
^
1 error
The java source that I tried to compile is given here below :
Bookmark Fixed font Go to End
Doc ID: Note:74140.1
Type: BULLETIN
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 16-SEP-1999
Last Revision Date: 05-DEC-2001
PURPOSE
=======
The get_file_name built-in of forms is currently not implemented for Web.
You could create a Javabean and use it to implement this functionality
for WebForms.
Attached below are the source code of JavaBean & the Wrapper Class for the
Bean.
CREATING JAVABEAN
=================
The Bean uses the following methods and Classes
-----------------------------------------------
PropertyChangeSupport for the file_name property.
java.awt.FileDialog class is used to show the File Dialog.
firePropertyChange method is called to pass a PropertyChange event to all
classes which are registered as listeners to this class.
addPropertyChangeListener is used by other classes to register themself as
PropertyChangeListener for this class.
----------------------------------------------------------------------------
---------------------------
import java.awt.*;
import java.beans.*;
public class FDialog extends Canvas {
private String file_name ;
private PropertyChangeSupport pcs;
public FDialog() {
file_name = "";
pcs = new PropertyChangeSupport(this);
}
public void set_file_name()
{
Frame frame = new Frame("Sample");
java.awt.FileDialog OpenDlg = new FileDialog(frame, "Open ",
java.awt.FileDialog.LOAD);
OpenDlg.setFile("*.*");
OpenDlg.show();
String old_file_name = file_name;
file_name=OpenDlg.getDirectory() + OpenDlg.getFile();
pcs.firePropertyChange("file_name", old_file_name, file_name);
}
public void addPropertyChangeListener(PropertyChangeListener pcl)
{
pcs.addPropertyChangeListener(pcl);
}
public void removePropertyChangeListener(PropertyChangeListener pcl)
{
pcs.removePropertyChangeListener(pcl);
}
}
----------------------------------------------------------------------------
-----------------------------
Thanks for your help
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: ALEMU Abiy
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).