levo

Graphical User Interface Objects and Events

Labels, text boxes and text areas

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

Overview

Label used for on a form and masked or password text box.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is a label used for on a form?

Key term

What kind of data does a text box always give back to the program?

Key term

The Java line int age = Integer.parseInt(txtAge.getText()); runs while txtAge contains the word seventeen. What happens?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a label used for on a form?

    Model answer

    A label displays fixed wording such as a caption or an instruction, and the user cannot edit a label.

  2. 2

    Why is a caption placed in a separate label beside a text box rather than inside the box itself?

    Model answer

    Wording placed inside the box disappears as soon as the user types, so a separate label keeps the field's meaning visible while data is entered.

  3. 3

    What kind of data does a text box always give back to the program?

    Model answer

    A text box always gives back a string, even when the user typed digits, so a number must be converted before arithmetic.

  4. 4

    A text box named txtAge contains 17 and the code runs int age = Integer.parseInt(txtAge.getText()); What value does age hold?

    Model answer

    The variable age holds the whole number 17, because getText returns the two characters 1 and 7 as a string and parseInt converts that string to an integer.

  5. 5

    The Java line int age = Integer.parseInt(txtAge.getText()); runs while txtAge contains the word seventeen. What happens?

    Model answer

    Java throws a NumberFormatException because the characters cannot be read as a number, and the handler stops at that line unless the exception is caught.

  6. 6

    What is the difference between a single line text box and a multi line text area?

    Model answer

    A single line text box holds one line and ignores Enter, while a text area holds many lines and scrolls when the content is longer than the visible space.

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.