Ex2. Each of the following questions is about user painting.
Mark T if the question is valid, otherwise F.
(1) Graphics class provides methods for drawing strings, lines,
rectangles, ellipses, arcs, polygons, and polygons ( )
(2) Painting on components requires redefinition of the panel
inheritance and painting-related paintComponent( )
(3) super.painComponent(g) calls the defined pintComponent() in the
parent class, which is necessary to ensure that the visible area is
emptied prior to the new drawing display ( )
(4) Because refaint() is defined in the component, the drive of the
refaint is called by the pintComponent() to create a new field of
view, it is called to display new objects ( )
(5) Use getPreferredSize() as defined in Component to ensure that
the user has the preferred size of the layout manager ( )
Please solve the problem. and Please Let me explain the process.
Thank you:)
There's no method called painComponent() or pintComponent(), I'm assuming that they're paintComponent() and refaint() as repaint().
ANSWERS:
1.FALSE
EXPLANATION:-Graphics class provides methods for drawing strings, lines, rectangles, arcs, polygons, and polygons ( ).But the Graphics class does not contain any method for ellipses. So, to draw an ellipse, we have to use drawOval().
2.TRUE
3. FALSE
EXPLANATION:- super.paintComponent(g) will call the defined pintComponent() in the parent class but it does not empty any visible area. It is used to paint a field.
4. TRUE
5. TRUE
Ex2. Each of the following questions is about user painting. Mark T if the question is...
Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor. Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...
***This is a JAVA question***
------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;
import javax.swing.event.*;
public class DrawingPanel implements ActionListener {
public static final int DELAY = 50; // delay between repaints in
millis
private static final String DUMP_IMAGE_PROPERTY_NAME =
"drawingpanel.save";
private static String TARGET_IMAGE_FILE_NAME = null;
private static final boolean PRETTY = true; // true to
anti-alias
private static boolean DUMP_IMAGE = true; // true to write
DrawingPanel to file
private int width, height; // dimensions...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...
These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....