List of usage examples for java.awt Color RED
Color RED
To view the source code for java.awt Color RED.
Click Source Link
From source file:Commander.Main.java
/** * Creates new form Main/*from w w w . j a va 2 s . co m*/ */ public Main(java.awt.Frame parent, boolean modal) { super(parent, modal); //Set tranparant Color transparant = new Color(0, 0, 0, 0); setUndecorated(true); getRootPane().setOpaque(false); getContentPane().setBackground(transparant); setBackground(transparant); initComponents(); //Set components transparant transparant = new Color(0, 0, 0, 1); txtCommand.setBackground(transparant); txtCommand.setForeground(Color.GREEN); txtCommand.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 150))); jScrollPane1.getViewport().setBackground(transparant); jScrollPane1.getViewport().setOpaque(false); txtError.setBackground(transparant); txtError.setForeground(Color.RED); txtError.setEditable(false); txtError.setFocusable(false); jScrollPane1.setVisible(false); setAlwaysOnTop(true); pack(); Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); int width = getPreferredSize().width; int height = getPreferredSize().height; setLocation(screen.width - width - 20, screen.height - height - 20); txtCommand.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { if (jScrollPane1.isVisible()) { jScrollPane1.setVisible(false); } } @Override public void removeUpdate(DocumentEvent e) { if (jScrollPane1.isVisible()) { jScrollPane1.setVisible(false); } } @Override public void changedUpdate(DocumentEvent e) { //Not supported } }); String home = System.getProperty("user.home"); defaultLocations[0] = home + "/Documents"; defaultLocations[1] = home + "/Pictures"; defaultLocations[2] = home + "/Downloads"; defaultLocations[3] = home + "/Music"; // run("Casino.jar", new ArrayList<>()); }
From source file:ToolBarTest.java
public ToolBarFrame() { setTitle("ToolBarTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // add a panel for color change panel = new JPanel(); add(panel, BorderLayout.CENTER); // set up actions Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE); Action yellowAction = new ColorAction("Yellow", new ImageIcon("yellow-ball.gif"), Color.YELLOW); Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED); Action exitAction = new AbstractAction("Exit", new ImageIcon("exit.gif")) { public void actionPerformed(ActionEvent event) { System.exit(0);//from w ww. j a v a 2 s.c o m } }; exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit"); // populate tool bar JToolBar bar = new JToolBar(); bar.add(blueAction); bar.add(yellowAction); bar.add(redAction); bar.addSeparator(); bar.add(exitAction); add(bar, BorderLayout.NORTH); // populate menu JMenu menu = new JMenu("Color"); menu.add(yellowAction); menu.add(blueAction); menu.add(redAction); menu.add(exitAction); JMenuBar menuBar = new JMenuBar(); menuBar.add(menu); setJMenuBar(menuBar); }
From source file:net.sf.statcvs.output.xml.chart.AuthorsActivityChart.java
public AuthorsActivityChart(CvsContent content) { super("activity.png", "Author Activity"); setCategoryAxisLabel(""); setValueAxisLabel("%"); CategoryPlot plot = getChart().getCategoryPlot(); plot.getRenderer().setSeriesPaint(REMOVING, Color.red); plot.getRenderer().setSeriesPaint(CHANGING, Color.yellow); plot.getRenderer().setSeriesPaint(ADDING, Color.green); plot.getDomainAxis().setVerticalCategoryLabels(true); Collection auts = content.getAuthors(); Iterator it = auts.iterator(); while (it.hasNext()) { Author author = (Author) it.next(); authors.add(author.getName());/*from ww w . j a v a2 s .c om*/ } Collections.sort(authors); double[][] categories; categories = new double[3][authors.size()]; for (int j = 0; j < authors.size(); j++) { categories[REMOVING][j] = 0; categories[CHANGING][j] = 0; categories[ADDING][j] = 0; } RevisionIterator revIt = content.getRevisionIterator(); CommitListBuilder commitList = new CommitListBuilder(revIt); List commits = commitList.createCommitList(); Iterator commitIt = commits.iterator(); while (commitIt.hasNext()) { Commit commit = (Commit) commitIt.next(); List commitRevList = commit.getRevisions(); Iterator commitRevIt = commitRevList.iterator(); int author = authors.indexOf(commit.getAuthor().getName()); int linesAdded = 0; int linesRemoved = 0; while (commitRevIt.hasNext()) { CvsRevision revision = (CvsRevision) commitRevIt.next(); linesAdded += revision.getLineValue(); linesRemoved += revision.getRemovingValue(); } if (linesAdded == linesRemoved) { categories[CHANGING][author] += linesAdded; } if (linesAdded < linesRemoved) { categories[CHANGING][author] += linesAdded; categories[REMOVING][author] += linesRemoved - linesAdded; } if (linesAdded > linesRemoved) { categories[ADDING][author] += linesAdded - linesRemoved; categories[CHANGING][author] += linesRemoved; } } for (int i = 0; i < authors.size(); i++) { double maxLines = categories[REMOVING][i] + categories[CHANGING][i] + categories[ADDING][i]; for (int k = 0; k < 3; k++) { categories[k][i] *= (100 / maxLines); dataset.addValue(categories[k][i], topics[k], (String) authors.get(i)); } } placeTitle(); }
From source file:FillTest.java
public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; // draw a rectangle double leftX = 100; double topY = 100; double width = 200; double height = 150; Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height); g2.setPaint(Color.RED); g2.fill(rect);/*from w ww . j a v a2 s. c om*/ // draw the enclosed ellipse Ellipse2D ellipse = new Ellipse2D.Double(); ellipse.setFrame(rect); g2.setPaint(new Color(0, 128, 128)); // a dull blue-green g2.fill(ellipse); }
From source file:com.jpetrak.gate.scala.gui.ScalaEditorPanel.java
public void setCompilationError() { jTextField1.setForeground(Color.red); }
From source file:unusedClasses.MemoryUsageDemo.java
public MemoryUsageDemo(int paramInt) { super(new BorderLayout()); this.total.setMaximumItemAge(paramInt); this.free = new TimeSeries("Free Memory"); this.free.setMaximumItemAge(paramInt); TimeSeriesCollection localTimeSeriesCollection = new TimeSeriesCollection(); localTimeSeriesCollection.addSeries(this.total); localTimeSeriesCollection.addSeries(this.free); DateAxis localDateAxis = new DateAxis("Time"); NumberAxis localNumberAxis = new NumberAxis("Memory"); localDateAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localNumberAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localDateAxis.setLabelFont(new Font("SansSerif", 0, 14)); localNumberAxis.setLabelFont(new Font("SansSerif", 0, 14)); XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer(true, false); localXYLineAndShapeRenderer.setSeriesPaint(0, Color.red); localXYLineAndShapeRenderer.setSeriesPaint(1, Color.green); localXYLineAndShapeRenderer.setSeriesStroke(0, new BasicStroke(3.0F, 0, 2)); localXYLineAndShapeRenderer.setSeriesStroke(1, new BasicStroke(3.0F, 0, 2)); XYPlot localXYPlot = new XYPlot(localTimeSeriesCollection, localDateAxis, localNumberAxis, localXYLineAndShapeRenderer); localDateAxis.setAutoRange(true);/*from ww w .j a v a 2 s .c o m*/ localDateAxis.setLowerMargin(0.0D); localDateAxis.setUpperMargin(0.0D); localDateAxis.setTickLabelsVisible(true); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart localJFreeChart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), localXYPlot, true); ChartUtilities.applyCurrentTheme(localJFreeChart); ChartPanel localChartPanel = new ChartPanel(localJFreeChart, true); localChartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(localChartPanel); }
From source file:RasterImageTest.java
/** * Makes the Mandelbrot image.// w w w. j a v a2s. c o m * @param width the width * @parah height the height * @return the image */ public BufferedImage makeMandelbrot(int width, int height) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); WritableRaster raster = image.getRaster(); ColorModel model = image.getColorModel(); Color fractalColor = Color.red; int argb = fractalColor.getRGB(); Object colorData = model.getDataElements(argb, null); for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { double a = XMIN + i * (XMAX - XMIN) / width; double b = YMIN + j * (YMAX - YMIN) / height; if (!escapesToInfinity(a, b)) raster.setDataElements(i, j, colorData); } return image; }
From source file:com.googlecode.snoopycp.controller.DomainController.java
public Transformer<String, Paint> createFillTransformer() { return new Transformer<String, Paint>() { @Override//from w w w .ja va2 s.c o m public Paint transform(String vertex) { if (domain.enviroment().get(vertex) == null) { return Color.GRAY; } else { Ice.Identity identity = domain.enviroment().get(vertex); String state = domain.cache(identity).get("state"); if (state.equals("OnlineState")) { return Color.YELLOW; } else if (state.equals("ActiveState")) { return Color.RED; } else { return Color.BLUE; } } } }; }
From source file:com.pureinfo.srm.common.ImageHelper.java
private static Color getColor() { Color[] names = new Color[] { Color.WHITE, Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.DARK_GRAY };/*from w ww .j a v a2s . c o m*/ return names[Math.abs(random.nextInt()) % names.length]; }
From source file:AntiAlias.java
/** Draw the example */ public void paint(Graphics g1) { Graphics2D g = (Graphics2D) g1; BufferedImage image = // Create an off-screen image new BufferedImage(65, 35, BufferedImage.TYPE_INT_RGB); Graphics2D ig = image.createGraphics(); // Get its Graphics for drawing // Set the background to a gradient fill. The varying color of // the background helps to demonstrate the anti-aliasing effect ig.setPaint(new GradientPaint(0, 0, Color.black, 65, 35, Color.white)); ig.fillRect(0, 0, 65, 35);//from ww w .j a v a 2s.c om // Set drawing attributes for the foreground. // Most importantly, turn on anti-aliasing. ig.setStroke(new BasicStroke(2.0f)); // 2-pixel lines ig.setFont(new Font("Serif", Font.BOLD, 18)); // 18-point font ig.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); // Now draw pure blue text and a pure red oval ig.setColor(Color.blue); ig.drawString("Java", 9, 22); ig.setColor(Color.red); ig.drawOval(1, 1, 62, 32); // Finally, scale the image by a factor of 10 and display it // in the window. This will allow us to see the anti-aliased pixels g.drawImage(image, AffineTransform.getScaleInstance(10, 10), this); // Draw the image one more time at its original size, for comparison g.drawImage(image, 0, 0, this); }