Suppose we have created a class called MyGUI, which represents a GUI. Write a program that creates a JFrame object, adds a MyGUI object to the frame and makes it visible.

What will be an ideal response?


```
import javax.swing.*;
public class MyGUIDisplayer {
public static void main(String [] args) {
JFrame frame = new Jframe("My GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new MyGUI());
frame.pack();
frame.setVisible(true);
} // end main
} // end class MyGUIDisplayer
```

Computer Science & Information Technology

You might also like to view...

Which of the following is true of pseudocode?

a. It’s executed by the computer. b. It helps the programmer “think out” a program. c. It includes declarations and all types of statements. d. All of the above are false.

Computer Science & Information Technology

When the address of a data variable is passed to a function,what type of call is used?

A. Call by reference B. Call by value C. Call by indirection D. Both A and C

Computer Science & Information Technology

In Linux, ____ devices cannot host a file system.

A. write B. read C. block D. char

Computer Science & Information Technology

Which of the following is NOT true about public Wi-Fi hot spot safety? ?

A. Avoid accessing financial information. B. Sign out of websites. C. Always keep your wireless connection on. D.  Do not leave your computer unattended.

Computer Science & Information Technology