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:ColorBlocks.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Dimension d = getSize();//w w w.ja v a2 s. c om g2.translate(d.width / 2, d.height / 2); Color[] colors = { Color.white, Color.lightGray, Color.gray, Color.darkGray, Color.black, Color.red, Color.pink, Color.orange, Color.yellow, Color.green, Color.magenta, Color.cyan, Color.blue }; float size = 25; float x = -size * colors.length / 2; float y = -size * 3 / 2; // Show all the predefined colors. for (int i = 0; i < colors.length; i++) { Rectangle2D r = new Rectangle2D.Float(x + size * (float) i, y, size, size); g2.setPaint(colors[i]); g2.fill(r); } //a linear gradient. y += size; Color c1 = Color.yellow; Color c2 = Color.blue; for (int i = 0; i < colors.length; i++) { float ratio = (float) i / (float) colors.length; int red = (int) (c2.getRed() * ratio + c1.getRed() * (1 - ratio)); int green = (int) (c2.getGreen() * ratio + c1.getGreen() * (1 - ratio)); int blue = (int) (c2.getBlue() * ratio + c1.getBlue() * (1 - ratio)); Color c = new Color(red, green, blue); Rectangle2D r = new Rectangle2D.Float(x + size * (float) i, y, size, size); g2.setPaint(c); g2.fill(r); } // Show an alpha gradient. y += size; c1 = Color.red; for (int i = 0; i < colors.length; i++) { int alpha = (int) (255 * (float) i / (float) colors.length); Color c = new Color(c1.getRed(), c1.getGreen(), c1.getBlue(), alpha); Rectangle2D r = new Rectangle2D.Float(x + size * (float) i, y, size, size); g2.setPaint(c); g2.fill(r); } // Draw a frame around the whole thing. y -= size * 2; Rectangle2D frame = new Rectangle2D.Float(x, y, size * colors.length, size * 3); g2.setPaint(Color.black); g2.draw(frame); }
From source file:Main.java
public Main() { childPanel1.setBackground(Color.red); childPanel1.setPreferredSize(new Dimension(300, 40)); childPanel2.setBackground(Color.blue); childPanel2.setPreferredSize(new Dimension(300, 40)); childPanel3.setBackground(Color.yellow); childPanel3.setPreferredSize(new Dimension(300, 40)); JButton myButton = new JButton("Add Component "); myButton.addActionListener(e -> { add(childPanel2, BorderLayout.CENTER); pack();// w w w . j av a2 s . c o m }); setLocation(10, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(childPanel3, BorderLayout.CENTER); add(myButton, BorderLayout.SOUTH); pack(); setVisible(true); }
From source file:ColoredToolTipExample.java
public ColoredToolTipExample() { super("Colored ToolTip Example"); UIManager.put("ToolTip.foreground", new ColorUIResource(Color.red)); UIManager.put("ToolTip.background", new ColorUIResource(Color.yellow)); JButton button = new JButton("Hello, world"); button.setToolTipText("Red / Yellow"); getContentPane().add(button);/* w ww. j av a 2 s . com*/ }
From source file:jprobix.ui.SPlotFinal.java
public static JPanel creteDemoPanel() { JFreeChart jfreechart = ChartFactory.createScatterPlot("Scatter plot demo", "X", "Y", samplexydataset2(), PlotOrientation.VERTICAL, true, true, false); Shape cross = ShapeUtilities.createDiagonalCross(3, 2); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer(); renderer.setSeriesShape(5, cross);/*from w ww .j a va 2s . c o m*/ renderer.setSeriesPaint(0, Color.YELLOW); XYDotRenderer xydotrenderer = new XYDotRenderer(); xyPlot.setRenderer(xydotrenderer); xydotrenderer.setSeriesShape(0, cross); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); return new ChartPanel(jfreechart); }
From source file:Main.java
public Main() { for (int i = 0; i < 100000; i++) { listSomeString.add("-"); listSomeString.add("A"); listSomeString.add("B"); listSomeString.add("C"); listSomeString.add("D"); }/* w w w . java 2 s . c o m*/ someComboBox.setEditable(true); someComboBox.getEditor().getEditorComponent().setBackground(Color.YELLOW); ((JTextField) someComboBox.getEditor().getEditorComponent()).setBackground(Color.YELLOW); frame = new JFrame(); frame.setLayout(new GridLayout(0, 1, 10, 10)); frame.add(someComboBox); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(100, 100); frame.pack(); frame.setVisible(true); }
From source file:Test.java
public Test() { this.setBounds(100, 100, 200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED, Color.lightGray, Color.yellow)); //panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED, // Color.lightGray, Color.yellow)); //panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED, // Color.lightGray, Color.lightGray, Color.white, Color.orange)); this.setLayout(new FlowLayout()); JButton exitButton = new JButton("Exit"); panel.add(exitButton);//w ww. j ava 2 s.c o m this.add(panel); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); }
From source file:Main.java
public LoadingScreenDemo() { addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { dispose();/*w w w. j av a 2s.co m*/ } } }); panel.setBackground(Color.YELLOW); add(panel); }
From source file:common.utility.ChartHelper.java
public static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart3D("Quantity Of Citizens Of Each Area", // chart title "(Include unactived people)", // domain axis label "Quantity", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );//from ww w. ja va 2 s.c o m // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.yellow); // Set the background colour of the chart chart.getTitle().setPaint(Color.blue); // Adjust the colour of the title CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); // Modify the plot background p.setRangeGridlinePaint(Color.red); return chart; }
From source file:Main.java
public Main() { someComboBox.setFont(new Font("Serif", Font.BOLD, 16)); someComboBox.setEditable(true);/*from w w w . j av a2 s .c om*/ someComboBox.getEditor().getEditorComponent().setBackground(Color.YELLOW); ((JTextField) someComboBox.getEditor().getEditorComponent()).setBackground(Color.YELLOW); JTextField text = ((JTextField) editableComboBox.getEditor().getEditorComponent()); text.setBackground(Color.YELLOW); JComboBox coloredArrowsCombo = editableComboBox; Component[] comp = coloredArrowsCombo.getComponents(); for (int i = 0; i < comp.length; i++) { if (comp[i] instanceof MetalComboBoxButton) { MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i]; coloredArrowsButton.setBackground(null); break; } } non_EditableComboBox.setFont(new Font("Serif", Font.BOLD, 16)); frame = new JFrame(); frame.setLayout(new GridLayout(0, 1, 10, 10)); frame.add(someComboBox); frame.add(editableComboBox); frame.add(non_EditableComboBox); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(100, 100); frame.pack(); frame.setVisible(true); }
From source file:org.jfree.chart.demo.JDBCXYChartDemo.java
public JDBCXYChartDemo(String s) { super(s);/*from w w w.j av a 2s . c o m*/ XYDataset xydataset = readData(); JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("JDBC XY Chart Demo", "Date", "Value", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.yellow); ChartPanel chartpanel = new ChartPanel(jfreechart); setContentPane(chartpanel); }