< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java

Print this page




 401      */
 402     public Dimension getMinimumSize(JComponent x)  {
 403         if(frame == x) {
 404             return frame.getLayout().minimumLayoutSize(x);
 405         }
 406         return new Dimension(0, 0);
 407     }
 408 
 409     /**
 410      * Returns the maximum size.
 411      * @param x the component
 412      * @return the maximum size
 413      */
 414     public Dimension getMaximumSize(JComponent x) {
 415         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
 416     }
 417 
 418 
 419 
 420     /**
 421      * Installs necessary mouse handlers on <code>newPane</code>
 422      * and adds it to the frame.
 423      * Reverse process for the <code>currentPane</code>.
 424      *
 425      * @param currentPane this {@code Jcomponent} is the current pane being
 426      * viewed that has mouse handlers installed
 427      * @param newPane this {@code Jcomponent} is the pane which will be added
 428      * and have mouse handlers installed
 429      */
 430     protected void replacePane(JComponent currentPane, JComponent newPane) {
 431         if(currentPane != null) {
 432             deinstallMouseHandlers(currentPane);
 433             frame.remove(currentPane);
 434         }
 435         if(newPane != null) {
 436            frame.add(newPane);
 437            installMouseHandlers(newPane);
 438         }
 439     }
 440 
 441     /**
 442      * Deinstalls the mouse handlers.
 443      * @param c the component


 708      */
 709     protected DesktopManager getDesktopManager() {
 710         if(frame.getDesktopPane() != null
 711            && frame.getDesktopPane().getDesktopManager() != null)
 712             return frame.getDesktopPane().getDesktopManager();
 713         if(sharedDesktopManager == null)
 714           sharedDesktopManager = createDesktopManager();
 715         return sharedDesktopManager;
 716     }
 717 
 718     /**
 719      * Creates the desktop manager.
 720      * @return the desktop manager
 721      */
 722     protected DesktopManager createDesktopManager(){
 723       return new DefaultDesktopManager();
 724     }
 725 
 726     /**
 727      * This method is called when the user wants to close the frame.
 728      * The <code>playCloseSound</code> Action is fired.
 729      * This action is delegated to the desktopManager.
 730      *
 731      * @param f the {@code JInternalFrame} being viewed
 732      */
 733     protected void closeFrame(JInternalFrame f) {
 734         // Internal Frame Auditory Cue Activation
 735         BasicLookAndFeel.playSound(frame,"InternalFrame.closeSound");
 736         // delegate to desktop manager
 737         getDesktopManager().closeFrame(f);
 738     }
 739 
 740     /**
 741      * This method is called when the user wants to maximize the frame.
 742      * The <code>playMaximizeSound</code> Action is fired.
 743      * This action is delegated to the desktopManager.
 744      *
 745      * @param f the {@code JInternalFrame} being viewed
 746      */
 747     protected void maximizeFrame(JInternalFrame f) {
 748         // Internal Frame Auditory Cue Activation
 749         BasicLookAndFeel.playSound(frame,"InternalFrame.maximizeSound");
 750         // delegate to desktop manager
 751         getDesktopManager().maximizeFrame(f);
 752     }
 753 
 754     /**
 755      * This method is called when the user wants to minimize the frame.
 756      * The <code>playRestoreDownSound</code> Action is fired.
 757      * This action is delegated to the desktopManager.
 758      *
 759      * @param f the {@code JInternalFrame} being viewed
 760      */
 761     protected void minimizeFrame(JInternalFrame f) {
 762         // Internal Frame Auditory Cue Activation
 763         if ( ! f.isIcon() ) {
 764             // This method seems to regularly get called after an
 765             // internal frame is iconified. Don't play this sound then.
 766             BasicLookAndFeel.playSound(frame,"InternalFrame.restoreDownSound");
 767         }
 768         // delegate to desktop manager
 769         getDesktopManager().minimizeFrame(f);
 770     }
 771 
 772     /**
 773      * This method is called when the user wants to iconify the frame.
 774      * The <code>playMinimizeSound</code> Action is fired.
 775      * This action is delegated to the desktopManager.
 776      *
 777      * @param f the {@code JInternalFrame} being viewed
 778      */
 779     protected void iconifyFrame(JInternalFrame f) {
 780         // Internal Frame Auditory Cue Activation
 781         BasicLookAndFeel.playSound(frame, "InternalFrame.minimizeSound");
 782         // delegate to desktop manager
 783         getDesktopManager().iconifyFrame(f);
 784     }
 785 
 786     /**
 787      * This method is called when the user wants to deiconify the frame.
 788      * The <code>playRestoreUpSound</code> Action is fired.
 789      * This action is delegated to the desktopManager.
 790      *
 791      * @param f the {@code JInternalFrame} being viewed
 792      */
 793     protected void deiconifyFrame(JInternalFrame f) {
 794         // Internal Frame Auditory Cue Activation
 795         if ( ! f.isMaximum() ) {
 796             // This method seems to regularly get called after an
 797             // internal frame is maximized. Don't play this sound then.
 798             BasicLookAndFeel.playSound(frame, "InternalFrame.restoreUpSound");
 799         }
 800         // delegate to desktop manager
 801         getDesktopManager().deiconifyFrame(f);
 802     }
 803 
 804     /**
 805       * This method is called when the frame becomes selected.
 806       * This action is delegated to the desktopManager.
 807       *
 808       * @param f the {@code JInternalFrame} being viewed




 401      */
 402     public Dimension getMinimumSize(JComponent x)  {
 403         if(frame == x) {
 404             return frame.getLayout().minimumLayoutSize(x);
 405         }
 406         return new Dimension(0, 0);
 407     }
 408 
 409     /**
 410      * Returns the maximum size.
 411      * @param x the component
 412      * @return the maximum size
 413      */
 414     public Dimension getMaximumSize(JComponent x) {
 415         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
 416     }
 417 
 418 
 419 
 420     /**
 421      * Installs necessary mouse handlers on {@code newPane}
 422      * and adds it to the frame.
 423      * Reverse process for the {@code currentPane}.
 424      *
 425      * @param currentPane this {@code Jcomponent} is the current pane being
 426      * viewed that has mouse handlers installed
 427      * @param newPane this {@code Jcomponent} is the pane which will be added
 428      * and have mouse handlers installed
 429      */
 430     protected void replacePane(JComponent currentPane, JComponent newPane) {
 431         if(currentPane != null) {
 432             deinstallMouseHandlers(currentPane);
 433             frame.remove(currentPane);
 434         }
 435         if(newPane != null) {
 436            frame.add(newPane);
 437            installMouseHandlers(newPane);
 438         }
 439     }
 440 
 441     /**
 442      * Deinstalls the mouse handlers.
 443      * @param c the component


 708      */
 709     protected DesktopManager getDesktopManager() {
 710         if(frame.getDesktopPane() != null
 711            && frame.getDesktopPane().getDesktopManager() != null)
 712             return frame.getDesktopPane().getDesktopManager();
 713         if(sharedDesktopManager == null)
 714           sharedDesktopManager = createDesktopManager();
 715         return sharedDesktopManager;
 716     }
 717 
 718     /**
 719      * Creates the desktop manager.
 720      * @return the desktop manager
 721      */
 722     protected DesktopManager createDesktopManager(){
 723       return new DefaultDesktopManager();
 724     }
 725 
 726     /**
 727      * This method is called when the user wants to close the frame.
 728      * The {@code playCloseSound} Action is fired.
 729      * This action is delegated to the desktopManager.
 730      *
 731      * @param f the {@code JInternalFrame} being viewed
 732      */
 733     protected void closeFrame(JInternalFrame f) {
 734         // Internal Frame Auditory Cue Activation
 735         BasicLookAndFeel.playSound(frame,"InternalFrame.closeSound");
 736         // delegate to desktop manager
 737         getDesktopManager().closeFrame(f);
 738     }
 739 
 740     /**
 741      * This method is called when the user wants to maximize the frame.
 742      * The {@code playMaximizeSound} Action is fired.
 743      * This action is delegated to the desktopManager.
 744      *
 745      * @param f the {@code JInternalFrame} being viewed
 746      */
 747     protected void maximizeFrame(JInternalFrame f) {
 748         // Internal Frame Auditory Cue Activation
 749         BasicLookAndFeel.playSound(frame,"InternalFrame.maximizeSound");
 750         // delegate to desktop manager
 751         getDesktopManager().maximizeFrame(f);
 752     }
 753 
 754     /**
 755      * This method is called when the user wants to minimize the frame.
 756      * The {@code playRestoreDownSound} Action is fired.
 757      * This action is delegated to the desktopManager.
 758      *
 759      * @param f the {@code JInternalFrame} being viewed
 760      */
 761     protected void minimizeFrame(JInternalFrame f) {
 762         // Internal Frame Auditory Cue Activation
 763         if ( ! f.isIcon() ) {
 764             // This method seems to regularly get called after an
 765             // internal frame is iconified. Don't play this sound then.
 766             BasicLookAndFeel.playSound(frame,"InternalFrame.restoreDownSound");
 767         }
 768         // delegate to desktop manager
 769         getDesktopManager().minimizeFrame(f);
 770     }
 771 
 772     /**
 773      * This method is called when the user wants to iconify the frame.
 774      * The {@code playMinimizeSound} Action is fired.
 775      * This action is delegated to the desktopManager.
 776      *
 777      * @param f the {@code JInternalFrame} being viewed
 778      */
 779     protected void iconifyFrame(JInternalFrame f) {
 780         // Internal Frame Auditory Cue Activation
 781         BasicLookAndFeel.playSound(frame, "InternalFrame.minimizeSound");
 782         // delegate to desktop manager
 783         getDesktopManager().iconifyFrame(f);
 784     }
 785 
 786     /**
 787      * This method is called when the user wants to deiconify the frame.
 788      * The {@code playRestoreUpSound} Action is fired.
 789      * This action is delegated to the desktopManager.
 790      *
 791      * @param f the {@code JInternalFrame} being viewed
 792      */
 793     protected void deiconifyFrame(JInternalFrame f) {
 794         // Internal Frame Auditory Cue Activation
 795         if ( ! f.isMaximum() ) {
 796             // This method seems to regularly get called after an
 797             // internal frame is maximized. Don't play this sound then.
 798             BasicLookAndFeel.playSound(frame, "InternalFrame.restoreUpSound");
 799         }
 800         // delegate to desktop manager
 801         getDesktopManager().deiconifyFrame(f);
 802     }
 803 
 804     /**
 805       * This method is called when the frame becomes selected.
 806       * This action is delegated to the desktopManager.
 807       *
 808       * @param f the {@code JInternalFrame} being viewed


< prev index next >