当前位置: 首页>>代码示例>>Java>>正文


Java Component.getBackground方法代码示例

本文整理汇总了Java中java.awt.Component.getBackground方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getBackground方法的具体用法?Java Component.getBackground怎么用?Java Component.getBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Component的用法示例。


在下文中一共展示了Component.getBackground方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adaptColorSchemePreviewComponent

import java.awt.Component; //导入方法依赖的package包/类
private void adaptColorSchemePreviewComponent(ColorScheme colorScheme, Component comp, int index) {

		nameLabel.setText(colorScheme.getName());

		List<ColorRGB> colors = colorScheme.getColors();
		int colorCount = colors.size();
		Color background = comp.getBackground();
		for (int i = 0; i < colorPanels.length; ++i) {

			if (i < colorCount) {
				Color cColor = ColorRGB.convertToColor(colors.get(i));
				colorPanels[i].setBackground(cColor);
			} else {
				colorPanels[i].setBackground(background);
			}

		}

		colorSchemeComponent.setBackground(background);
		colorPanel.setBackground(background);

	}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:ColorSchemeComboBoxRenderer.java

示例2: deriveEmphColor

import java.awt.Component; //导入方法依赖的package包/类
private static Color deriveEmphColor(Component component) {
    // derive the color for emphasizing from background
    Color backColor = component.getBackground();
    Color emphColor;
    int backBrightness = (30*backColor.getRed()+59*backColor.getGreen()+11*backColor.getBlue())/100;
    if (backBrightness >= 128) {
        emphColor = backColor.darker();
    } else { // brightening a dark area seems visually less notable than darkening a bright area
        emphColor = backColor.brighter().brighter();
    }
    return emphColor;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:GridBagInfoProvider.java

示例3: paintIcon

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y)
{
	Color color = c == null ? Color.GRAY : c.getBackground();
	// In a compound sort, make each succesive triangle 20%
	// smaller than the previous one.
	int dx = (int) (size / 2.0d * Math.pow(0.8, priority));
	int dy = descending ? dx : -dx;
	// Align icon (roughly) with font baseline.
	y = y + 5 * size / 6 + (descending ? -dy : 0);
	int shift = descending ? 1 : -1;
	g.translate(x, y);

	// Right diagonal.
	g.setColor(color.darker());
	g.drawLine(dx / 2, dy, 0, 0);
	g.drawLine(dx / 2, dy + shift, 0, shift);

	// Left diagonal.
	g.setColor(color.brighter());
	g.drawLine(dx / 2, dy, dx, 0);
	g.drawLine(dx / 2, dy + shift, dx, shift);

	// Horizontal line.
	if( descending )
	{
		g.setColor(color.darker().darker());
	}
	else
	{
		g.setColor(color.brighter().brighter());
	}
	g.drawLine(dx, 0, 0, 0);

	g.setColor(color);
	g.translate(-x, -y);
}
 
开发者ID:equella,项目名称:Equella,代码行数:38,代码来源:TableSorter.java

示例4: paintBorder

import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color color = c.getBackground();

    if (origColor != color) {
        origColor = color;
        paintColor = new Color(~origColor.getRGB());
    }

    g.setColor(paintColor);
    BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:WindowsBorders.java

示例5: paintBorder

import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
{
	// choose which colors we want to use
	Color bg = c.getBackground();

	if (c.getParent() != null)
	{
		bg = c.getParent().getBackground();
	}

	if (bg != null)
	{
		Color mid = bg.darker();
		Color edge = average(mid, bg);

		g.setColor(bg);
		g.drawLine(0, h - 2, w, h - 2);
		g.drawLine(0, h - 1, w, h - 1);
		g.drawLine(w - 2, 0, w - 2, h);
		g.drawLine(w - 1, 0, w - 1, h);

		// draw the drop-shadow
		g.setColor(mid);
		g.drawLine(1, h - 2, w - 2, h - 2);
		g.drawLine(w - 2, 1, w - 2, h - 2);

		g.setColor(edge);
		g.drawLine(2, h - 1, w - 2, h - 1);
		g.drawLine(w - 1, 2, w - 1, h - 2);
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:32,代码来源:ShadowBorder.java

示例6: paintBorder

import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
  // choose which colors we want to use
  Color bg = c.getBackground();

  if (c.getParent() != null) {
    bg = c.getParent().getBackground();
  }

  if (bg != null) {
    Color mid = bg.darker();
    Color edge = average(mid, bg);

    g.setColor(bg);
    g.drawLine(0, h - 2, w, h - 2);
    g.drawLine(0, h - 1, w, h - 1);
    g.drawLine(w - 2, 0, w - 2, h);
    g.drawLine(w - 1, 0, w - 1, h);

    // draw the drop-shadow
    g.setColor(mid);
    g.drawLine(1, h - 2, w - 2, h - 2);
    g.drawLine(w - 2, 1, w - 2, h - 2);

    g.setColor(edge);
    g.drawLine(2, h - 1, w - 2, h - 1);
    g.drawLine(w - 1, 2, w - 1, h - 2);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:29,代码来源:ShadowBorder.java

示例7: paintIcon

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
	Color color = c == null ? Color.GRAY : c.getBackground();
	// In a compound sort, make each succesive triangle 20%
	// smaller than the previous one.
	int dx = (int) (size / 2 * Math.pow(0.8, priority));
	int dy = descending ? dx : -dx;
	// Align icon (roughly) with font baseline.
	y = y + 5 * size / 6 + (descending ? -dy : 0);
	int shift = descending ? 1 : -1;
	g.translate(x, y);

	// Right diagonal.
	g.setColor(color.darker());
	g.drawLine(dx / 2, dy, 0, 0);
	g.drawLine(dx / 2, dy + shift, 0, shift);

	// Left diagonal.
	g.setColor(color.brighter());
	g.drawLine(dx / 2, dy, dx, 0);
	g.drawLine(dx / 2, dy + shift, dx, shift);

	// Horizontal line.
	if (descending) {
		g.setColor(color.darker().darker());
	} else {
		g.setColor(color.brighter().brighter());
	}
	g.drawLine(dx, 0, 0, 0);

	g.setColor(color);
	g.translate(-x, -y);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:34,代码来源:TableSorter.java

示例8: paintIcon

import java.awt.Component; //导入方法依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {

            Color color = c == null ? Color.GRAY
                                    : c.getBackground();

            // In a compound sort, make each succesive triangle 20%
            // smaller than the previous one.
            int dx = (int) (size / 2 * Math.pow(0.8, priority));
            int dy = descending ? dx
                                : -dx;

            // Align icon (roughly) with font baseline.
            y = y + 5 * size / 6 + (descending ? -dy
                                               : 0);

            int shift = descending ? 1
                                   : -1;

            g.translate(x, y);

            // Right diagonal.
            g.setColor(color.darker());
            g.drawLine(dx / 2, dy, 0, 0);
            g.drawLine(dx / 2, dy + shift, 0, shift);

            // Left diagonal.
            g.setColor(color.brighter());
            g.drawLine(dx / 2, dy, dx, 0);
            g.drawLine(dx / 2, dy + shift, dx, shift);

            // Horizontal line.
            if (descending) {
                g.setColor(color.darker().darker());
            } else {
                g.setColor(color.brighter().brighter());
            }

            g.drawLine(dx, 0, 0, 0);
            g.setColor(color);
            g.translate(-x, -y);
        }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:42,代码来源:TableSorter.java

示例9: paintIcon

import java.awt.Component; //导入方法依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {

            Color color = c == null ? Color.gray
                                    : c.getBackground();

            // In a compound sort, make each succesive triangle 20%
            // smaller than the previous one.
            int dx = (int) (size / 2 * Math.pow(0.8, priority));
            int dy = descending ? dx
                                : -dx;

            // Align icon (roughly) with font baseline.
            y = y + 5 * size / 6 + (descending ? -dy
                                               : 0);

            int shift = descending ? 1
                                   : -1;

            g.translate(x, y);

            // Right diagonal.
            g.setColor(color.darker());
            g.drawLine(dx / 2, dy, 0, 0);
            g.drawLine(dx / 2, dy + shift, 0, shift);

            // Left diagonal.
            g.setColor(color.brighter());
            g.drawLine(dx / 2, dy, dx, 0);
            g.drawLine(dx / 2, dy + shift, dx, shift);

            // Horizontal line.
            if (descending) {
                g.setColor(color.darker().darker());
            } else {
                g.setColor(color.brighter().brighter());
            }

            g.drawLine(dx, 0, 0, 0);
            g.setColor(color);
            g.translate(-x, -y);
        }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:42,代码来源:TableSorter.java


注:本文中的java.awt.Component.getBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。