I have MouseListener for getting X and Y coordinates and I need to get RGB / HEX color on X and Y coordinates on loaded image.
I have following code, but I have error "cannot find method getRGB()" on line:

```
new FrameTest().FrameTest().getRGB(x, y);

```

My code:

```
package frametest;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class FrameTest extends JFrame implements MouseListener
{
    public static void main(String[] args) throws IOException 
    {
        JFrame frame = new JFrame("FrameTest");
        JLabel JLabel = new JLabel();

        frame.add(new JLabel(new ImageIcon(new FrameTest().FrameTest())));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setPreferredSize(new Dimension(1600, 900));
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.addMouseListener(new MouseListener() 
        {
            @Override
            public void mouseClicked(MouseEvent e) 
            {
                Point p = e.getPoint();
                int x = e.getX();
                int y = e.getY();

                new FrameTest().FrameTest().getRGB(x, y);
                System.out.println("X: " + x + "\nY: " + y + "\n\n");
            }
            @Override
            public void mousePressed(MouseEvent e) {}
            @Override
            public void mouseReleased(MouseEvent e) {}
            @Override
            public void mouseEntered(MouseEvent e) {}
            @Override
            public void mouseExited(MouseEvent e) {}
        });
        frame.setVisible(true);

    }
    public Image FrameTest() 
    {
        try 
        {
            BufferedImage image = ImageIO.read(new File("RIPME.png"));
            return image;
        } catch (IOException e) 
        {
            System.err.print(e.getMessage());
            return null;
        }  
    }
    @Override
    public void mouseClicked(MouseEvent e) {}
    @Override
    public void mousePressed(MouseEvent e) {}
    @Override
    public void mouseReleased(MouseEvent e) {}
    @Override
    public void mouseEntered(MouseEvent e) {}
    @Override
    public void mouseExited(MouseEvent e) {}
    }

```

How could I fix it and get hex color / rgb color?
Thanks.