Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What kind of graphics object is used to draw lines in a SWT scribble application?

  1. Canvas

  2. PaintBrush

  3. GC

  4. Drawable

The correct answer is: PaintBrush

The correct answer is B. In SWT scribble applications, PaintBrushes are used to draw lines because they allow for the creation and customization of strokes with different colors, widths, and styles. Canvases (A) are used to create and manipulate graphical objects, but they do not have the ability to draw lines. GCs (C) are the graphics context objects that are responsible for drawing graphics, but they are not used specifically for drawing lines in SWT scribble applications. Drawables (D) are abstract objects used to represent graphical objects, but they are also not used for drawing lines in this type of application. Therefore, the most appropriate answer is B, PaintBrush.