April 24th, 2013, 07:50 PM
-
How do I put my PNG file in the middle of the flag?!
Code:
import java.awt.*;
import javax.swing.*;
public class TheOlympicsApplet extends JApplet{
public void init()
{
JLabel label = new JLabel("Amir\n 200yard dash");
JLabel label2 = new JLabel("Mashhad, Iran");
getContentPane().setBackground(Color.white);
add(label, BorderLayout.CENTER);
add(label2,BorderLayout.SOUTH);
}
public void paint ( Graphics i)
{
super.paint(i);
i.setColor(Color.blue);
i.drawArc(10, 10, 40, 40, 0, 360);
i.setColor(Color.black);
i.drawArc(55, 10, 40, 40,0,360);
i.setColor(Color.red);
i.drawArc(100, 10, 40, 40,0,360);
i.setColor(Color.yellow);
i.drawArc(32, 35, 40, 40,0,360);
i.setColor(Color.green);
i.drawArc(77, 35, 40, 40,0,360);
i.setColor(Color.green);
i.fillRect(10, 120,150, 15);
i.setColor(Color.red);
i.fillRect(10, 150,150, 15);
}
}
I have got the flag so far, but not really sure how can I put my flag sing in the middle as a PNG file! is this possible? how can I do that