src/java.desktop/share/classes/java/awt/FileDialog.java

Print this page




 303     /**
 304      * Constructs a name for this component. Called by <code>getName()</code>
 305      * when the name is <code>null</code>.
 306      */
 307     String constructComponentName() {
 308         synchronized (FileDialog.class) {
 309             return base + nameCounter++;
 310         }
 311     }
 312 
 313     /**
 314      * Creates the file dialog's peer.  The peer allows us to change the look
 315      * of the file dialog without changing its functionality.
 316      */
 317     public void addNotify() {
 318         synchronized(getTreeLock()) {
 319             if (parent != null && parent.peer == null) {
 320                 parent.addNotify();
 321             }
 322             if (peer == null)
 323                 peer = getToolkit().createFileDialog(this);
 324             super.addNotify();
 325         }
 326     }
 327 
 328     /**
 329      * Indicates whether this file dialog box is for loading from a file
 330      * or for saving to a file.
 331      *
 332      * @return   the mode of this file dialog window, either
 333      *               <code>FileDialog.LOAD</code> or
 334      *               <code>FileDialog.SAVE</code>
 335      * @see      java.awt.FileDialog#LOAD
 336      * @see      java.awt.FileDialog#SAVE
 337      * @see      java.awt.FileDialog#setMode
 338      */
 339     public int getMode() {
 340         return mode;
 341     }
 342 
 343     /**




 303     /**
 304      * Constructs a name for this component. Called by <code>getName()</code>
 305      * when the name is <code>null</code>.
 306      */
 307     String constructComponentName() {
 308         synchronized (FileDialog.class) {
 309             return base + nameCounter++;
 310         }
 311     }
 312 
 313     /**
 314      * Creates the file dialog's peer.  The peer allows us to change the look
 315      * of the file dialog without changing its functionality.
 316      */
 317     public void addNotify() {
 318         synchronized(getTreeLock()) {
 319             if (parent != null && parent.peer == null) {
 320                 parent.addNotify();
 321             }
 322             if (peer == null)
 323                 peer = getComponentFactory().createFileDialog(this);
 324             super.addNotify();
 325         }
 326     }
 327 
 328     /**
 329      * Indicates whether this file dialog box is for loading from a file
 330      * or for saving to a file.
 331      *
 332      * @return   the mode of this file dialog window, either
 333      *               <code>FileDialog.LOAD</code> or
 334      *               <code>FileDialog.SAVE</code>
 335      * @see      java.awt.FileDialog#LOAD
 336      * @see      java.awt.FileDialog#SAVE
 337      * @see      java.awt.FileDialog#setMode
 338      */
 339     public int getMode() {
 340         return mode;
 341     }
 342 
 343     /**