Java Code Examples for java.awt.Component#isOpaque()

The following examples show how to use java.awt.Component#isOpaque() . 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
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque()
{
    Color back = getBackground();

    Component p = getParent();

    if (p != null)
    {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null)
            && back.equals(p.getBackground()) && p.isOpaque();

    return !colorMatch && super.isOpaque();
}
 
Example 2
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 3
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 4
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 5
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 6
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 7
Source Project: Java8CN   File: DefaultListCellRenderer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 8
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 9
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 10
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 11
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 12
Source Project: pumpernickel   File: DecoratedTreeUI.java    License: MIT License 5 votes vote down vote up
/**
 * This is copied from BasicTreeUI.java. The only modifications are:
 * <ul>
 * <li>The background color is painted across the entire width of the tree.</li>
 * <li>Because of the above requirement: the expand control is redundantly
 * painted on top of that rectangle for visibility.</li>
 * <li>We never inform the CellRenderer whether focus is present. (That
 * argument is left false, because we don't have access to private fields
 * the original logic wanted.)</li>
 * </ul>
 */
@Override
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets,
		Rectangle bounds, TreePath path, int row, boolean isExpanded,
		boolean hasBeenExpanded, boolean isLeaf) {
	// Don't paint the renderer if editing this row.
	if (editingComponent != null && editingRow == row)
		return;

	// this is in BasicTreeUI, but getLeadSelectionRow() is private.
	/*
	 * int leadIndex;
	 * 
	 * if(tree.hasFocus()) { leadIndex = getLeadSelectionRow(); } else
	 * leadIndex = -1;
	 */

	Component component;

	component = currentCellRenderer.getTreeCellRendererComponent(tree,
			path.getLastPathComponent(), tree.isRowSelected(row),
			isExpanded, isLeaf, row, false);

	if (component.isOpaque()) {
		Color bkgnd = component.getBackground();
		g.setColor(bkgnd);
		g.fillRect(0, bounds.y, tree.getWidth(), bounds.height);

		if (shouldPaintExpandControl(path, row, isExpanded,
				hasBeenExpanded, isLeaf)) {
			paintExpandControl(g, bounds, insets, bounds, path, row,
					isExpanded, hasBeenExpanded, isLeaf);
		}
	}

	rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y,
			bounds.width, bounds.height, true);
}
 
Example 13
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 14
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 15
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 16
/**
 * Overridden for performance reasons.
 */
@Override
public boolean isOpaque() {
  Color back = getBackground();
  Component p = getParent();
  if(p != null) {
    p = p.getParent();
  }

  // p should now be the JTable.
  boolean colorMatch = (back != null) && (p != null)
          && back.equals(p.getBackground()) && p.isOpaque();
  return !colorMatch && super.isOpaque();
}
 
Example 17
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 */
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }

    // p should now be the JTable.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 18
@Override
public boolean isOpaque()
{
	Color back = getBackground();
	Component p = getParent();
	if (p != null)
	{
		p = p.getParent();
	}

	// p should now be the JTable. 
	boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque();
	return !colorMatch && super.isOpaque();
}
 
Example 19
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}
 
Example 20
/**
 * Overridden for performance reasons.
 * See the <a href="#override">Implementation Note</a>
 * for more information.
 *
 * @since 1.5
 * @return <code>true</code> if the background is completely opaque
 *         and differs from the JList's background;
 *         <code>false</code> otherwise
 */
@Override
public boolean isOpaque() {
    Color back = getBackground();
    Component p = getParent();
    if (p != null) {
        p = p.getParent();
    }
    // p should now be the JList.
    boolean colorMatch = (back != null) && (p != null) &&
        back.equals(p.getBackground()) &&
                    p.isOpaque();
    return !colorMatch && super.isOpaque();
}