1/88
Vocabulary flashcards covering key Java terms on multithreading, applets, event handling, I/O streams, AWT, graphics, and Swing GUI programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Multithreading (Java)
Technique of executing multiple threads simultaneously within a single program.
Thread
Lightweight sub-process; the smallest unit of CPU scheduling in Java.
Shared Memory Advantage
Threads share a common memory area, saving memory compared to separate processes.
Responsiveness Advantage
Independent threads keep the UI from blocking, allowing concurrent operations.
Thread State: New
Thread has been created but start() has not yet been called.
Thread State: Runnable
Thread is ready to run and waiting for CPU time.
Thread State: Running
Thread scheduler has picked the thread and it is executing.
Thread State: Blocked / Non-Runnable
Thread is alive but waiting for I/O, sleep, or monitor lock.
Thread State: Terminated
Thread has completed execution or exited due to an error.
Creating a Thread by Extending Thread
Subclass Thread and override run() to define task logic.
Creating a Thread by Implementing Runnable
Implement Runnable’s run() and pass instance to new Thread().
Thread Class
java.lang.Thread extends Object and implements Runnable, providing constructors & control methods.
start()
Thread method that creates a new call stack and invokes run() asynchronously.
run()
Contains the code executed by the thread when scheduled.
sleep(long ms)
Static Thread method that pauses current thread for specified milliseconds.
join()
Causes calling thread to wait until the target thread dies (optionally with timeout).
Thread Priority
Integer value (1-10) influencing scheduling order; default 5 (NORM_PRIORITY).
MIN_PRIORITY
Constant 1 — lowest thread priority.
NORM_PRIORITY
Constant 5 — default thread priority.
MAX_PRIORITY
Constant 10 — highest thread priority.
Synchronized Method
Method preceded by synchronized keyword that acquires object lock for exclusive access.
Daemon Thread
Background service thread marked by setDaemon(true); JVM exits when only daemons remain.
Runnable Interface
Functional interface with single void run() used to define thread tasks.
Multithreading vs. Multiprocessing
Threads share memory & have faster context switch; processes have separate memory.
Applet
Java program (bytecode + HTML) that runs inside a browser or appletviewer.
Applet Advantage
Adds dynamic, interactive content (e.g., games, animations) to web pages.
Applet Restriction
Runs in sandbox as untrusted code with limited system access.
Applet vs. Application
Applets lack main(); applications launch with main(String[]).
init()
Applet life-cycle method called once for initialization.
start()
Applet method called after init() and when applet gains focus.
stop()
Called when applet loses focus; used to suspend activity & release resources.
destroy()
Called once when applet is removed from memory for final cleanup.
paint(Graphics g)
Method that renders applet content; called whenever window needs redrawing.
HTML element specifying CODE, WIDTH, HEIGHT (and others) to embed an applet.
HTML element inside APPLET that passes name/value pairs to an applet.
getParameter(String)
Applet method retrieving a parameter value supplied by PARAM tag.
Local Applet
Applet stored and loaded from the client’s local system; no Internet required.
Remote Applet
Applet downloaded from a server via URL specified by CODEBASE attribute.
Delegation Event Model
Java’s event-handling scheme where sources fire events to registered listeners.
Event Source
Object that generates an event when its internal state changes.
Event Listener
Object that implements listener interface methods to process events from sources.
addTypeListener()
Source method used to register a listener for a specific event type.
EventObject
Superclass of all event classes; provides getSource() and toString().
ActionEvent
Event generated when a button is pressed, menu item selected, etc.
MouseEvent
Event generated for mouse actions (clicked, pressed, moved, etc.).
KeyEvent
Event representing keyboard input; types: KEYPRESSED, KEYRELEASED, KEY_TYPED.
WindowEvent
Event for window state changes (opened, closing, iconified, etc.).
ActionListener
Interface with void actionPerformed(ActionEvent) to handle action events.
ItemListener
Interface with void itemStateChanged(ItemEvent) for checkbox/choice changes.
KeyListener
Interface with keyPressed, keyReleased, keyTyped methods to process keystrokes.
MouseListener
Interface with mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased.
MouseMotionListener
Interface with mouseDragged and mouseMoved methods.
TextListener
Interface with textChanged(TextEvent) for text field/area updates.
Stream (Java I/O)
Sequence of data used for input or output operations.
Byte Stream
8-bit oriented I/O classes such as FileInputStream and FileOutputStream.
Character Stream
16-bit Unicode I/O classes such as FileReader and FileWriter.
FileInputStream
Reads raw bytes from a file; returns ‑1 when end of file reached.
FileOutputStream
Writes raw bytes to a file; often used to create text or binary files.
FileReader
Character stream class that reads two bytes at a time from a file.
FileWriter
Character stream class that writes two-byte Unicode characters to a file.
DataInputStream
Input stream that lets programs read primitive Java data types from System.in or files.
PrintStream
Subclass of FilterOutputStream; System.out is a PrintStream for console output.
AWT (Abstract Window Toolkit)
Platform-dependent GUI API providing heavyweight components built on native peers.
Container
AWT component that can hold other components (e.g., Panel, Frame, Dialog).
Frame
Top-level AWT window with title bar, borders, and optional menu bar.
Panel
Generic lightweight container without title bar used to group components.
FlowLayout
Layout manager placing components left-to-right, top-to-bottom like text flow.
GridLayout
Layout manager arranging components in equal-size rows and columns.
BorderLayout
Layout manager dividing container into North, South, East, West, Center regions.
Label (AWT)
Passive text display component created with new Label(String).
Button (AWT)
Clickable component generating ActionEvent; created with new Button("OK").
Checkbox
Toggle component indicating on/off state; generates ItemEvent.
CheckboxGroup
Class used to create mutually exclusive checkboxes (radio buttons).
Choice
Drop-down pop-up list allowing single selection.
List (AWT)
Scrolling list box that can allow single or multiple selections.
Scrollbar
Component for selecting continuous values; oriented horizontal or vertical.
drawLine()
Graphics method drawLine(int x1,int y1,int x2,int y2) to render a line.
drawRect()/fillRect()
Graphics methods to outline or fill rectangles.
drawOval()/fillOval()
Graphics methods to outline or fill ellipses/circles.
drawArc()/fillArc()
Graphics methods to render arcs defined by start and sweep angles.
drawPolygon()/fillPolygon()
Graphics methods to outline or fill multi-sided shapes defined by point arrays.
Swing
Lightweight, platform-independent GUI toolkit in javax.swing built atop AWT.
Lightweight Component
Component implemented in Java without native peer, reducing platform dependence.
Pluggable Look and Feel
Swing feature that lets applications change GUI theme at runtime.
AbstractButton
Superclass for Swing buttons providing common behavior (icons, text, action events).
JButton
Swing push button supporting text, icons, or both.
ImageIcon
Class that encapsulates images used in Swing components.
AWT vs Swing: Platform Dependency
AWT components are heavyweight & platform-dependent; Swing components are lightweight & platform-independent.
Heavyweight Component
GUI element that relies on an underlying native peer (e.g., Frame, Dialog).