levo

Graphical User Interface Objects and Events

Labels, text boxes and text areas

  • 3 things to know
  • AS Unit 2

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.

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.