Hi guys, why wont this work. I'm still learning and have no experience with graphics of any kind. Just trying to put the image onto the background. The link directory is right i think.

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import javax.swing.*;	//inc javax.swing.ImageIcon

public class TheArea extends JFrame	{
	
	private Image aImage;
	private ImageIcon ii;
	
public static void main(String[] args)	
{
	new TheArea();	
	
}
	public TheArea()	
	{
		//JFrame frame = new JFrame();
		setSize(1000, 650);		//horizontal, vertical
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		setTitle("Area");
		setBackground(Color.GREEN);
		//frame.add(this);
	    //frame.setVisible(true);

		 try 
		 {
			 ii = new ImageIcon(this.getClass().getResource("D:\\Users\\Jonny\\Desktop\\Eclipse Work\\Radar.jpg"));	//ii = new ImageIcon(this.getClass().getResource("D:\\Users\\Jonny\\Desktop\\Radar.jpg"));
			 areaImage = ii.getImage(); 
		 }
		 catch(Exception e)
		 {
			 System.out.println(e.toString());
		 }

	}
	 public void paint(Graphics g) {

	        Graphics2D g2d = (Graphics2D) g;
	        g2d.drawImage(areaImage, 25, 10, null); 
	    }

}

Also do you guys know of or have a link to where i can find information or just how i can have a dot at the centre of a circle or background and have a line that it turns/spins around it?

Didi you intend this to be a class? If yes (which is probable) you forgot keyword class

#
public TheArea()
#
{
#
//JFrame frame = new JFrame();
#
setSize(1000, 650); //h

Fix and try this

#
class TheArea()
#
{
#
//JFrame frame = new JFrame();
#
setSize(1000, 650); //h

Sorry that was my fault when i copied it i must have missed the class keyword, so that wasn't the problem. Any other ideas? should this work?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.