• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/16

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

16 Cards in this Set

  • Front
  • Back
//Write the three import package statements used at the top of a Java applet.These import statements include using Java Applets, Java Abstract Windows Toolkit, as well as being able to access all events in the Java Abstract Windows Toolkit.

import java.awt.*;


import java.applet.*;


import java.awt.event.*;

//Write a class header for an applet named Hwk4Applet that uses both Item and Action Listener packages.
public class Hwk4Applet extends Applet implements ItemListener,ActionListener
//Write an object declaration for an individual checkbox named chkHwk4 with the caption of Homework # 4 Submitted.
Checkbox chkHwk4 = new Checkbox("Homework # 4 Submitted", false);
//Write the method header for the item State Changed method.
public void itemStateChanged(ItemEvent e)
//Write the method header for the action Performed method.
public void actionPerformed(ActionEvent e)
//Write an add statement that connects the CalculateButton object with the action Listener package.
add(CalculateButton);CalculateButton.addActionListener(this);
//Write an add statement that connects the chkHwk4 object with the item Listener package.
add(chkHwk4);chkHwk4.addActionListener(this);
//Write the two symbols that must be used to denote where an executable if and/or else statement begins and ends.
{ }
//Write three statements for a group of checkboxes, the first statement declares a checkbox group named SizeGroup, the second and third statements declare two checkboxes that belong to the group named chkSmall and chkLarge. The caption for each box is “small” and “large”, as well as the initial state for each checkbox is to be nonselected when the applet runs.
CheckboxGroup SizeGroup = new CheckboxGroup();Checkbox chkSmall = new Checkbox("small", false, SizeGroup);Checkbox chkLarge = new Checkbox("large", false, SizeGroup);
//Write a statement for a third control checkbox for the above checkbox group, SizeGroup. It is to be called HiddenBox, has no caption property, and its initial state setting is to be selected when the applet runs. (Remember, this checkbox does not show when the applet runs and it is used to control the settings of the other checkboxes in the group. See CommissionApplet from Class Participation Assignments for sample.)
Checkbox HiddenBox = new Checkbox("",true,SizeGroup);
//What symbol is written at the end of a Java statement to let the compiler know that it has reached the end of a java syntax statement?
;
//What symbol is never written at the end of a class header or a method header?
;
//Write all statements needed to: a) use the getactioncommand with an event named e assigned to a string variable called arg, and b) check to see if either the Submit or Clear button object has been clicked – the captions of these buttons contain the following strings of text/case sensitivity: Submit & Clear. There is no code executed when the Submit button is clicked. When the Clear button is clicked, the following objects are cleared out and/or reset to the original values: a text field object named txtName, a label object named lblOutput, and a choice object named chcNumberofRooms. Also, when the Clear button is clicked, the cursor is inserted into the txtName text field object.
String arg = e.getActionCommand( ); if (arg == "Submit") { } if (arg =="Clear") {txtName.setText(“”);lblOutput.setText("");chcNumberofRooms.setState(false);txtName.requestFocus();}
//Write a statement that adds a panel named inputPanel while also setting the layout manager style of border layout, north to the panel.
add(inputPanel,BorderLayout.NORTH);
//Write a for statement that uses an integer parameter called Counter, executes as long as Counter is less than or equal to ten and uses the unary incrementation operators to increase the value of Counter each time the for loop reiterates.
for(int Counter =1; Counter<=10; Counter++)
//Write the statement(s) that format a numeric output for currency with 7 digits with the last two digits will representing cents. There should be no leading zeros printed out when this value is output to the user. These statements are for the output of any value with the above conditions.
DecimalFormat twoDigits = new DecimalFormat("$ #,###.00");