1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Which package is primarily used for creating GUI components in Java?
javax.swing
Which method must be overridden to perform custom drawing in a JPanel?
paintComponent()
What object is commonly used for drawing shapes in Java?
Graphics
Which method is used to draw a rectangle in Java?
drawRect(int x, int y, int width, int height)
How do you set a color for drawing in Java?
g.setColor(Color c)
Which of the following is NOT a valid shape drawing method in Java?
drawTriangle()
What does repaint() do in Java Swing?
Requests Swing to refresh the component asynchronously
How can you draw an image in Java?
g.drawImage(Image img, int x, int y, ImageObserver observer)
Which class allows double buffering for smooth graphics?
BufferedImage
Which class gives more advanced drawing features like rotation and scaling?
Graphics2D
How do you enable anti-aliasing in Java 2D graphics?
g2.setRenderingHint(RenderingHints.KEYANTIALIASING, RenderingHints.VALUEANTIALIAS_ON)
Which of these is correct to start a basic Swing window?
JFrame f = new JFrame(); f.setVisible(true);
Which method is called automatically when a component needs redrawing?
paintComponent(Graphics g)
How do you draw a filled oval?
fillOval(x, y, width, height)
What is the coordinate system in Java graphics?
Origin at top-left, y increases down