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.


In SWT, what must you do after creating widgets to display the application window?

  1. Call the display() method

  2. Invoke the open() method on Shell

  3. Set the visibility to true

  4. Compile the widgets

The correct answer is: Call the display() method

After creating widgets in SWT, you must call the display() method to actually display them in the application window. Option B is incorrect because the open() method is used to open a shell (a top-level window in SWT) that has already been created. Option C is incorrect because setting the visibility to true would not actually display the application window but only make it visible after it has been displayed. Option D is incorrect because there is no compilation involved in creating and displaying widgets in SWT, as SWT is a GUI framework and not a programming language. Therefore, the correct answer is A.