List of usage examples for java.awt Color WHITE
Color WHITE
To view the source code for java.awt Color WHITE.
Click Source Link
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.WHITE); JFrame frame = new JFrame(); frame.add(label);/*from w w w. j a v a2 s .c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.white); JFrame frame = new JFrame(); frame.add(label);// w w w .j av a 2s . c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JSpinner spinner = new JSpinner(); // Disable keyboard edits in the spinner JFormattedTextField tf = ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField(); tf.setEditable(false);/* w w w . jav a2s.com*/ tf.setBackground(Color.white); // The value of the spinner can still be programmatically changed spinner.setValue(new Integer(100)); }
From source file:GetColor.java
static public void main(String[] args) { Rabbit rabbit = new Rabbit(); //start extract snippet3 setObjectColor(rabbit, Color.WHITE); //stop extract snippet3 if (!rabbit.setColorCalled) throw new RuntimeException(); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_USHORT_GRAY); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, 100, 100);//from ww w. j av a2 s .com g2d.setColor(new Color(255, 123, 0)); g2d.drawLine(100, 100, 1, 1); g2d.dispose(); BufferedImage scaledImage = new BufferedImage(1000, 1000, BufferedImage.TYPE_USHORT_GRAY); Graphics2D graphics2D = scaledImage.createGraphics(); graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); graphics2D.drawImage(bi, 0, 0, 1000, 1000, null); graphics2D.dispose(); ImageIO.write(scaledImage, "png", new File("c:/Java_Dev/Test.png")); bi.flush(); }
From source file:Main.java
public static void main(String... args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel contentPane = new JPanel(); contentPane.setOpaque(true);/*from w w w. ja va 2 s . c o m*/ contentPane.setBackground(Color.WHITE); contentPane.setLayout(null); JLabel label = new JLabel("This JPanel uses Absolute Positioning", JLabel.CENTER); label.setSize(300, 30); label.setLocation(5, 5); JButton button = new JButton("USELESS"); button.setSize(100, 30); button.setLocation(95, 45); contentPane.add(label); contentPane.add(button); frame.setContentPane(contentPane); frame.setSize(310, 125); frame.setLocationByPlatform(true); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws IOException { BufferedImage img = new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB); Graphics2D g = img.createGraphics(); g.setColor(Color.white); g.fillRect(0, 0, 20, 20);/*from w ww . jav a 2s. co m*/ g.setColor(Color.black); g.fillRect(5, 5, 10, 10); Color[] mapping = new Color[] { Color.black, Color.white, // replace black with white Color.white, Color.green // and white with green }; ImageIO.write(img, "png", new File("original.png")); swapColors(img, mapping); ImageIO.write(img, "png", new File("swapped.png")); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Line Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border thickBorder = new LineBorder(Color.WHITE, 12); JButton thickButton = new JButton("12 Pixel"); thickButton.setBorder(thickBorder);/*from w w w . j a va 2s. com*/ Container contentPane = frame.getContentPane(); contentPane.add(thickButton, BorderLayout.NORTH); frame.pack(); frame.setSize(300, frame.getHeight()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { int size = 120; int pad = 10; BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB); Graphics g = bi.createGraphics(); g.setColor(Color.WHITE); g.fillRect(0, 0, size, size);// w ww. j a va2s . c o m g.setColor(Color.YELLOW); g.fillOval(pad, pad, size - (2 * pad), size - (2 * pad)); g.dispose(); BufferedImage image2 = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_BYTE_GRAY); ColorConvertOp op = new ColorConvertOp(bi.getColorModel().getColorSpace(), image2.getColorModel().getColorSpace(), null); op.filter(bi, image2); ImageIO.write(image2, "png", new File("c:/Java_Dev/image2.png")); }
From source file:Main.java
public static void main(String[] argv) throws Exception { int width = 100; int height = 100; BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferedImage.createGraphics(); g2d.setColor(Color.white); g2d.fillRect(0, 0, width, height);/*from w w w . j a va 2 s.c o m*/ g2d.setColor(Color.black); g2d.fillOval(0, 0, width, height); g2d.dispose(); RenderedImage rendImage = bufferedImage; File file = new File("newimage.png"); ImageIO.write(rendImage, "png", file); file = new File("newimage.jpg"); ImageIO.write(rendImage, "jpg", file); }