Java Programming: Multithreading, Applets, Event Handling, I/O, AWT & Swing

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/88

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering key Java terms on multithreading, applets, event handling, I/O streams, AWT, graphics, and Swing GUI programming.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

89 Terms

1
New cards

Multithreading (Java)

Technique of executing multiple threads simultaneously within a single program.

2
New cards

Thread

Lightweight sub-process; the smallest unit of CPU scheduling in Java.

3
New cards

Shared Memory Advantage

Threads share a common memory area, saving memory compared to separate processes.

4
New cards

Responsiveness Advantage

Independent threads keep the UI from blocking, allowing concurrent operations.

5
New cards

Thread State: New

Thread has been created but start() has not yet been called.

6
New cards

Thread State: Runnable

Thread is ready to run and waiting for CPU time.

7
New cards

Thread State: Running

Thread scheduler has picked the thread and it is executing.

8
New cards

Thread State: Blocked / Non-Runnable

Thread is alive but waiting for I/O, sleep, or monitor lock.

9
New cards

Thread State: Terminated

Thread has completed execution or exited due to an error.

10
New cards

Creating a Thread by Extending Thread

Subclass Thread and override run() to define task logic.

11
New cards

Creating a Thread by Implementing Runnable

Implement Runnable’s run() and pass instance to new Thread().

12
New cards

Thread Class

java.lang.Thread extends Object and implements Runnable, providing constructors & control methods.

13
New cards

start()

Thread method that creates a new call stack and invokes run() asynchronously.

14
New cards

run()

Contains the code executed by the thread when scheduled.

15
New cards

sleep(long ms)

Static Thread method that pauses current thread for specified milliseconds.

16
New cards

join()

Causes calling thread to wait until the target thread dies (optionally with timeout).

17
New cards

Thread Priority

Integer value (1-10) influencing scheduling order; default 5 (NORM_PRIORITY).

18
New cards

MIN_PRIORITY

Constant 1 — lowest thread priority.

19
New cards

NORM_PRIORITY

Constant 5 — default thread priority.

20
New cards

MAX_PRIORITY

Constant 10 — highest thread priority.

21
New cards

Synchronized Method

Method preceded by synchronized keyword that acquires object lock for exclusive access.

22
New cards

Daemon Thread

Background service thread marked by setDaemon(true); JVM exits when only daemons remain.

23
New cards

Runnable Interface

Functional interface with single void run() used to define thread tasks.

24
New cards

Multithreading vs. Multiprocessing

Threads share memory & have faster context switch; processes have separate memory.

25
New cards

Applet

Java program (bytecode + HTML) that runs inside a browser or appletviewer.

26
New cards

Applet Advantage

Adds dynamic, interactive content (e.g., games, animations) to web pages.

27
New cards

Applet Restriction

Runs in sandbox as untrusted code with limited system access.

28
New cards

Applet vs. Application

Applets lack main(); applications launch with main(String[]).

29
New cards

init()

Applet life-cycle method called once for initialization.

30
New cards

start()

Applet method called after init() and when applet gains focus.

31
New cards

stop()

Called when applet loses focus; used to suspend activity & release resources.

32
New cards

destroy()

Called once when applet is removed from memory for final cleanup.

33
New cards

paint(Graphics g)

Method that renders applet content; called whenever window needs redrawing.

34
New cards
Tag

HTML element specifying CODE, WIDTH, HEIGHT (and others) to embed an applet.

35
New cards
Tag

HTML element inside APPLET that passes name/value pairs to an applet.

36
New cards

getParameter(String)

Applet method retrieving a parameter value supplied by PARAM tag.

37
New cards

Local Applet

Applet stored and loaded from the client’s local system; no Internet required.

38
New cards

Remote Applet

Applet downloaded from a server via URL specified by CODEBASE attribute.

39
New cards

Delegation Event Model

Java’s event-handling scheme where sources fire events to registered listeners.

40
New cards

Event Source

Object that generates an event when its internal state changes.

41
New cards

Event Listener

Object that implements listener interface methods to process events from sources.

42
New cards

addTypeListener()

Source method used to register a listener for a specific event type.

43
New cards

EventObject

Superclass of all event classes; provides getSource() and toString().

44
New cards

ActionEvent

Event generated when a button is pressed, menu item selected, etc.

45
New cards

MouseEvent

Event generated for mouse actions (clicked, pressed, moved, etc.).

46
New cards

KeyEvent

Event representing keyboard input; types: KEYPRESSED, KEYRELEASED, KEY_TYPED.

47
New cards

WindowEvent

Event for window state changes (opened, closing, iconified, etc.).

48
New cards

ActionListener

Interface with void actionPerformed(ActionEvent) to handle action events.

49
New cards

ItemListener

Interface with void itemStateChanged(ItemEvent) for checkbox/choice changes.

50
New cards

KeyListener

Interface with keyPressed, keyReleased, keyTyped methods to process keystrokes.

51
New cards

MouseListener

Interface with mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased.

52
New cards

MouseMotionListener

Interface with mouseDragged and mouseMoved methods.

53
New cards

TextListener

Interface with textChanged(TextEvent) for text field/area updates.

54
New cards

Stream (Java I/O)

Sequence of data used for input or output operations.

55
New cards

Byte Stream

8-bit oriented I/O classes such as FileInputStream and FileOutputStream.

56
New cards

Character Stream

16-bit Unicode I/O classes such as FileReader and FileWriter.

57
New cards

FileInputStream

Reads raw bytes from a file; returns ‑1 when end of file reached.

58
New cards

FileOutputStream

Writes raw bytes to a file; often used to create text or binary files.

59
New cards

FileReader

Character stream class that reads two bytes at a time from a file.

60
New cards

FileWriter

Character stream class that writes two-byte Unicode characters to a file.

61
New cards

DataInputStream

Input stream that lets programs read primitive Java data types from System.in or files.

62
New cards

PrintStream

Subclass of FilterOutputStream; System.out is a PrintStream for console output.

63
New cards

AWT (Abstract Window Toolkit)

Platform-dependent GUI API providing heavyweight components built on native peers.

64
New cards

Container

AWT component that can hold other components (e.g., Panel, Frame, Dialog).

65
New cards

Frame

Top-level AWT window with title bar, borders, and optional menu bar.

66
New cards

Panel

Generic lightweight container without title bar used to group components.

67
New cards

FlowLayout

Layout manager placing components left-to-right, top-to-bottom like text flow.

68
New cards

GridLayout

Layout manager arranging components in equal-size rows and columns.

69
New cards

BorderLayout

Layout manager dividing container into North, South, East, West, Center regions.

70
New cards

Label (AWT)

Passive text display component created with new Label(String).

71
New cards

Button (AWT)

Clickable component generating ActionEvent; created with new Button("OK").

72
New cards

Checkbox

Toggle component indicating on/off state; generates ItemEvent.

73
New cards

CheckboxGroup

Class used to create mutually exclusive checkboxes (radio buttons).

74
New cards

Choice

Drop-down pop-up list allowing single selection.

75
New cards

List (AWT)

Scrolling list box that can allow single or multiple selections.

76
New cards

Scrollbar

Component for selecting continuous values; oriented horizontal or vertical.

77
New cards

drawLine()

Graphics method drawLine(int x1,int y1,int x2,int y2) to render a line.

78
New cards

drawRect()/fillRect()

Graphics methods to outline or fill rectangles.

79
New cards

drawOval()/fillOval()

Graphics methods to outline or fill ellipses/circles.

80
New cards

drawArc()/fillArc()

Graphics methods to render arcs defined by start and sweep angles.

81
New cards

drawPolygon()/fillPolygon()

Graphics methods to outline or fill multi-sided shapes defined by point arrays.

82
New cards

Swing

Lightweight, platform-independent GUI toolkit in javax.swing built atop AWT.

83
New cards

Lightweight Component

Component implemented in Java without native peer, reducing platform dependence.

84
New cards

Pluggable Look and Feel

Swing feature that lets applications change GUI theme at runtime.

85
New cards

AbstractButton

Superclass for Swing buttons providing common behavior (icons, text, action events).

86
New cards

JButton

Swing push button supporting text, icons, or both.

87
New cards

ImageIcon

Class that encapsulates images used in Swing components.

88
New cards

AWT vs Swing: Platform Dependency

AWT components are heavyweight & platform-dependent; Swing components are lightweight & platform-independent.

89
New cards

Heavyweight Component

GUI element that relies on an underlying native peer (e.g., Frame, Dialog).