类javax.swing.JInternalFrame.JDesktopIcon源码实例Demo

下面列出了怎么用javax.swing.JInternalFrame.JDesktopIcon的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * {@inheritDoc}
 */
public boolean isInState(JComponent c) {
    Component parent = c;

    while (parent.getParent() != null) {

        if (parent instanceof JInternalFrame || parent instanceof JDesktopIcon) {
            break;
        }

        parent = parent.getParent();
    }

    if (parent instanceof JInternalFrame) {
        return ((JInternalFrame) parent).isIcon();
    } else if (parent instanceof JDesktopIcon) {
        return true;
    }

    return false;
}
 
源代码2 项目: radiance   文件: SubstanceDesktopIconUI.java
/**
 * Installs the UI delegate on the desktop icon if necessary.
 * 
 * @param jdi
 *            Desktop icon.
 */
void installIfNecessary(JDesktopIcon jdi) {
	// fix for issue 344 - reopening an internal frame
	// that has been closed.
	if (this.desktopIcon == null) {
		this.installUI(jdi);
	}
}
 
源代码3 项目: radiance   文件: SubstanceDesktopIconUI.java
/**
 * Uninstalls the UI delegate from the desktop icon if necessary.
 * 
 * @param jdi
 *            Desktop icon.
 */
void uninstallIfNecessary(JDesktopIcon jdi) {
	// fix for issue 345 - an internal frame used in inner option pane
	// gets closed twice
	if (this.desktopIcon == jdi) {
		this.uninstallUI(jdi);
	}
}
 
源代码4 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
/**
 * Searches JInternalframe in container.
 *
 * @param cont Container to search component in.
 * @param chooser a component chooser specifying searching criteria.
 * @param index Ordinal component index.
 * @return JInternalframe instance or null if component was not found.
 */
public static JInternalFrame findJInternalFrame(Container cont, ComponentChooser chooser, int index) {
    Component res = findComponent(cont, new JInternalFrameFinder(chooser), index);
    if (res instanceof JInternalFrame) {
        return (JInternalFrame) res;
    } else if (res instanceof JInternalFrame.JDesktopIcon) {
        return ((JInternalFrame.JDesktopIcon) res).getInternalFrame();
    } else {
        return null;
    }
}
 
源代码5 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
/**
 * Waits JInternalframe in container.
 *
 * @param cont Container to search component in.
 * @param chooser a component chooser specifying searching criteria.
 * @param index Ordinal component index.
 * @return JInternalframe instance.
 *
 */
public static JInternalFrame waitJInternalFrame(final Container cont, final ComponentChooser chooser, final int index) {
    Component res = waitComponent(cont, new JInternalFrameFinder(chooser), index);
    if (res instanceof JInternalFrame) {
        return (JInternalFrame) res;
    } else if (res instanceof JInternalFrame.JDesktopIcon) {
        return ((JInternalFrame.JDesktopIcon) res).getInternalFrame();
    } else {
        throw (new TimeoutExpiredException(chooser.getDescription()));
    }
}
 
源代码6 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
/**
 * Maps {@code JInternalFrame.getDesktopIcon()} through queue
 */
public JDesktopIcon getDesktopIcon() {
    return (runMapping(new MapAction<JDesktopIcon>("getDesktopIcon") {
        @Override
        public JDesktopIcon map() {
            return ((JInternalFrame) getSource()).getDesktopIcon();
        }
    }));
}
 
源代码7 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
/**
 * Maps {@code JInternalFrame.setDesktopIcon(JDesktopIcon)} through queue
 */
public void setDesktopIcon(final JDesktopIcon jDesktopIcon) {
    runMapping(new MapVoidAction("setDesktopIcon") {
        @Override
        public void map() {
            ((JInternalFrame) getSource()).setDesktopIcon(jDesktopIcon);
        }
    });
}
 
源代码8 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
private static JInternalFrame findOne(ContainerOperator<?> cont, String text, int index) {
    Component source = waitComponent(cont,
            new JInternalFrameByTitleFinder(text,
                    cont.getComparator()),
            index);
    if (source instanceof JInternalFrame) {
        return (JInternalFrame) source;
    } else if (source instanceof JInternalFrame.JDesktopIcon) {
        return ((JInternalFrame.JDesktopIcon) source).getInternalFrame();
    } else {
        throw (new TimeoutExpiredException("No internal frame was found"));
    }
}
 
@Override
public void paintComponent(Graphics g) {
    Graphics2D graphics = (Graphics2D) g.create();
    // Desktop icon is translucent.
    final float coef = (this.getParent() instanceof JDesktopIcon) ? 0.9f : 1.0f;
    graphics.setComposite(WidgetUtilities.getAlphaComposite(this.frame, coef, g));

    boolean leftToRight = this.frame.getComponentOrientation().isLeftToRight();

    int width = this.getWidth();
    int height = this.getHeight() + 2;

    SubstanceColorScheme scheme = SubstanceCoreUtilities.getSkin(this.frame)
            .getEnabledColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE);
    JInternalFrame hostFrame = (JInternalFrame) SwingUtilities
            .getAncestorOfClass(JInternalFrame.class, this);
    JComponent hostForColorization = hostFrame;
    if (hostFrame == null) {
        // try desktop icon
        JDesktopIcon desktopIcon = (JDesktopIcon) SwingUtilities
                .getAncestorOfClass(JDesktopIcon.class, this);
        if (desktopIcon != null)
            hostFrame = desktopIcon.getInternalFrame();
        hostForColorization = desktopIcon;
    }
    Color backgr = hostFrame.getBackground();
    if (!(backgr instanceof UIResource)) {
        double colorization = SubstanceCoreUtilities.getColorizationFactor(hostForColorization);
        scheme = SubstanceColorSchemeUtilities.getShiftedScheme(scheme, backgr, colorization,
                null, 0.0);
    }

    BackgroundPaintingUtils.update(graphics, SubstanceInternalFrameTitlePane.this, false);

    String theTitle = this.frame.getTitle();
    String displayTitle = getDisplayTitle();

    Font font = SubstanceCortex.GlobalScope.getFontPolicy().getFontSet().getWindowTitleFont();
    graphics.setFont(font);

    if (displayTitle != null) {
        Rectangle titleTextRect = SubstanceTitlePaneUtilities.getTitlePaneTextRectangle(this,
                this.frame);
        FontMetrics fm = SubstanceMetricsUtilities.getFontMetrics(font);
        int displayTitleWidth = fm.stringWidth(displayTitle);

        // show tooltip with full title only if necessary
        if (theTitle.equals(displayTitle)) {
            this.setToolTipText(null);
        } else {
            this.setToolTipText(theTitle);
        }

        int xOffset = 0;
        SubstanceSlices.HorizontalGravity titleTextGravity = SubstanceTitlePaneUtilities
                .getTitlePaneTextGravity();
        switch (titleTextGravity) {
            case LEADING:
                xOffset = leftToRight ? titleTextRect.x
                        : titleTextRect.x + titleTextRect.width - displayTitleWidth;
                break;
            case TRAILING:
                xOffset = leftToRight
                        ? titleTextRect.x + titleTextRect.width - displayTitleWidth
                        : titleTextRect.x;
                break;
            default:
                xOffset = titleTextRect.x + (titleTextRect.width - displayTitleWidth) / 2;
        }

        int yOffset = titleTextRect.y + (int) ((titleTextRect.getHeight() - fm.getHeight()) / 2)
                + fm.getAscent();

        SubstanceColorScheme fillScheme = SubstanceCoreUtilities.getSkin(this.frame)
                .getBackgroundColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE);
        Color echoColor = !fillScheme.isDark() ? fillScheme.getUltraDarkColor()
                : fillScheme.getUltraLightColor();
        SubstanceTextUtilities.paintTextWithDropShadow(this, graphics,
                SubstanceColorUtilities.getForegroundColor(scheme), echoColor, displayTitle,
                width, height, xOffset, yOffset);
    }

    graphics.dispose();
}
 
源代码10 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
/**
 * Constructs JDesktopIconOperator.
 *
 * @param b a component
 */
public JDesktopIconOperator(JInternalFrame.JDesktopIcon b) {
    super(b);
    setOutput(JemmyProperties.getCurrentOutput());
    setTimeouts(JemmyProperties.getCurrentTimeouts());
}
 
源代码11 项目: openjdk-jdk9   文件: JInternalFrameOperator.java
@Override
public boolean checkComponent(Component comp) {
    return ((comp instanceof JInternalFrame || comp instanceof JInternalFrame.JDesktopIcon)
            && sf.checkComponent(comp));
}
 
 类所在包
 类方法
 同包方法