javax.swing.event.InternalFrameEvent Java Examples

The following examples show how to use javax.swing.event.InternalFrameEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SeaGlassInternalFrameTitlePane.java    From seaglass with Apache License 2.0 6 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can be treated
 * like a regular Frame.
 *
 * @param frame the internal frame to be closed.
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);

    // Try posting event, unless there's a SecurityManager.
    if (JInternalFrame.class.getClassLoader() == null) {

        try {
            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);

            return;
        } catch (SecurityException se) {
            // Use dispatchEvent instead.
        }
    }

    frame.dispatchEvent(e);
}
 
Example #2
Source File: JInternalFrame.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #3
Source File: JInternalFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #4
Source File: JInternalFrame.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #5
Source File: JInternalFrame.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #6
Source File: JInternalFrame.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #7
Source File: JInternalFrame.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #8
Source File: JInternalFrame.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
 
Example #9
Source File: JInternalFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #10
Source File: JInternalFrame.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #11
Source File: ImageFrame.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void internalFrameActivated(InternalFrameEvent e) {
    // We can get here as the result of a user click or as part
    // of a programmatic activation, but it shouldn't matter as all
    // activation takes place in the following method
    OpenImages.viewActivated(view);
}
 
Example #12
Source File: JInternalFrame.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #13
Source File: WorkspaceTopComponent.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void internalFrameDeiconified(InternalFrameEvent e) {
    //LOG.fine("internalFrameDeiconified: e = " + e);

    tabbedContainer.updateUI();

    TopComponent topComponent = getTopComponent(e.getInternalFrame());
    NotifiableComponent.get(topComponent).componentShowing();
}
 
Example #14
Source File: WorkspaceTopComponent.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void internalFrameActivated(InternalFrameEvent e) {
    //LOG.fine("internalFrameActivated: e = " + e);

    // Synchronise tab selection state, if not already done
    JInternalFrame internalFrame = e.getInternalFrame();
    TabData selectedTab = frameToTabMap.get(internalFrame);
    int selectedTabIndex = tabbedContainer.getSelectionModel().getSelectedIndex();
    List<TabData> tabs = tabbedContainer.getModel().getTabs();
    for (int i = 0; i < tabs.size(); i++) {
        TabData tab = tabs.get(i);
        if (tab == selectedTab && selectedTabIndex != i) {
            tabbedContainer.getSelectionModel().setSelectedIndex(i);
            break;
        }
    }

    tabbedContainer.updateUI();

    TopComponent topComponent = getTopComponent(internalFrame);

    // Publish lookup contents of selected frame to parent window
    lookup.setLookup(topComponent.getLookup());
    // Publish activated nodes, if any
    setActivatedNodes(topComponent.getActivatedNodes());

    // May not really be required
    if (WorkspaceTopComponent.this != WindowManager.getDefault().getRegistry().getActivated()) {
        WorkspaceTopComponent.this.requestActive();
    }

    notifyActivated(topComponent);
}
 
Example #15
Source File: JInternalFrame.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #16
Source File: AbstractJDashlet.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public AbstractJDashlet() {
	props = new Properties();
	
	if (!confdir.exists())
	{
		boolean ret = confdir.mkdirs();
		logger.debug(confdir + " doesn't exist, create it="+ret);
		
	}

	addInternalFrameListener(new InternalFrameAdapter() {
		@Override
		public void internalFrameClosed(InternalFrameEvent e) {
			AbstractJDashlet dash = (AbstractJDashlet) e.getInternalFrame();
			dash.onDestroy();
			if (dash.getProperties().get("id") != null)
				FileUtils.deleteQuietly(new File(confdir, dash.getProperties().get("id") + ".conf"));
		}
	});
	
	loaded=true;
	setFrameIcon(getIcon());
	setTitle(getName());
	setResizable(true);
	setClosable(true);
	setIconifiable(true);
	setMaximizable(true);
	setBounds(new Rectangle(5,5, 536,346));
}
 
Example #17
Source File: BasicInternalFrameTitlePane.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can
 * be treated like a regular Frame.
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(
        frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
    // Try posting event, unless there's a SecurityManager.
    try {
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } catch (SecurityException se) {
        frame.dispatchEvent(e);
    }
}
 
Example #18
Source File: WorkspaceTopComponent.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void internalFrameIconified(InternalFrameEvent e) {
    //LOG.fine("internalFrameIconified: e = " + e);

    tabbedContainer.updateUI();

    TopComponent topComponent = getTopComponent(e.getInternalFrame());
    NotifiableComponent.get(topComponent).componentHidden();
}
 
Example #19
Source File: JInternalFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #20
Source File: JInternalFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #21
Source File: BasicInternalFrameTitlePane.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can
 * be treated like a regular Frame.
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(
        frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
    // Try posting event, unless there's a SecurityManager.
    try {
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } catch (SecurityException se) {
        frame.dispatchEvent(e);
    }
}
 
Example #22
Source File: OrbitViewer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void internalFrameClosing(InternalFrameEvent e) {
	// TODO Auto-generated method stub
	 buildingPanelAO.setViewer(null);
	 this.dispose();
	//System.out.println("internalFrameClosing()");
}
 
Example #23
Source File: JInternalFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #24
Source File: JInternalFrame.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
@SuppressWarnings("deprecation")
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #25
Source File: BasicInternalFrameTitlePane.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can
 * be treated like a regular Frame.
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(
        frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
    // Try posting event, unless there's a SecurityManager.
    try {
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } catch (SecurityException se) {
        frame.dispatchEvent(e);
    }
}
 
Example #26
Source File: ToolFrameListener.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/** opens internal frame (overridden) */
@Override
public void internalFrameOpened(InternalFrameEvent e) {
	JInternalFrame frame = (JInternalFrame) e.getSource();
	try { frame.setClosed(false); }
	catch (java.beans.PropertyVetoException v) {
		logger.log(
			Level.SEVERE,
			Msg.getString(
				"ToolFrameListener.log.veto", //$NON-NLS-1$
				frame.getTitle()
			)
		);
	}
}
 
Example #27
Source File: JInternalFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #28
Source File: JInternalFrame.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * If the internal frame is not visible,
 * brings the internal frame to the front,
 * makes it visible,
 * and attempts to select it.
 * The first time the internal frame is made visible,
 * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event.
 * This method does nothing if the internal frame is already visible.
 * Invoking this method
 * has the same result as invoking
 * <code>setVisible(true)</code>.
 *
 * @see #moveToFront
 * @see #setSelected
 * @see InternalFrameEvent#INTERNAL_FRAME_OPENED
 * @see #setVisible
 */
@SuppressWarnings("deprecation")
public void show() {
    // bug 4312922
    if (isVisible()) {
        //match the behavior of setVisible(true): do nothing
        return;
    }

    // bug 4149505
    if (!opened) {
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
      opened = true;
    }

    /* icon default visibility is false; set it to true so that it shows
       up when user iconifies frame */
    getDesktopIcon().setVisible(true);

    toFront();
    super.show();

    if (isIcon) {
        return;
    }

    if (!isSelected()) {
        try {
            setSelected(true);
        } catch (PropertyVetoException pve) {}
    }
}
 
Example #29
Source File: BasicInternalFrameTitlePane.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can
 * be treated like a regular {@code Frame}.
 *
 * @param frame an instance of {@code JInternalFrame}
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(
        frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
    // Try posting event, unless there's a SecurityManager.
    try {
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } catch (SecurityException se) {
        frame.dispatchEvent(e);
    }
}
 
Example #30
Source File: BasicInternalFrameTitlePane.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Post a WINDOW_CLOSING-like event to the frame, so that it can
 * be treated like a regular Frame.
 */
protected void postClosingEvent(JInternalFrame frame) {
    InternalFrameEvent e = new InternalFrameEvent(
        frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
    // Try posting event, unless there's a SecurityManager.
    try {
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } catch (SecurityException se) {
        frame.dispatchEvent(e);
    }
}