< prev index next >

src/java.desktop/share/classes/javax/swing/JInternalFrame.java

Print this page




1477             }
1478         }
1479     }
1480 
1481     private void setLastFocusOwner(Component component) {
1482         lastFocusOwner = component;
1483     }
1484 
1485     /**
1486      * Moves and resizes this component.  Unlike other components,
1487      * this implementation also forces re-layout, so that frame
1488      * decorations such as the title bar are always redisplayed.
1489      *
1490      * @param x  an integer giving the component's new horizontal position
1491      *           measured in pixels from the left of its container
1492      * @param y  an integer giving the component's new vertical position,
1493      *           measured in pixels from the bottom of its container
1494      * @param width  an integer giving the component's new width in pixels
1495      * @param height an integer giving the component's new height in pixels
1496      */

1497     public void reshape(int x, int y, int width, int height) {
1498         super.reshape(x, y, width, height);
1499         validate();
1500         repaint();
1501     }
1502 
1503 ///////////////////////////
1504 // Frame/Window equivalents
1505 ///////////////////////////
1506 
1507     /**
1508      * Adds the specified listener to receive internal
1509      * frame events from this internal frame.
1510      *
1511      * @param l the internal frame listener
1512      */
1513     public void addInternalFrameListener(InternalFrameListener l) {  // remind: sync ??
1514       listenerList.add(InternalFrameListener.class, l);
1515       // remind: needed?
1516       enableEvents(0);   // turn on the newEventsOnly flag in Component.


1718         validate();
1719     }
1720 
1721     /**
1722      * If the internal frame is not visible,
1723      * brings the internal frame to the front,
1724      * makes it visible,
1725      * and attempts to select it.
1726      * The first time the internal frame is made visible,
1727      * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
1728      * This method does nothing if the internal frame is already visible.
1729      * Invoking this method
1730      * has the same result as invoking
1731      * <code>setVisible(true)</code>.
1732      *
1733      * @see #moveToFront
1734      * @see #setSelected
1735      * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
1736      * @see #setVisible
1737      */

1738     public void show() {
1739         // bug 4312922
1740         if (isVisible()) {
1741             //match the behavior of setVisible(true): do nothing
1742             return;
1743         }
1744 
1745         // bug 4149505
1746         if (!opened) {
1747           fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
1748           opened = true;
1749         }
1750 
1751         /* icon default visibility is false; set it to true so that it shows
1752            up when user iconifies frame */
1753         getDesktopIcon().setVisible(true);
1754 
1755         toFront();
1756         super.show();
1757 
1758         if (isIcon) {
1759             return;
1760         }
1761 
1762         if (!isSelected()) {
1763             try {
1764                 setSelected(true);
1765             } catch (PropertyVetoException pve) {}
1766         }
1767     }
1768 

1769     public void hide() {
1770         if (isIcon()) {
1771             getDesktopIcon().setVisible(false);
1772         }
1773         super.hide();
1774     }
1775 
1776     /**
1777      * Makes this internal frame
1778      * invisible, unselected, and closed.
1779      * If the frame is not already closed,
1780      * this method fires an
1781      * <code>INTERNAL_FRAME_CLOSED</code> event.
1782      * The results of invoking this method are similar to
1783      * <code>setClosed(true)</code>,
1784      * but <code>dispose</code> always succeeds in closing
1785      * the internal frame and does not fire
1786      * an <code>INTERNAL_FRAME_CLOSING</code> event.
1787      *
1788      * @see javax.swing.event.InternalFrameEvent#INTERNAL_FRAME_CLOSED




1477             }
1478         }
1479     }
1480 
1481     private void setLastFocusOwner(Component component) {
1482         lastFocusOwner = component;
1483     }
1484 
1485     /**
1486      * Moves and resizes this component.  Unlike other components,
1487      * this implementation also forces re-layout, so that frame
1488      * decorations such as the title bar are always redisplayed.
1489      *
1490      * @param x  an integer giving the component's new horizontal position
1491      *           measured in pixels from the left of its container
1492      * @param y  an integer giving the component's new vertical position,
1493      *           measured in pixels from the bottom of its container
1494      * @param width  an integer giving the component's new width in pixels
1495      * @param height an integer giving the component's new height in pixels
1496      */
1497     @SuppressWarnings("deprecation")
1498     public void reshape(int x, int y, int width, int height) {
1499         super.reshape(x, y, width, height);
1500         validate();
1501         repaint();
1502     }
1503 
1504 ///////////////////////////
1505 // Frame/Window equivalents
1506 ///////////////////////////
1507 
1508     /**
1509      * Adds the specified listener to receive internal
1510      * frame events from this internal frame.
1511      *
1512      * @param l the internal frame listener
1513      */
1514     public void addInternalFrameListener(InternalFrameListener l) {  // remind: sync ??
1515       listenerList.add(InternalFrameListener.class, l);
1516       // remind: needed?
1517       enableEvents(0);   // turn on the newEventsOnly flag in Component.


1719         validate();
1720     }
1721 
1722     /**
1723      * If the internal frame is not visible,
1724      * brings the internal frame to the front,
1725      * makes it visible,
1726      * and attempts to select it.
1727      * The first time the internal frame is made visible,
1728      * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
1729      * This method does nothing if the internal frame is already visible.
1730      * Invoking this method
1731      * has the same result as invoking
1732      * <code>setVisible(true)</code>.
1733      *
1734      * @see #moveToFront
1735      * @see #setSelected
1736      * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
1737      * @see #setVisible
1738      */
1739     @SuppressWarnings("deprecation")
1740     public void show() {
1741         // bug 4312922
1742         if (isVisible()) {
1743             //match the behavior of setVisible(true): do nothing
1744             return;
1745         }
1746 
1747         // bug 4149505
1748         if (!opened) {
1749           fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
1750           opened = true;
1751         }
1752 
1753         /* icon default visibility is false; set it to true so that it shows
1754            up when user iconifies frame */
1755         getDesktopIcon().setVisible(true);
1756 
1757         toFront();
1758         super.show();
1759 
1760         if (isIcon) {
1761             return;
1762         }
1763 
1764         if (!isSelected()) {
1765             try {
1766                 setSelected(true);
1767             } catch (PropertyVetoException pve) {}
1768         }
1769     }
1770 
1771     @SuppressWarnings("deprecation")
1772     public void hide() {
1773         if (isIcon()) {
1774             getDesktopIcon().setVisible(false);
1775         }
1776         super.hide();
1777     }
1778 
1779     /**
1780      * Makes this internal frame
1781      * invisible, unselected, and closed.
1782      * If the frame is not already closed,
1783      * this method fires an
1784      * <code>INTERNAL_FRAME_CLOSED</code> event.
1785      * The results of invoking this method are similar to
1786      * <code>setClosed(true)</code>,
1787      * but <code>dispose</code> always succeeds in closing
1788      * the internal frame and does not fire
1789      * an <code>INTERNAL_FRAME_CLOSING</code> event.
1790      *
1791      * @see javax.swing.event.InternalFrameEvent#INTERNAL_FRAME_CLOSED


< prev index next >