List of usage examples for java.awt Color blue
Color blue
To view the source code for java.awt Color blue.
Click Source Link
From source file:ButtonTest.java
public ButtonFrame() { setTitle("ButtonTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // create buttons JButton yellowButton = new JButton("Yellow"); JButton blueButton = new JButton("Blue"); JButton redButton = new JButton("Red"); buttonPanel = new JPanel(); // add buttons to panel buttonPanel.add(yellowButton);//from w w w. ja v a 2 s .c om buttonPanel.add(blueButton); buttonPanel.add(redButton); // add panel to frame add(buttonPanel); // create button actions ColorAction yellowAction = new ColorAction(Color.YELLOW); ColorAction blueAction = new ColorAction(Color.BLUE); ColorAction redAction = new ColorAction(Color.RED); // associate actions with buttons yellowButton.addActionListener(yellowAction); blueButton.addActionListener(blueAction); redButton.addActionListener(redAction); }
From source file:D20140128.ApacheXMLGraphicsTest.TilingPatternExample.java
/** * Default constructor.//from www . ja v a2s.c o m */ public TilingPatternExample() { //Created TexturePaint instance this.tile = new BufferedImage(40, 20, BufferedImage.TYPE_INT_RGB); Graphics2D tileg2d = tile.createGraphics(); tileg2d.setBackground(Color.WHITE); tileg2d.clearRect(0, 0, tile.getWidth(), tile.getHeight()); tileg2d.setColor(Color.BLUE); tileg2d.fillOval(2, 2, tile.getWidth() - 2, tile.getHeight() - 2); tileg2d.dispose(); Rectangle2D rect = new Rectangle2D.Double(2, 2, tile.getWidth() / 2.0, tile.getHeight() / 2.0); this.paint = new TexturePaint(tile, rect); }
From source file:Business.Chart.Temperature.java
public Temperature(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); series3 = new TimeSeries("Temperature"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset3 = createDatasetTemperature(workRequest); final JFreeChart chart3 = createChart(dataset3); final XYPlot plot = chart3.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveTemperatureRateMarker(age); int b = hos1.getPerson().getBelowTemperatureRateMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker);// ww w . j a v a2s . c om plot.addRangeMarker(valueMarker1); final ChartPanel chartPanel = new ChartPanel(chart3); chartPanel.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); getContentPane().repaint(); }
From source file:userinterface.patientRole.LineChart.java
public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP, JFrame parent) {//w w w .ja v a 2s . c o m // super(applicationTitle); this.bR = bR; this.pR = pR; this.bS = bS; this.bP = bP; this.parent = parent; dataset = createDataset(); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Vital Signs", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); renderer.setSeriesPaint(3, Color.BLUE); renderer.setSeriesStroke(0, new BasicStroke(1.0f)); renderer.setSeriesStroke(1, new BasicStroke(1.0f)); renderer.setSeriesStroke(2, new BasicStroke(1.0f)); renderer.setSeriesStroke(3, new BasicStroke(1.0f)); plot.setRenderer(renderer); setContentPane(chartPanel); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); }
From source file:FontPaint.java
public void paintComponent(Graphics g) { super.paintComponent(g); setBackground(Color.white);/* w w w. j ava 2s . c o m*/ int width = getSize().width; int height = getSize().height; Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); FontRenderContext frc = g2.getFontRenderContext(); Font f = new Font("Helvetica", 1, 60); String s = new String("Java Source and Support."); TextLayout textTl = new TextLayout(s, f, frc); AffineTransform transform = new AffineTransform(); Shape outline = textTl.getOutline(null); Rectangle outlineBounds = outline.getBounds(); transform = g2.getTransform(); transform.translate(width / 2 - (outlineBounds.width / 2), height / 2 + (outlineBounds.height / 2)); g2.transform(transform); g2.setColor(Color.blue); g2.draw(outline); g2.setClip(outline); }
From source file:de.fub.maps.project.detector.model.statistics.BarChartPanel.java
/** * Creates new form StatisticSegmentLengthBarChart *//*from w ww . j a v a 2s . co m*/ public BarChartPanel() { initComponents(); barChart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); plot = barChart.getCategoryPlot(); BarRenderer barRenderer = new BarRenderer(); barRenderer.setMaximumBarWidth(.05); barRenderer.setBasePaint(Color.BLUE); barRenderer.setAutoPopulateSeriesPaint(false); barRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); barRenderer.setBarPainter(new StandardBarPainter()); barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new CustomNumberFormat())); barRenderer.setBaseItemLabelsVisible(true); plot.setRenderer(barRenderer); plot.getDomainAxis().setMaximumCategoryLabelLines(3); plot.setBackgroundPaint(Color.white); barChart.setBackgroundPaint(Color.white); plot.setRangeGridlinesVisible(true); plot.getDomainAxis().setMaximumCategoryLabelLines(3); chartPanel = new ChartPanel(barChart, false); chartPanel.setVerticalAxisTrace(false); chartPanel.setDisplayToolTips(true); chartPanel.setBackground(Color.white); add(chartPanel, BorderLayout.CENTER); }
From source file:Business.Chart.ChartRespiratory.java
public ChartRespiratory(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); repaint();/*from w ww . j a v a 2 s . com*/ series2 = new TimeSeries("Respiratory Rate"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset2 = createDatasetRespiratoryRate(workRequest); final JFreeChart chart2 = createChart(dataset2); final XYPlot plot = chart2.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveRespirationRateMarker(age); int b = hos1.getPerson().getBelowRespirationRateMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1); final ChartPanel chartPanel = new ChartPanel(chart2); chartPanel.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); getContentPane().repaint(); }
From source file:ActionDisabled.java
public void actionPerformed(ActionEvent e) { if (toggle) { f.getContentPane().setBackground(Color.blue); toggle = false;//from w w w . j a va 2s.c o m } else { f.getContentPane().setBackground(Color.red); toggle = true; } f.repaint(); }
From source file:graphml.vertexPainter.java
public Paint transform(node v) //So for each node that we draw... { //We check the member variable, mColor, of the node. if (v.getColor().equalsIgnoreCase("yellow")) //If the node's mColor value is "yellow" we... return (Color.yellow); // Return our color, Color.yellow. else if (v.getColor().equalsIgnoreCase("red")) return (Color.red); else if (v.getColor().equalsIgnoreCase("blue")) return (Color.blue); else if (v.getColor().equalsIgnoreCase("green")) return (Color.green); else// www .ja v a 2 s .com return (Color.MAGENTA); }
From source file:components.ColorChooserDemo.java
public ColorChooserDemo() { super(new BorderLayout()); //Set up the banner at the top of the window banner = new JLabel("Welcome to the Tutorial Zone!", JLabel.CENTER); banner.setForeground(Color.yellow); banner.setBackground(Color.blue); banner.setOpaque(true);//from ww w. j a v a2 s . c o m banner.setFont(new Font("SansSerif", Font.BOLD, 24)); banner.setPreferredSize(new Dimension(100, 65)); JPanel bannerPanel = new JPanel(new BorderLayout()); bannerPanel.add(banner, BorderLayout.CENTER); bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner")); //Set up color chooser for setting text color tcc = new JColorChooser(banner.getForeground()); tcc.getSelectionModel().addChangeListener(this); tcc.setBorder(BorderFactory.createTitledBorder("Choose Text Color")); add(bannerPanel, BorderLayout.CENTER); add(tcc, BorderLayout.PAGE_END); }