Exam 17: Applets, Images, and Sound

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

import java.awt.*; import java.applet.*; import javax.swing.*; public class JCompanyImage extends JApplet { Image companyLogo; final int WIDTH = 287; final int HEIGHT = 129; final int FACTOR = 2; public void init() { companyLogo = getImage(getCodeBase(), "CompanyLogo. png"); } public void paint(Graphics g) { super.paint(g); // Draw image at its natural size ___________________________________ // Draw the image scaled - twice as large ___________________________________ } } Using the above code, complete the first shaded line with the statement to draw the image first in its original size in the upper-left corner. In the second shaded line, write the code to redraw the image at twice its original size using the WIDTH, HEIGHT, and FACTOR values.

(Essay)
4.9/5
(35)

There are three attributes typically placed within the <object> tag: code, width, and height. Describe the purpose of the three object tag attributes and their corresponding arguments.

(Essay)
4.9/5
(39)

In order to play sounds more than once, or to stop and start sounds, the sound must be loaded into an AudioClip object. Write the statement to load the AudioClip named myClip with the sound file myTune.au, which is located in the audio folder.

(Essay)
4.8/5
(32)

public void actionPerformed(ActionEvent e) { String name = answer.getText(); con.remove(greeting); con.remove(pressMe); con.remove(answer); personalGreeting.setText("Hello, " + name + "! "); con.add(personalGreeting); con.setBackground(Color.PINK); validate(); } In the actionPerformed() method above, the final statement following the addition of the JLabel is validate(). Explain the validate() method and how it is used with JComponents.

(Essay)
4.7/5
(41)

The applet can be run within a page on the Internet or an intranet, but you do not have to connect to the Internet to run an applet in your browser-you can simply use the browser locally.

(True/False)
4.8/5
(40)

How do you view an applet?

(Essay)
4.8/5
(29)

Match each term with the correct statement below. -Surrounded by angle brackets

(Multiple Choice)
4.9/5
(37)

Match each term with the correct statement below. -Executes again every time the applet becomes active after it has been inactive

(Multiple Choice)
4.8/5
(35)

What are the two forms of the play() method?

(Essay)
4.8/5
(35)

The ____ method is used to load an Image into the named Image in the applet.

(Multiple Choice)
4.9/5
(39)

You override the existing empty ____ method only if you want to take some action when a JApplet is no longer visible.

(Multiple Choice)
4.8/5
(29)

Match each term with the correct statement below. -The first method called in any applet

(Multiple Choice)
4.9/5
(36)

You can run an applet in a ____.

(Multiple Choice)
4.9/5
(36)

Describe the two methods for running an applet.

(Essay)
4.8/5
(37)

Match each term with the correct statement below. -Extensible Hypertext Markup Language

(Multiple Choice)
4.9/5
(34)

What are the four steps involved in creating an applet?

(Essay)
4.9/5
(45)

Describe the stop() method.

(Essay)
4.9/5
(40)

The ____ provides image-manipulation capabilities.

(Multiple Choice)
4.9/5
(27)

With an applet, the browser can call ____ different methods automatically at different times.

(Multiple Choice)
4.8/5
(40)

What are the methods of the applet life cycle?

(Essay)
4.8/5
(29)
Showing 41 - 60 of 72
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)