levo

Graphical User Interface Objects and Events

Buttons, check boxes and radio buttons

  • 3 things to know
  • AS Unit 2
Start revising · £5/month

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.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

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

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A null is the of one.
absencepresencetype

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

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.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

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