JCreator无法识别JFrame中的RBG颜色

时间:2016-12-07 08:42:06

标签: java swing jframe awt

我正在尝试在awt中创建类Color的对象,将其添加到我的JFrame的背景中。但是JCreator继续给我这个错误消息: .java:23:错误:找不到符号             。的getContentPane()的setBackground(Color.color);                                                 ^   符号:可变颜色   位置:类颜色 1错误

即使我正在导入Color类...这是我的代码的一部分:

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.ImageIcon;
import java.awt.event.*;
import javax.swing.BorderFactory;
import java.awt.Font;
import java.awt.Color;
public class myframe extends JFrame implements ActionListener 
{       

    public myframe()
     {
        setLayout(null);
        Color color = new Color(135,206,235);
       // Color skyblue = new Color((float)135,(float)206,(float)235);
        getContentPane().setBackground(Color.color);
        ImageIcon icon = new ImageIcon("horizntal logo.gif");
        setIconImage(icon.getImage());

0 个答案:

没有答案