List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:TopLevelDemo.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. *//* ww w . j ava 2 s. co m*/ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("TopLevelDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create the menu bar. Make it have a cyan background. JMenuBar cyanMenuBar = new JMenuBar(); cyanMenuBar.setOpaque(true); cyanMenuBar.setBackground(Color.cyan); cyanMenuBar.setPreferredSize(new Dimension(200, 20)); //Create a yellow label to put in the content pane. JLabel yellowLabel = new JLabel(); yellowLabel.setOpaque(true); yellowLabel.setBackground(Color.yellow); yellowLabel.setPreferredSize(new Dimension(200, 180)); //Set the menu bar and add the label to the content pane. frame.setJMenuBar(cyanMenuBar); frame.getContentPane().add(yellowLabel, BorderLayout.CENTER); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:ActionTest.java
public ActionFrame() { setTitle("ActionTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); buttonPanel = new JPanel(); // define actions Action yellowAction = new ColorAction("Yellow", new ImageIcon("yellow-ball.gif"), Color.YELLOW); Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE); Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED); // add buttons for these actions buttonPanel.add(new JButton(yellowAction)); buttonPanel.add(new JButton(blueAction)); buttonPanel.add(new JButton(redAction)); // add panel to frame add(buttonPanel);/*from w w w . j a va 2 s. c om*/ // associate the Y, B, and R keys with names InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow"); imap.put(KeyStroke.getKeyStroke("ctrl B"), "panel.blue"); imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red"); // associate the names with actions ActionMap amap = buttonPanel.getActionMap(); amap.put("panel.yellow", yellowAction); amap.put("panel.blue", blueAction); amap.put("panel.red", redAction); }
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// w ww . j a va 2 s . c o m return (Color.MAGENTA); }
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);// w w w . j av a 2 s . c o m 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:dataminning2.Graphplot.java
protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = getWidth(); int h = getHeight(); // Draw ordinate. g2.draw(new Line2D.Double(PAD, PAD, PAD, h - PAD)); // Draw abcissa. g2.draw(new Line2D.Double(PAD, h - PAD, w - PAD, h - PAD)); double xInc = (double) (w - 2 * PAD) / (data.length - 1); double scale = (double) (h - 2 * PAD) / 88; // Mark data points. g2.setPaint(Color.red);/*from w ww . j a va2s . c o m*/ int length1 = 0; int length2 = data.length / 3; for (int i = 0; i < length2; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } g2.setPaint(Color.BLUE); int lengthnew = length1 + length2; length2 = length2 + lengthnew; for (int i = lengthnew; i < length2; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } g2.setPaint(Color.YELLOW); lengthnew = lengthnew + lengthnew; for (int i = length2; i < data.length; i++) { double x = PAD + i * dataX[i]; double y = h - PAD - scale * dataY[i]; g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4)); } }
From source file:userinterface.patientRole.LineChart.java
public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP, JFrame parent) {/*www. j a v a 2 s . c om*/ // 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: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 w w . j a v a 2s. 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:UserInterface.FarmerRole.ThermometerDemo.java
public ThermometerDemo(double value, String type) { this.setLayout(new GridLayout()); DefaultValueDataset dataset = new DefaultValueDataset(value); if (type.equals("high")) { ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.ORANGE); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 10, 28, 30, 60); JFreeChart chart = new JFreeChart("Cold Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } else if (type.equals("medium")) { ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.ORANGE); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 12, 14, 30, 60); JFreeChart chart = new JFreeChart("Medium Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } else {/* w ww. j a v a2s. c om*/ ThermometerPlot plot = new ThermometerPlot(dataset); plot.setSubrangePaint(0, Color.green.darker()); plot.setSubrangePaint(1, Color.YELLOW); plot.setSubrangePaint(2, Color.RED.darker()); plot.setSubrangeInfo(0, 20, 35, 46, 60); JFreeChart chart = new JFreeChart("Warm Storage", JFreeChart.DEFAULT_TITLE_FONT, plot, true); this.add(new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true)); } }
From source file:org.alder.fotobuchconvert.scribus.ColorManager.java
public void initialize() { addCMYK("Black", "#000000ff", Color.BLACK); addRGB("BlackRGB", "#000000"); addCMYK("White", "#00000000", Color.WHITE); addRGB("Blue", "#0000ff"); addCMYK("Cool Black", "#990000ff", null); addCMYK("Cyan", "#ff000000", Color.CYAN); addRGB("Green", "#00ff00"); addCMYK("Magenta", "#00ff0000", null); addRGB("Red", "#ff0000"); addCMYK("Rich Black", "#996666ff", null); addCMYK("Warm Black", "#00994cff", null); addCMYK("Yellow", "#0000ff00", Color.YELLOW); }
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 w ww .ja v a 2 s . c om 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); }