subject

Analyze the following code.

import java. awt.*;
import javax. swing.*;

public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame("My Frame");
frame. add(new MyDrawing("Welcome to Java!"));
frame. setSize(300, 300);
frame. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE);
frame. setVisible(true);
frame. setVisible(true);
}
}

class MyDrawing extends JPanel {
String message;

public MyDrawing(String message) {
this. message = message;
}

public void paintcomponent(Graphics g) {
super. paintComponent(g);

g. drawString(message, 20 ,20);
}
}

What happens?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
When pasting an existing chart into a word document, you can choose to using the paste options button. a. paste the chart as a picture b. embed the chart c. add the chart while keeping the destination formatting intact d. insert the chart while keeping the source formatting intact
Answers: 1
You know the right answer?
Analyze the following code.

import java. awt.*;
import javax. swing.*;

...
Questions
question
Computers and Technology, 16.12.2020 01:30
question
Mathematics, 16.12.2020 01:30
question
Arts, 16.12.2020 01:30
question
History, 16.12.2020 01:30
Questions on the website: 13722360