Java Code Examples for javax.swing.event.InternalFrameEvent

The following examples show how to use javax.swing.event.InternalFrameEvent. These examples are extracted from open source projects. 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 Project: jdk1.8-source-analysis   Source File: JInternalFrame.java    License: 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 2
/**
 * 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 Project: jdk8u60   Source File: JInternalFrame.java    License: 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 Project: JDKSourceCode1.8   Source File: JInternalFrame.java    License: 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 Project: jdk8u-dev-jdk   Source File: JInternalFrame.java    License: 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 6
Source Project: seaglass   Source File: SeaGlassInternalFrameTitlePane.java    License: 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 7
Source Project: jdk8u-jdk   Source File: JInternalFrame.java    License: 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 8
Source Project: Java8CN   Source File: JInternalFrame.java    License: 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 9
/**
 * 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 10
@Override
public void internalFrameIconified(InternalFrameEvent e) {
    //LOG.fine("internalFrameIconified: e = " + e);

    tabbedContainer.updateUI();

    TopComponent topComponent = getTopComponent(e.getInternalFrame());
    NotifiableComponent.get(topComponent).componentHidden();
}
 
Example 11
Source Project: TencentKona-8   Source File: JInternalFrame.java    License: 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 12
@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 13
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 14
Source Project: jdk8u60   Source File: JInternalFrame.java    License: 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 15
@Override
public void internalFrameDeiconified(InternalFrameEvent e) {
    //LOG.fine("internalFrameDeiconified: e = " + e);

    tabbedContainer.updateUI();

    TopComponent topComponent = getTopComponent(e.getInternalFrame());
    NotifiableComponent.get(topComponent).componentShowing();
}
 
Example 16
Source Project: JDKSourceCode1.8   Source File: JInternalFrame.java    License: 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 17
Source Project: JDKSourceCode1.8   Source File: BasicInternalFrameTitlePane.java    License: 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);
    }
}
 
Example 18
Source Project: Pixelitor   Source File: ImageFrame.java    License: 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 19
Source Project: jdk8u-jdk   Source File: JInternalFrame.java    License: 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 Project: openjdk-jdk8u   Source File: JInternalFrame.java    License: 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
/**
 * 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 Project: mars-sim   Source File: OrbitViewer.java    License: 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
/**
 * 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
/**
 * 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 25
Source Project: Bytecoder   Source File: JInternalFrame.java    License: 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 26
Source Project: Bytecoder   Source File: BasicInternalFrameTitlePane.java    License: 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 27
Source Project: jdk8u_jdk   Source File: JInternalFrame.java    License: 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 Project: mars-sim   Source File: ToolFrameListener.java    License: 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 29
Source Project: openjdk-jdk9   Source File: JInternalFrame.java    License: 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 30
Source Project: jdk8u-jdk   Source File: JInternalFrame.java    License: 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) {}
    }
}