Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Caroline Maloney
- import javax.swing.*;
- import java.awt.*;
- public class Lab02 extends JPanel {
- public void paintComponent(Graphics g){
- g.setColor(Color.blue.darker()); //set background color
- g.fillRect(0, 0, 400, 400);
- g.setColor(new Color(150, 150, 0));
- int r = 10;
- for(int xg=107; xg<=260; xg+=2*r)
- {
- g.fillOval(xg-r, 40-r, 2*r, 2*r);
- }
- for(int xh=100; xh<=250; xh+=2*r)
- {
- g.fillOval(xh, 220, 2*r, 2*r);
- }
- for(int t=40; t<=220; t+=2*r)
- {
- g.fillOval(107-r, t-r, 2*r, 2*r);
- }
- for(int u=40; u<=220; u+=2*r)
- {
- g.fillOval(260-r, u-r, 2*r, 2*r);
- }
- g.fillRect(110, 40, 150, 190);
- g.setFont(new Font("Serif",
- Font.BOLD, 20));
- g.drawString("Our Fearless Leader", 100, 280);
- ImageIcon thomas = new ImageIcon("tj.jpg");
- g.drawImage(thomas.getImage(), 120, 50, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement