levo

Graphical User Interface Objects and Events

Buttons, check boxes and radio buttons

  • 3 things to know
  • AS Unit 2

Overview

What each control is for, the difference between choosing several and choosing one, grouping radio buttons so they exclude each other, and reading which one the user selected.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

The Java code JButton btn = new JButton("Save"); btn.setEnabled(false); runs when the form loads. What does the user see, and what happens on a click?

Key term

Why disable a Submit button until a form is complete rather than showing an error after the click?

Key term

What is a check box used for?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What event does a button normally raise?

    Model answer

    A button raises a click or action event when the user presses and releases the mouse over it, or activates it from the keyboard.

  2. 2

    The Java code JButton btn = new JButton("Save"); btn.setEnabled(false); runs when the form loads. What does the user see, and what happens on a click?

    Model answer

    The user sees a greyed out button captioned Save, and a click on it produces no action event because a disabled control does not respond.

  3. 3

    Why disable a Submit button until a form is complete rather than showing an error after the click?

    Model answer

    Disabling the control prevents the invalid attempt entirely, so the user is guided towards the missing field instead of being told off afterwards.

  4. 4

    What is a check box used for?

    Model answer

    A check box records an independent yes or no choice, and several check boxes on a form can be ticked at the same time.

  5. 5

    What is a radio button used for?

    Model answer

    A radio button offers one choice from a set of mutually exclusive options, so selecting one clears the others in the same group.

  6. 6

    The Java code ButtonGroup g = new ButtonGroup(); g.add(rdoCash); g.add(rdoCard); runs, and the user selects rdoCash and then rdoCard. What is selected at the end?

    Model answer

    Only rdoCard is selected, because the group allows one member at a time, so choosing the second automatically cleared the first.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A null is the of one.
absencepresencetype

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AA null means no value has been recorded.
BZero and an empty string are values.
CA null is the absence of a value.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Graphical User Interface Objects and Events, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.