List of usage examples for java.awt Color orange
Color orange
To view the source code for java.awt Color orange.
Click Source Link
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.orange); JFrame frame = new JFrame(); frame.add(label);/*w w w. j a va 2 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.ORANGE); JFrame frame = new JFrame(); frame.add(label);// www . java2 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[] argv) throws Exception { JTabbedPane pane = new JTabbedPane(); pane.setForeground(Color.YELLOW); pane.setBackground(Color.MAGENTA); String label = "Tab Label"; pane.addTab(label, new JButton("Button")); int index = pane.getTabCount() - 1; pane.setForegroundAt(index, Color.ORANGE); pane.setBackgroundAt(index, Color.GREEN); }
From source file:Main.java
public static void main(String args[]) throws Exception { Color colors[] = { Color.GREEN, Color.ORANGE, Color.PINK, Color.RED, Color.WHITE, Color.YELLOW }; JFrame frame = new JFrame("Color JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JComboBox comboBox = new JComboBox(colors); comboBox.setMaximumRowCount(5);//from www . j a va2 s . com comboBox.setEditable(true); comboBox.setRenderer(new ColorCellRenderer()); frame.add(comboBox, BorderLayout.NORTH); final JLabel label = new JLabel(); label.setOpaque(true); label.setBackground((Color) comboBox.getSelectedItem()); frame.add(label, BorderLayout.CENTER); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color selectedColor = (Color) comboBox.getSelectedItem(); label.setBackground(selectedColor); } }; comboBox.addActionListener(actionListener); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame("This is BOX LAYOUT"); JPanel panel1 = new JPanel(); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel1.setBackground(Color.yellow); JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); panel2.setBackground(Color.ORANGE); for (int i = 0; i < 5; i++) panel1.add(new JCheckBox("CheckBox " + (i + 1))); f.add(panel1, BorderLayout.WEST); f.add(panel2, BorderLayout.CENTER); f.setVisible(true);/*from w ww. j ava 2 s. c o m*/ f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();//from w ww. j ava 2 s . c o m PdfContentByte cb = writer.getDirectContent(); PdfShading axial = PdfShading.simpleAxial(writer, 36, 716, 396, 788, Color.orange, Color.blue); PdfShadingPattern axialPattern = new PdfShadingPattern(axial); ShadingColor axialColor = new ShadingColor(axialPattern); cb.setColorFill(axialColor); cb.rectangle(36, 608, 72, 72); cb.rectangle(144, 608, 72, 72); cb.rectangle(252, 608, 72, 72); cb.rectangle(360, 608, 72, 72); cb.fillStroke(); document.close(); }
From source file:Main.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BufferedImage image = new BufferedImage(400, 300, BufferedImage.TYPE_INT_RGB); Graphics2D imageGraphics = image.createGraphics(); GradientPaint gp = new GradientPaint(20f, 20f, Color.red, 380f, 280f, Color.orange); imageGraphics.setPaint(gp);//from w w w. ja va 2 s .c o m imageGraphics.fillRect(0, 0, 400, 300); JLabel textLabel = new JLabel("java2s.com"); textLabel.setSize(textLabel.getPreferredSize()); Dimension d = textLabel.getPreferredSize(); BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); g.setColor(new Color(255, 200, 255, 128)); g.fillRoundRect(0, 0, bi.getWidth(f), bi.getHeight(f), 15, 10); g.setColor(Color.black); textLabel.paint(g); Graphics g2 = image.getGraphics(); g2.drawImage(bi, 20, 20, f); ImageIcon ii = new ImageIcon(image); JLabel imageLabel = new JLabel(ii); f.getContentPane().add(imageLabel); f.pack(); f.setVisible(true); } }); }
From source file:EditableColorColumn.java
public static void main(String args[]) { Color choices[] = { Color.red, Color.orange, Color.yellow, Color.green, Color.blue, Color.magenta }; ComboTableCellRenderer renderer = new ComboTableCellRenderer(); JComboBox comboBox = new JComboBox(choices); comboBox.setRenderer(renderer);//w ww. j a va 2s .co m TableCellEditor editor = new DefaultCellEditor(comboBox); JFrame frame = new JFrame("Editable Color Table"); TableModel model = new ColorTableModel(); JTable table = new JTable(model); TableColumn column = table.getColumnModel().getColumn(3); column.setCellRenderer(renderer); column.setCellEditor(editor); JScrollPane scrollPane = new JScrollPane(table); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:ACompoundBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Compound Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border lineBorder = LineBorder.createBlackLineBorder(); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelLineBorder = new CompoundBorder(bevelBorder, lineBorder); JButton bevelLineButton = new JButton("Bevel Line"); bevelLineButton.setBorder(bevelLineBorder); Border redBorder = BorderFactory.createLineBorder(Color.MAGENTA, 2); Border orangeBorder = BorderFactory.createLineBorder(Color.BLUE, 2); Border yellowBorder = BorderFactory.createLineBorder(Color.YELLOW, 5); Border greenBorder = BorderFactory.createLineBorder(Color.GREEN, 2); Border blueBorder = BorderFactory.createLineBorder(Color.ORANGE, 4); Border magentaBorder = BorderFactory.createLineBorder(Color.RED, 3); Border twoColorBorder = new CompoundBorder(magentaBorder, blueBorder); Border threeColorBorder = new CompoundBorder(twoColorBorder, greenBorder); Border fourColorBorder = new CompoundBorder(threeColorBorder, yellowBorder); Border fiveColorBorder = new CompoundBorder(fourColorBorder, orangeBorder); Border sixColorBorder = new CompoundBorder(fiveColorBorder, redBorder); JButton rainbowButton = new JButton("Rainbow"); rainbowButton.setBorder(sixColorBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2)); contentPane.add(bevelLineButton);/*w ww .j av a 2 s. c o m*/ contentPane.add(rainbowButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();/*w w w .ja v a 2 s . com*/ PdfContentByte cb = writer.getDirectContent(); PdfSpotColor psc_cmyk = new PdfSpotColor("iTextSpotColorCMYK", 0.25f, new CMYKColor(0.3f, .9f, .3f, .1f)); SpotColor sc_cmyk = new SpotColor(psc_cmyk); Image img = Image.getInstance("dog.jpg"); PdfPatternPainter img_pattern = cb.createPattern(img.scaledWidth(), img.scaledHeight(), img.scaledWidth(), img.scaledHeight()); img_pattern.addImage(img, img.scaledWidth(), 0f, 0f, img.scaledHeight(), 0f, 0f); img_pattern.setPatternMatrix(1f, 0f, 0f, 1f, 60f, 60f); PdfShading axial = PdfShading.simpleAxial(writer, 36, 716, 396, 788, Color.orange, Color.blue); PdfShadingPattern axialPattern = new PdfShadingPattern(axial); ShadingColor axialColor = new ShadingColor(axialPattern); document.add(new Paragraph("This is a paragraph painted using a shading pattern", new Font(Font.HELVETICA, 24, Font.BOLD, axialColor))); document.close(); }