JAVA GRAPHICS

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

15 Terms

1
New cards

Which package is primarily used for creating GUI components in Java?

javax.swing

2
New cards

Which method must be overridden to perform custom drawing in a JPanel?

paintComponent()

3
New cards

What object is commonly used for drawing shapes in Java?

Graphics

4
New cards

Which method is used to draw a rectangle in Java?

drawRect(int x, int y, int width, int height)

5
New cards

How do you set a color for drawing in Java?

g.setColor(Color c)

6
New cards

Which of the following is NOT a valid shape drawing method in Java?

drawTriangle()

7
New cards

What does repaint() do in Java Swing?

Requests Swing to refresh the component asynchronously

8
New cards

How can you draw an image in Java?

g.drawImage(Image img, int x, int y, ImageObserver observer)

9
New cards

Which class allows double buffering for smooth graphics?

BufferedImage

10
New cards

Which class gives more advanced drawing features like rotation and scaling?

Graphics2D

11
New cards

How do you enable anti-aliasing in Java 2D graphics?

g2.setRenderingHint(RenderingHints.KEYANTIALIASING, RenderingHints.VALUEANTIALIAS_ON)

12
New cards

Which of these is correct to start a basic Swing window?

JFrame f = new JFrame(); f.setVisible(true);

13
New cards

Which method is called automatically when a component needs redrawing?

paintComponent(Graphics g)

14
New cards

How do you draw a filled oval?

fillOval(x, y, width, height)

15
New cards

What is the coordinate system in Java graphics?

Origin at top-left, y increases down