Answered step by step
Verified Expert Solution
Question
1 Approved Answer
for some reason, this code does not work. import javax.swing.*; import java.awt.*; public class lab02 extends JPanel { public void paintComponent(Graphics g) { //background g.setColor(Color.
for some reason, this code does not work.
import javax.swing.*; import java.awt.*; public class lab02 extends JPanel { public void paintComponent(Graphics g) { //background g.setColor(Color.RED.darker()); g.fillRect(0, 0, 400, 400); //picture frame g.setColor(new Color(150,150,0)); g.fillRect(125, 60, 180, 180); int x, y; for(x = 125; x for(x = 125; x for(y = 60; y for(y = 60; y //image ImageIcon chs = new ImageIcon("apcsaassignment.jpg"); g.drawImage(chs.getImage(), 145, 70, 150, 160, null); //text g.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 30)); g.setColor(Color.WHITE); g.drawString("Our Fearless Leader", 75, 300); } }
the code is supposed to have the picture below and i named it apcsaassignment
but this is what i get... it's java if anyone needs to know
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started