Loading…
Loading…
Language
Articles and problems tagged Java.
Collecting text input in Swing: JTextField, labels and accessible labeling, JPasswordField with char arrays, JTextArea with wrapping, and scroll panes, plus document listeners, filters that restrict input, and undo.
How Swing components are built and arranged: the model-view-controller design behind every component, button models and UI delegates, pluggable look and feel, and the three basic layout managers (flow, border and grid), combined with nested panels.
Remembering window positions, recent files and options with java.util.prefs: user and system trees, nodes named like packages, typed values with defaults, size limits, change listeners, XML export and import, the platform backing stores, and plugging in your own store with PreferencesFactory.
Handling the mouse in Swing: pressed, released and clicked events, click counts, drags, the wheel, buttons and modifiers, popup triggers and cursors, built into a small square editor; then the AWT event hierarchy, semantic versus low-level events, and the listener interfaces.
How Swing programs react to the user: event sources, listener interfaces and event objects, handling button clicks with classes and lambdas, adapter classes and window events, Action objects shared by buttons and menus, and key bindings through input maps and action maps.
Painting Swing components with Graphics2D: the Rectangle2D/Ellipse2D/Line2D shape classes and their Float and Double versions, draw versus fill, colors, alpha and gradients, logical fonts and text metrics for centering strings, and loading, scaling and tiling images.
Where Java desktop GUIs stand today: AWT peers, painted Swing components, JavaFX and OpenJFX, then a first Swing window: JFrame, the event dispatch thread, close operations, frame properties, the content pane, paintComponent, preferred sizes, pack and headless mode.
How Java solves key distribution: RSA-OAEP encryption and its size limits, hybrid encryption that wraps an AES key, Diffie-Hellman key agreement with X25519 and HKDF, the KEM API with DHKEM, and post-quantum ML-KEM, with the parameter pitfalls that break interoperability.
Encrypting data with javax.crypto.Cipher: AES, why ECB and unauthenticated modes are dangerous, PKCS #5 padding, AES-GCM with nonces and associated data, ChaCha20-Poly1305, generating and wrapping keys, SecureRandom, and encrypting files with cipher streams.
Solving the authentication problem with X.509 certificates: what a certificate contains, certificate authorities and chains of trust, keytool and PKCS #12 key stores, PKIX path validation in code, and signing and verifying JAR files with jarsigner and the JarSigner API.
Public key signatures in Java: why a digest alone cannot prove authorship, key pairs and the Signature class, sign/verify/tamper checks, encoding and restoring keys with KeyFactory, and choosing between RSA, RSASSA-PSS, ECDSA, Ed25519, Ed448 and the post-quantum ML-DSA.
Fingerprinting data with MessageDigest: what a cryptographic hash guarantees, MD5 and SHA-1 versus SHA-2 and SHA-3, incremental and streamed hashing, HMAC for keyed integrity, and storing passwords safely with salted PBKDF2, constant-time checks, rehashing and the Java 25 KDF API.
How the Java Authentication and Authorization Service logs users in: LoginContext, login configurations, the REQUIRED/REQUISITE/SUFFICIENT/OPTIONAL flags, writing a LoginModule with two-phase commit, callback handlers, Subjects and principals, Subject.callAs, and life after the Security Manager.
Implementing your own ClassLoader by overriding findClass, an integrity-checking loader that rejects tampered class files, child-first loading, parallel-capable loaders and resources, and what the bytecode verifier checks, shown with deliberately broken class files built with the ClassFile API.
How the JVM finds and prepares classes: loading, linking and initialization, the bootstrap, platform and application loaders, parent-first delegation, plugin loaders, class loaders as namespaces, the context class loader, and tools for watching it all happen.
Embedding scripting languages with javax.script (JSR 223): finding engines now that Nashorn is gone, eval, bindings and scopes, redirecting output, Invocable and Java interfaces, Compilable, writing your own engine, and Java snippets via the JShell API.
Generating Java source at run time, compiling it from strings into byte arrays with SimpleJavaFileObject and ForwardingJavaFileManager, loading it with a class loader or as a hidden class, a formula compiler and a template engine, and generating bytecode directly with the ClassFile API (Java 24).
Running javac inside a Java program with the javax.tools Compiler API: JavaCompiler.run, compilation tasks, StandardJavaFileManager and locations, diagnostics, options like --release and -Werror, the JavacTask tree API, and in-process JDK tools via ToolProvider.
Externalizing user-visible text with ResourceBundle: naming conventions, candidate and default-locale fallback, parent chains, UTF-8 property files, ListResourceBundle classes, ResourceBundle.Control, caching and modules, with a complete localized example.
Splitting text correctly with BreakIterator and grapheme clusters, handling line endings, choosing and detecting character encodings after UTF-8 became the default (JEP 400), console encodings, stdin and stdout properties, strict decoding, the UTF-8 byte order mark, and the encoding of source files.