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:com.game.ui.views.UserDialog.java
public UserDialog(String message, JFrame frame) { setLayout(new BorderLayout(5, 5)); setModalityType(ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setResizable(false);/* w w w. j av a 2s .c o m*/ ImageIcon icon = null; try { icon = GameUtils.shrinkImage("warning.gif", 30, 30); } catch (IOException e) { System.out.println("Dialog : showDialogForMap(): Exception occured :" + e); e.printStackTrace(); } JPanel panel = new JPanel(); JLabel label = new JLabel(icon); panel.setLayout(new FlowLayout(FlowLayout.LEFT)); label.setText(message); label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); label.setHorizontalAlignment(0); panel.add(label); add(panel, BorderLayout.NORTH); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); txt = new JTextField(); txt.setPreferredSize(new Dimension(150, 30)); txt.setAlignmentX(.5f); txt.setMaximumSize(new Dimension(150, 30)); contentPanel.add(txt); contentPanel.add(Box.createVerticalStrut(10)); JButton btn = new JButton("Submit."); btn.setAlignmentX(.5f); btn.setPreferredSize(new Dimension(50, 25)); btn.addActionListener(this); validationMess = new JLabel("All fields are mandatory"); validationMess.setVisible(false); validationMess.setForeground(Color.red); validationMess.setAlignmentX(.5f); contentPanel.add(btn); contentPanel.add(Box.createVerticalStrut(10)); contentPanel.add(validationMess); contentPanel.add(Box.createVerticalGlue()); add(contentPanel, BorderLayout.CENTER); pack(); setSize(new Dimension(300, 200)); setLocationRelativeTo(frame); setVisible(true); }
From source file:ImageTransferTest.java
public ImageTransferFrame() { setTitle("ImageTransferTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); label = new JLabel(); image = new BufferedImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, BufferedImage.TYPE_INT_ARGB); Graphics g = image.getGraphics(); g.setColor(Color.WHITE);/* w w w . j a v a 2 s. com*/ g.fillRect(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT); g.setColor(Color.RED); g.fillOval(DEFAULT_WIDTH / 4, DEFAULT_WIDTH / 4, DEFAULT_WIDTH / 2, DEFAULT_HEIGHT / 2); label.setIcon(new ImageIcon(image)); add(new JScrollPane(label), BorderLayout.CENTER); JPanel panel = new JPanel(); JButton copyButton = new JButton("Copy"); panel.add(copyButton); copyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { copy(); } }); JButton pasteButton = new JButton("Paste"); panel.add(pasteButton); pasteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { paste(); } }); add(panel, BorderLayout.SOUTH); }
From source file:IHM.compargraph.java
/** * * @param title//from www.j av a2s . com * @param c1 * @param c2 * @param comp * */ public compargraph(String title, ArrayList<ReleveMeteo> c1, ArrayList<ReleveMeteo> c2, String comp) { super(title); t1 = c1; t2 = c2; c = comp; // jp = new JInternalFrame("courbes"); JFreeChart chart = createChart(createDataset()); ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new Dimension(500, 300)); setContentPane(panel); // jp.add(panel, BorderLayout.EAST); // jp.setVisible(true); panel.setVisible(true); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); // sets thickness for series (using strokes) renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(3.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f)); plot.setRenderer(renderer); plot.setOutlinePaint(Color.BLUE); plot.setOutlineStroke(new BasicStroke(2.0f)); plot.setBackgroundPaint(Color.DARK_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.BLACK); }
From source file:graficarordenamiento.Graficador.java
public void crearGrafico() { // Creando el Grafico chart = ChartFactory.createBarChart("Grfico de barras", null, null, dataset, PlotOrientation.VERTICAL, false, false, false);//w w w . j ava2 s . c o m chart.setBackgroundPaint(new GradientPaint(0, 0, Color.WHITE, 700, 0, Color.BLACK.brighter(), false)); chart.setBackgroundImageAlpha(0.5f); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); plot.setRangeGridlinePaint(Color.red); plot.setBackgroundPaint(new GradientPaint(0, 0, Color.LIGHT_GRAY, 0, 100, Color.darkGray)); plot.setBackgroundImageAlpha(0.5f); //plot.setDomainGridlinesVisible(true); BarRenderer rend = (BarRenderer) plot.getRenderer(); final ItemLabelPosition e = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); rend.setSeriesPaint(0, gp0); rend.setSeriesPaint(1, gp1); rend.setSeriesPaint(2, gp2); plot.setRenderer(rend); // change the margin at the top of the range axis... final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); // set up gradient paints for series... }
From source file:userInterface.cdcRole.OverviewJPanel.java
private static JFreeChart createChart1(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Distribution of Vaccines", "Vaccine", "Quantity", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangeCrosshairVisible(true); categoryplot.setRangeCrosshairPaint(Color.green); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 0, 64)); GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0)); GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0)); barrenderer.setSeriesPaint(0, gradientpaint); barrenderer.setSeriesPaint(1, gradientpaint1); barrenderer.setSeriesPaint(2, gradientpaint2); barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D)); return jfreechart; }
From source file:com.floreantpos.swing.ShopTableButton.java
public void update() { if (shopTable != null && shopTable.isServing()) { //setEnabled(false); setBackground(Color.red); setForeground(Color.BLACK); } else if (shopTable != null && shopTable.isBooked()) { setEnabled(false);// ww w. j a v a 2s . c om setOpaque(true); setBackground(Color.orange); setForeground(Color.BLACK); } else { setEnabled(true); setBackground(Color.white); setForeground(Color.black); } }
From source file:jgnash.ui.budget.BudgetSparkline.java
public static Icon getSparklineImage(final List<BigDecimal> amounts) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); final boolean[] negate = new boolean[amounts.size()]; for (int i = 0; i < amounts.size(); i++) { dataset.addValue(amounts.get(i), CATEGORY, i); negate[i] = amounts.get(i).signum() == -1; }/*w w w. ja v a 2s. com*/ CategoryAxis xAxis = new CategoryAxis(); xAxis.setTickLabelsVisible(false); xAxis.setTickMarksVisible(false); xAxis.setAxisLineVisible(false); xAxis.setVisible(false); NumberAxis yAxis = new NumberAxis(); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); yAxis.setAxisLineVisible(false); yAxis.setNegativeArrowVisible(false); yAxis.setPositiveArrowVisible(false); yAxis.setAutoRangeIncludesZero(true); yAxis.setAutoRange(true); yAxis.setVisible(false); BarRenderer renderer = new BarRenderer() { @Override public Paint getItemPaint(final int row, final int column) { return negate[column] ? Color.RED : Color.BLACK; } }; renderer.setShadowVisible(false); renderer.setBarPainter(new StandardBarPainter()); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setInsets(INSETS); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(false); plot.setBackgroundPaint(CLEAR); JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false); chart.setBorderVisible(false); chart.setBackgroundPaint(CLEAR); Icon icon = EMPTY_ICON; try { byte[] image = ENCODER .encode(chart.createBufferedImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, BufferedImage.BITMASK, null)); icon = new ImageIcon(image); } catch (IOException ex) { Logger.getLogger(BudgetSparkline.class.getName()).log(Level.SEVERE, null, ex); } return icon; }
From source file:Main.java
public WordSearcher(JTextComponent comp) { this.comp = comp; this.painter = new UnderlineHighlightPainter(Color.red); }
From source file:com.naval.gui.Gui.java
/** * Lays out the frame by setting this Client object to take up the full * frame display area./* ww w .jav a 2s .c o m*/ */ private void layoutFrame() { frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(this, BorderLayout.CENTER); hintBar.setBorder(BorderFactory.createLoweredBevelBorder()); hintBar.setForeground(Color.RED); frame.getContentPane().add(hintBar, BorderLayout.SOUTH); frame.validate(); }
From source file:jat.examples.ephemeris.DE405PropagatePlot.java
void doExample() { double tf = 3600 * 24 * 300; double[] y0 = { 2e8, 0, 0, 0, 24.2, 0 }; // initial state double[] y = new double[6]; PathUtil path = new PathUtil(); DE405Plus Eph = new DE405Plus(path); Eph.setFrame(DE405Frame.frame.HEE); Eph.printSteps = true;/* w ww . ja va 2 s . c o m*/ TimeAPL myTime = new TimeAPL(2003, 3, 1, 12, 0, 0); Eph.setIntegrationStartTime(myTime); Eph.bodyGravOnOff[body.SUN.ordinal()] = true; // Eph.planetOnOff[body.JUPITER.ordinal()] = true; FirstOrderIntegrator dp853 = new DormandPrince853Integrator(1.0e-8, tf / 10.0, 1.0e-10, 1.0e-10); dp853.addStepHandler(Eph.stepHandler); FirstOrderDifferentialEquations ode = Eph; dp853.integrate(ode, 0.0, y0, tf, y); // now y contains final state at // time tf if (print) { String nf = "%10.3f "; String format = nf + nf + nf + nf + nf; System.out.printf(format, tf, y[0], y[1], y[2], Eph.energy(tf, y)); System.out.println(); } Plot2DPanel p = new Plot2DPanel(); LinePlot l1 = new LinePlot("Jup. off", Color.RED, getXYforPlot(Eph.xsol, Eph.ysol)); l1.closed_curve = false; p.addPlot(l1); Eph.reset(); Eph.bodyGravOnOff[body.JUPITER.ordinal()] = true; dp853.integrate(ode, 0.0, y0, tf, y); // now y contains final state at LinePlot l2 = new LinePlot("Jup. on", Color.BLUE, getXYforPlot(Eph.xsol, Eph.ysol)); l2.closed_curve = false; p.addPlot(l2); VectorN EarthPos = null; try { EarthPos = Eph.get_planet_pos(body.EARTH, myTime); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } addPoint(p, "Earth", java.awt.Color.BLUE, EarthPos.x[0], EarthPos.x[1]); p.setLegendOrientation(PlotPanel.SOUTH); double plotSize = 2e8; p.setFixedBounds(0, -plotSize, plotSize); p.setFixedBounds(1, -plotSize, plotSize); new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }