Java Code Examples for javax.swing.JInternalFrame#IS_SELECTED_PROPERTY

The following examples show how to use javax.swing.JInternalFrame#IS_SELECTED_PROPERTY . 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: SeaGlassInternalFrameUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
    SynthStyle oldStyle = style;
    JInternalFrame f = (JInternalFrame) evt.getSource();
    String prop = evt.getPropertyName();

    if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
        updateStyle(f);
    }

    if (style == oldStyle && (prop == JInternalFrame.IS_MAXIMUM_PROPERTY || prop == JInternalFrame.IS_SELECTED_PROPERTY)) {
        // Border (and other defaults) may need to change
        SeaGlassContext context = getContext(f, ENABLED);
        style.uninstallDefaults(context);
        ((SeaGlassStyle) style).installDefaults(context, this);
    }
}
 
Example 2
Source File: SeaGlassDesktopIconUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getSource() instanceof JInternalFrame.JDesktopIcon) {
        if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle((JInternalFrame.JDesktopIcon) evt.getSource());
        }
    } else if (evt.getSource() instanceof JInternalFrame) {
        JInternalFrame frame = (JInternalFrame) evt.getSource();
        if (iconPane instanceof JToggleButton) {
            JToggleButton button = (JToggleButton) iconPane;
            String prop = evt.getPropertyName();
            if (prop == "title") {
                button.setText((String) evt.getNewValue());
            } else if (prop == "frameIcon") {
                button.setIcon((Icon) evt.getNewValue());
            } else if (prop == JInternalFrame.IS_ICON_PROPERTY || prop == JInternalFrame.IS_SELECTED_PROPERTY) {
                button.setSelected(!frame.isIcon() && frame.isSelected());
            }
        }
    }
}
 
Example 3
Source File: FlatInternalFrameTitlePane.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
public void propertyChange( PropertyChangeEvent e ) {
	switch( e.getPropertyName() ) {
		case JInternalFrame.TITLE_PROPERTY:
			titleLabel.setText( frame.getTitle() );
			break;

		case JInternalFrame.FRAME_ICON_PROPERTY:
			updateFrameIcon();
			break;

		case JInternalFrame.IS_SELECTED_PROPERTY:
			updateColors();
			break;

		case "iconable":
		case "maximizable":
		case "closable":
			updateButtonsVisibility();
			enableActions();
			revalidate();
			repaint();

			// do not invoke super.propertyChange() because this adds/removes the buttons
			return;

		case "componentOrientation":
			applyComponentOrientation( frame.getComponentOrientation() );
			break;
	}

	super.propertyChange( e );
}
 
Example 4
Source File: SeaGlassInternalFrameTitlePane.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getSource() == this) {

        if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle(this);
        }
    } else {

        // Changes for the internal frame
        if (evt.getPropertyName() == JInternalFrame.FRAME_ICON_PROPERTY) {
            updateMenuIcon();
        }
    }

    // Basic (from Handler inner class)
    String prop = (String) evt.getPropertyName();

    if (prop == JInternalFrame.IS_SELECTED_PROPERTY) {
        repaint();

        return;
    }

    if (prop == JInternalFrame.IS_ICON_PROPERTY || prop == JInternalFrame.IS_MAXIMUM_PROPERTY) {
        setButtonTooltips();
        enableActions();

        return;
    }

    if ("closable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(closeButton);
        } else {
            remove(closeButton);
        }
    } else if ("maximizable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(maxButton);
        } else {
            remove(maxButton);
        }
    } else if ("iconable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(iconButton);
        } else {
            remove(iconButton);
        }
    }

    enableActions();

    revalidate();
    repaint();
}
 
Example 5
Source File: SeaGlassTitlePane.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getSource() == this) {

        if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
            updateStyle(this);
        }
    } else {
        // Changes for the internal frame
        if (evt.getPropertyName() == "iconImage") {
            updateMenuIcon();
        }
    }

    // Basic (from Handler inner class)
    String prop = (String) evt.getPropertyName();

    if (closeButton != null && WINDOW_DOCUMENT_MODIFIED.equals(prop)) {
        closeButton.revalidate();
        closeButton.repaint();

        return;
    }

    if (prop == JInternalFrame.IS_SELECTED_PROPERTY) {
        repaint();

        return;
    }

    // Frame.state isn't currently bound.
    if ("resizable".equals(prop) || "state".equals(prop)) {
        Frame frame = (JFrame) rootParent;

        if (frame != null) {
            setState(frame.getExtendedState(), true);
        }

        if ("resizable".equals(prop)) {
            getRootPane().repaint();
        }
    } else if ("title".equals(prop)) {
        repaint();
    } else if ("componentOrientation" == prop) {
        revalidate();
        repaint();
    } else if ("iconImage" == prop) {
        revalidate();
        repaint();
    }

    if (prop == JInternalFrame.IS_ICON_PROPERTY || prop == JInternalFrame.IS_MAXIMUM_PROPERTY) {
        setButtonTooltips();
        enableActions();

        return;
    }

    if ("closable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(closeButton);
        } else {
            remove(closeButton);
        }
    } else if ("maximizable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(maxButton);
        } else {
            remove(maxButton);
        }
    } else if ("iconable" == prop) {

        if ((Boolean) evt.getNewValue() == Boolean.TRUE) {
            add(iconButton);
        } else {
            remove(iconButton);
        }
    }

    enableActions();

    revalidate();
    repaint();
}