Java Code Examples for java.awt.Color#BLACK

The following examples show how to use java.awt.Color#BLACK . 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: MgrsLayerController.java    From defense-solutions-proofs-of-concept with Apache License 2.0 6 votes vote down vote up
public MgrsLayerController(
        MapController mapController,
        AppConfigController appConfig) {
    super(mapController, "MGRS");
    appConfigController = appConfig;
    textSymbol = new TextSymbol(SYMBOL_SIZE, "", Color.BLACK);
    textSymbol.setHorizontalAlignment(TextSymbol.HorizontalAlignment.CENTER);
    textSymbol.setVerticalAlignment(TextSymbol.VerticalAlignment.MIDDLE);
    haloSymbol = new TextSymbol(SYMBOL_SIZE, "", Color.WHITE);
    haloSymbol.setHorizontalAlignment(TextSymbol.HorizontalAlignment.CENTER);
    haloSymbol.setVerticalAlignment(TextSymbol.VerticalAlignment.MIDDLE);
    setOverlayLayer(true);
    if (null != mapController.getLocationController()) {
        mapController.getLocationController().addListener(this);
    }
}
 
Example 2
Source File: JPanel_Terminal.java    From MobyDroid with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new form JPanel_ManageApps
 *
 */
public JPanel_Terminal() {
    // initialize components
    initComponents();

    // initialize JTerm
    JTermInputProcessor termProcessor = (String command, JTerm console) -> {
        if (jShellTransport == null) {
            updateShellTransport();
        }
        if (jShellTransport != null) {
            try {
                console.remove(command.length());
                jShellTransport.write(command);
            } catch (IOException ex) {
                jShellTransport = null;
                Log.log(Level.SEVERE, "ShellTransportWrite", ex);
            }
        }
    };

    jTerm = new JTerm(jTextPane_Jterm, termProcessor, Color.BLACK, Color.GREEN, new Font(Font.MONOSPACED, Font.BOLD, 12));
}
 
Example 3
Source File: MultiResolutionDrawImageWithTransformTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Color getImageColor(Image image, double configScale,
        double transformScale) {

    TestSurfaceData surface = new TestSurfaceData(SCREEN_SIZE, SCREEN_SIZE,
            configScale);
    SunGraphics2D g2d = new SunGraphics2D(surface,
            Color.BLACK, Color.BLACK, null);
    g2d.setRenderingHint(KEY_RESOLUTION_VARIANT,
            VALUE_RESOLUTION_VARIANT_SIZE_FIT);
    AffineTransform tx = AffineTransform.getScaleInstance(transformScale,
            transformScale);
    g2d.drawImage(image, tx, null);
    g2d.dispose();

    int backgroundX = (int) (1.5 * image.getWidth(null) * transformScale);
    int backgroundY = (int) (1.5 * image.getHeight(null) * transformScale);
    Color backgroundColor = surface.getColor(backgroundX, backgroundY);
    //surface.show(String.format("Config: %f, transform: %f", configScale, transformScale));
    if (!BACKGROUND_COLOR.equals(backgroundColor)) {
        throw new RuntimeException("Wrong background color!");
    }
    return surface.getColor(IMAGE_SIZE / 4, IMAGE_SIZE / 4);
}
 
Example 4
Source File: SpaceFieldFactory.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * @see ghidra.app.util.viewer.field.FieldFactory#getField(ProxyObj, int)
 */
@Override
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
	Object obj = proxy.getObject();

	if (!enabled || !(obj instanceof CodeUnit)) {
		return null;
	}
	CodeUnit cu = (CodeUnit) obj;

	if (cu.hasProperty(CodeUnit.SPACE_PROPERTY)) {

		try {
			int n = cu.getIntProperty(CodeUnit.SPACE_PROPERTY);
			if (n == 0) {
				cu.removeProperty(CodeUnit.SPACE_PROPERTY);
				return null;
			}
			else if (n < 0) {
				n = -n;
			}
			FieldElement[] fes = new FieldElement[n];
			AttributedString as = new AttributedString("", Color.BLACK, getMetrics());
			for (int i = 0; i < n; i++) {
				fes[i] = new TextFieldElement(as, 0, 0);
			}

			return ListingTextField.createMultilineTextField(this, proxy, fes,
				startX + varWidth, width, n + 1, hlProvider);
		}
		catch (NoValueException e) {
		}

	}
	return null;
}
 
Example 5
Source File: FilterBar.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void paint(Graphics g)
{
	Color b;
	Color f;
	if (entered)
	{
		b = UIManager.getColor("controlDkShadow");
		f = Color.BLACK;
	}
	else
	{
		b = UIManager.getColor("control");
		f = UIManager.getColor("controlDkShadow");
	}
	g.setColor(b);
	g.fillRect(0, 0, getWidth(), getHeight());
	int center = getWidth() / 2;
	int[] xs = {center, center - 3, center + 3};
	int[] ys;
	if (open)
	{
		ys = YUP;

	}
	else
	{
		ys = YDOWN;
	}
	g.setColor(f);
	g.drawPolygon(xs, ys, 3);
	g.fillPolygon(xs, ys, 3);
}
 
Example 6
Source File: Connection.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected Connection(InputSlot inputSlot, OutputSlot outputSlot) {
    this.inputSlot = inputSlot;
    this.outputSlot = outputSlot;
    this.inputSlot.connections.add(this);
    this.outputSlot.connections.add(this);
    controlPoints = new ArrayList<Point>();
    Figure sourceFigure = this.outputSlot.getFigure();
    Figure destFigure = this.inputSlot.getFigure();
    sourceFigure.addSuccessor(destFigure);
    destFigure.addPredecessor(sourceFigure);
    source = new Source();

    this.color = Color.BLACK;
    this.style = ConnectionStyle.NORMAL;
}
 
Example 7
Source File: WindowsLookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Object configureValue(Object value) {
    Object highContrastOn = Toolkit.getDefaultToolkit().
            getDesktopProperty("win.highContrast.on");
    if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
        return Color.BLACK;
    }
    return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
}
 
Example 8
Source File: OutputOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Color getDefaultColorStandard() {
    Color out = UIManager.getColor("nb.output.foreground");         //NOI18N
    if (out == null) {
        out = UIManager.getColor("TextField.foreground");           //NOI18N
        if (out == null) {
            out = Color.BLACK;
        }
    }
    return out;
}
 
Example 9
Source File: WindowsLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Object configureValue(Object value) {
    Object highContrastOn = Toolkit.getDefaultToolkit().
            getDesktopProperty("win.highContrast.on");
    if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
        return Color.BLACK;
    }
    return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
}
 
Example 10
Source File: Particle.java    From algs4 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes a particle with a random position and velocity.
 * The position is uniform in the unit box; the velocity in
 * either direciton is chosen uniformly at random.
 */
public Particle() {
    rx     = StdRandom.uniform(0.0, 1.0);
    ry     = StdRandom.uniform(0.0, 1.0);
    vx     = StdRandom.uniform(-0.005, 0.005);
    vy     = StdRandom.uniform(-0.005, 0.005);
    radius = 0.02;
    mass   = 0.5;
    color  = Color.BLACK;
}
 
Example 11
Source File: WindowsLookAndFeel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Object configureValue(Object value) {
    Object highContrastOn = Toolkit.getDefaultToolkit().
            getDesktopProperty("win.highContrast.on");
    if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
        return Color.BLACK;
    }
    return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
}
 
Example 12
Source File: HeatChart.java    From SAX with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a heatmap for the given z-values against x/y-values that by default will be the
 * values 0 to n-1, where n is the number of columns or rows.
 * 
 * @param zValues the z-values, where each element is a row of z-values in the resultant heat
 * chart.
 * @param low the minimum possible value, which may or may not appear in the z-values.
 * @param high the maximum possible value, which may or may not appear in the z-values.
 */
public HeatChart(double[][] zValues, double low, double high) {
  this.zValues = zValues;
  this.lowValue = low;
  this.highValue = high;

  // Default x/y-value settings.
  setXValues(0, 1);
  setYValues(0, 1);

  // Default chart settings.
  this.cellSize = new Dimension(20, 20);
  // this.margin = 10;
  this.margin = 10;
  this.backgroundColour = Color.WHITE;

  // Default title settings.
  this.title = null;
  // this.titleFont = new Font("Sans-Serif", Font.BOLD, 16);
  this.titleFont = new Font("Sans-Serif", Font.BOLD, 12);
  this.titleColour = Color.BLACK;

  // Default axis settings.
  this.xAxisLabel = null;
  this.yAxisLabel = null;
  this.axisThickness = 2;
  this.axisColour = Color.BLACK;
  // this.axisLabelsFont = new Font("Sans-Serif", Font.PLAIN, 12);
  this.axisLabelsFont = new Font("Sans-Serif", Font.PLAIN, 10);
  this.axisLabelColour = Color.BLACK;
  this.axisValuesColour = Color.BLACK;
  // this.axisValuesFont = new Font("Sans-Serif", Font.PLAIN, 10);
  this.axisValuesFont = new Font("Sans-Serif", Font.PLAIN, 8);
  this.xAxisValuesFrequency = 1;
  this.xAxisValuesHeight = 0;
  this.xValuesHorizontal = false;
  // this.showXAxisValues = true;
  this.showXAxisValues = false;
  // this.showYAxisValues = true;
  this.showYAxisValues = false;
  this.yAxisValuesFrequency = 1;
  this.yAxisValuesHeight = 0;
  this.yValuesHorizontal = true;

  // Default heatmap settings.
  this.highValueColour = Color.BLACK;
  this.lowValueColour = Color.WHITE;
  this.colourScale = SCALE_LINEAR;

  // updateColourDistance();
}
 
Example 13
Source File: VertexTest.java    From javascad with GNU General Public License v2.0 4 votes vote down vote up
@Test(expected = IllegalValueException.class)
public void coordsShouldNotBeNull() {
	new Vertex(null, Color.BLACK);
}
 
Example 14
Source File: BackendAPIRestApplication.java    From opencps-v2 with GNU Affero General Public License v3.0 4 votes vote down vote up
@GET
	@Path("/barcode")
	@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })

	public Response getBarcode(@Context HttpServletRequest request, @Context HttpHeaders header,
			@Context Company company, @Context Locale locale, @Context User user,
			@Context ServiceContext serviceContext, @QueryParam("value") String value, @QueryParam("font") String font) {
		try {
			Code128 barcode = new Code128();
			barcode.setFontName("Monospaced");
			barcode.setFontSize(Validator.isNotNull(font) ? Integer.valueOf(font) : ConstantUtils.DEFAULT_FONT_SIZE);
			barcode.setModuleWidth(2);
			barcode.setBarHeight(50);
			barcode.setHumanReadableLocation(HumanReadableLocation.BOTTOM);
			barcode.setContent(value);

			int width = barcode.getWidth();
			int height = barcode.getHeight();

			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
			Graphics2D g2d = image.createGraphics();
			Java2DRenderer renderer = new Java2DRenderer(g2d, 1, Color.WHITE, Color.BLACK);
			renderer.render(barcode);
			String uuid = UUID.randomUUID().toString();
			File destDir = new File("barcode");
			if (!destDir.exists()) {
				destDir.mkdir();
			}
			File file = new File("barcode/" + uuid + ".png");
			if (!file.exists()) {
				file.createNewFile();				
			}
			if (file.exists()) {
				ImageIO.write(image, "png", file);
	//			String fileType = Files.probeContentType(file.toPath());
				ResponseBuilder responseBuilder = Response.ok((Object) file);

				responseBuilder.header("Content-Disposition",
						"attachment; filename=\"" + file.getName() + "\"");
				responseBuilder.header("Content-Type", "image/png");

				return responseBuilder.build();
			} else {				
				return Response.status(HttpURLConnection.HTTP_NO_CONTENT).build();
			}

		} catch (Exception e) {
//			e.printStackTrace();
			_log.debug(e);
			return Response.status(HttpURLConnection.HTTP_NO_CONTENT).build();
		}		
	}
 
Example 15
Source File: Decoration.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void drawTextAndDecorations(Label label,
                            Graphics2D g2d,
                            float x,
                            float y) {

    if (fgPaint == null && bgPaint == null && swapColors == false) {
        drawTextAndEmbellishments(label, g2d, x, y);
    }
    else {
        Paint savedPaint = g2d.getPaint();
        Paint foreground, background;

        if (swapColors) {
            background = fgPaint==null? savedPaint : fgPaint;
            if (bgPaint == null) {
                if (background instanceof Color) {
                    Color bg = (Color)background;
                    // 30/59/11 is standard weights, tweaked a bit
                    int brightness = 33 * bg.getRed()
                        + 53 * bg.getGreen()
                        + 14 * bg.getBlue();
                    foreground = brightness > 18500 ? Color.BLACK : Color.WHITE;
                } else {
                    foreground = Color.WHITE;
                }
            } else {
                foreground = bgPaint;
            }
        }
        else {
            foreground = fgPaint==null? savedPaint : fgPaint;
            background = bgPaint;
        }

        if (background != null) {

            Rectangle2D bgArea = label.getLogicalBounds();
            bgArea = new Rectangle2D.Float(x + (float)bgArea.getX(),
                                        y + (float)bgArea.getY(),
                                        (float)bgArea.getWidth(),
                                        (float)bgArea.getHeight());

            g2d.setPaint(background);
            g2d.fill(bgArea);
        }

        g2d.setPaint(foreground);
        drawTextAndEmbellishments(label, g2d, x, y);
        g2d.setPaint(savedPaint);
    }
}
 
Example 16
Source File: ScaledDialPointer.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 */
public ScaledDialPointer(int scale) {
	this(0, 0.03, Color.BLACK, Color.BLACK, scale);
}
 
Example 17
Source File: EmptyFieldElement.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public Color getColor(int charIndex) {
	return Color.BLACK;
}
 
Example 18
Source File: Filtering.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
private static BufferedImage dropShadow(BufferedImage src, int blurX, int blurY, float angle, double distance, Color color, boolean inner, int iterations, float strength, boolean knockout) {
    int width = src.getWidth();
    int height = src.getHeight();
    int[] srcPixels = getRGB(src);
    int[] shadow = new int[srcPixels.length];
    for (int i = 0; i < srcPixels.length; i++) {
        int alpha = (srcPixels[i] >> 24) & 0xff;
        if (inner) {
            alpha = 255 - alpha;
        }

        shadow[i] = RGBA.toInt(color.getRed(), color.getGreen(), color.getBlue(), cut(color.getAlpha() * alpha / 255 * strength));
    }

    Color colorFirst = Color.BLACK;
    Color colorAlpha = ALPHA;
    double angleRad = angle / 180 * Math.PI;
    double moveX = (distance * Math.cos(angleRad));
    double moveY = (distance * Math.sin(angleRad));
    shadow = moveRGB(width, height, shadow, moveX, moveY, inner ? colorFirst : colorAlpha);

    if (blurX > 0 || blurY > 0) {
        blur(shadow, width, height, blurX, blurY, iterations, null);
    }

    for (int i = 0; i < shadow.length; i++) {
        int mask = (srcPixels[i] >> 24) & 0xff;
        if (!inner) {
            mask = 255 - mask;
        }
        shadow[i] = shadow[i] & 0xffffff + ((mask * ((shadow[i] >> 24) & 0xff) / 255) << 24);
    }

    BufferedImage retCanvas = new BufferedImage(width, height, src.getType());
    setRGB(retCanvas, width, height, shadow);

    if (!knockout) {
        Graphics2D g = retCanvas.createGraphics();
        g.setComposite(AlphaComposite.DstOver);
        g.drawImage(src, 0, 0, null);
    }

    return retCanvas;
}
 
Example 19
Source File: java_awt_GradientPaint.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected GradientPaint getObject() {
    return new GradientPaint(0.1f, 0.2f, Color.BLACK, 0.3f, 0.4f, Color.WHITE, true);
}
 
Example 20
Source File: ShadowRenderer.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * <p>Creates a default good looking shadow generator.
 * The default shadow renderer provides the following default values:
 * <ul>
 *   <li><i>size</i>: 5 pixels</li>
 *   <li><i>opacity</i>: 50%</li>
 *   <li><i>color</i>: Black</li>
 * </ul></p>
 * <p>These properties provide a regular, good looking shadow.</p>
 */
public ShadowRenderer() {
    this(5, 0.5f, Color.BLACK);
}