Noel Enete
Noel's Nuggets
For Java (nuggets v 1.23)


Nuggets are short clear examples that give you something that works to help you come up to speed quickly.

(All examples on this page are written in JDK 1.1.x and above unless indicated otherwise.)

  1. Getting Started
  2. Java Language
  3. GUI
  4. I/O
  5. Collections
  6. Utilities
  7. Network
  8. Tools

Java Language


  1. String & Array
  2. Example: Concatenate strings (source) (output)
  3. Example: Tokenize a string (source) (output)
  4. Example: Dimension and load array (source) (output)
  5. Example: Append one array with another
    1.0: (source) (output) 1.1: (source) (output)
  6. Example: UTF-8, UTF-16 (source) (output)
  1. Loops
  2. Example: for() (source) (output)
  3. Example: while() (source) (output)
  4. Example: do while() (source) (output)
  5. Example: break loop (source) (output)
  6. Example: Return to top of loop (source) (output)
  1. Flow of Control
  2. Example: if logic (source) (output)
  3. Example: switch logic (source) (output)
  4. Example: exit logic (source)
  1. Conversions
  2. Example: String -> int, float, double (source) (output)
  3. Example: int, float, double -> String (source) (output)
  4. Example: String <--> byte array
    1.0: (source) (output) 1.1: (source) (output)
  5. Example: Boolean->boolean, Integer->int, Double->double (source) (output)
  1. Bit Twiddling
  2. Example: Bitwise and / or logic (source) (output)
  3. Example: Bit-coded variable (source) (output)
  1. Math
  2. Example: Arithmetic (source) (output)
  3. Example: Rounding, ceiling, floor (source) (output)
  4. Example: Truncate (source) (output)
  5. Example: Divide with remainder (source) (output)
  6. Example: Exponents (source) (output)
  7. Example: Use pi or e (source) (output)
  8. Example: Use sin, cos, tan (source) (output)
  1. Memory
  2. Example: Get available memory (source) (output)
  3. Example: Load class dynamically (source) (output)
  4. Example: Launch thread (source) (output)
  1. Other
  2. Example: Literals (source)
  3. Example: Variables (source)
  4. Example: Static & Instance variables (source) (output)
  5. Example: Call method (source) (output)
  6. Example: Method that throws Exception (source) (output)
  7. Example: Call method in super class (source) (output)
  8. Example: Use Interface (source) (output)
  9. Example: instanceof (source) (output)

GUI


  1. Window
  2. Example: Draw text (source) (execute)
  3. Example: FontMetrics of font (source) (execute) (output)
  4. Example: Get available fonts (source) (output)
  5. Example: Button at (x, y)
    1.0: (source) (execute) 1.1: (source) (execute)
  6. Example: Line, circle, rectangle (source) (execute)
  7. Example: Copy pixels (source) (execute)
  8. Example: Draw in layout manager cell
    1.0: (source) (execute) 1.1: (source) (execute)
  9. Example: Close independent window
    1.0: (source) 1.1: (source)
  10. Example: Free standing window at (x, y)
    1.0: (source) 1.1: (source)
  11. Example: Applet & application (source) (execute) (output)
  12. Example: Applet go to new web page (source) (execute)
  13. Example: Insets (source) (execute) (output)
  1. Layout Managers
  2. Example: Simple CardLayout (source) (execute) (output)
  3. Example: Tabbed CardLayout (source) (execute) (output)
  1. Components
  2. Example: Label (source) (execute) (output)
  3. Example: Button (source) (execute) (output)
  4. Example: Checkbox (source) (execute) (output)
  5. Example: CheckboxGroup (source) (execute) (output)
  1. Events
  2. Example: Simple event (source) (execute) (output)
  3. Example: Multiple component (source) (execute) (output)
  4. Example: Multiple events (source) (execute) (output)
  5. Example: 1.02 Event applet (source) (execute) (output)
  1. Custom Events
  2. Example: Custom event (source)
  3. Example: Custom listener (source)
  4. Example: Custom source (source)
  5. Example: Custom event app (source) (output)
  1. Mouse
  2. Example: Simple Mouse (source) (execute) (output)
  3. Example: Moving Text (source) (execute) (output)
  4. Example: Moving Sparkler (source) (execute) (output)
  5. Example: Moving Image (source) (execute) (output)
  1. Keyboard
  2. Example: Key Strokes (source) (execute) (output)

I/O


  1. Random Access
  2. Example: Read/Write File (source) (output)
  1. Streams
  2. Example: File (source) (output)
  3. Example: stdin, stdout, stderr (source)
  1. Readers and Writers
  2. Example: Read a text file (source) (output)
  3. Example: Read the command line (source) (output)
  4. Example: File I/O from GUI window (source) (output)
  1. Startup parameters
  2. Example: Application (source) (output)
  3. Example: Applet (source) (execute)

Collections


  1. Vector & Hashtable
  2. Example: Process Enumeration (source) (output)
  3. Example: Create Enumeration (source) (output)
  4. Example: Iterate through Vector (source) (output)
  5. Example: Iterate through Hashtable (source) (output)
  6. Example: Copy Vector to array (source) (output)
  1. JDK 1.2 Collections
  2. Example: Iterating (source) (output)
  3. Example: Simple sort (source) (output)
  4. Example: Simple TreeMap (source) (output)
  5. Example: Skip sequential TreeMap (source) (output)
  6. Example: Sort dup keys Comparable (source) (output)

Utilities


  1. JDK 1.2 Date
  2. Example: Simple date formatting (source) (output)
  3. Example: Convert strings and dates (source) (output)
  4. Example: Date intervals (source) (output)

Network


  1. Net services
  2. Example: Get IP number (source) (output)
  1. Client/Server
  2. Example: Simple client (source) (output)
  3. Example: Simple server (source) (output)
  1. RMI
  2. Example: Simple client (source) (output)
  3. Example: Simple server (source) (output)
  4. Example: Simple server interface (source)

Tools


  1. Utils
  2. Tool: OrderedCollectionINT (source) (output)
  3. Tool: OrderedCollectionBYTE (source) (output)
  4. Tool: System info (source) (output) c:\>sys
  5. Tool: Directory sizes (source) (output) c:\>dirs
  6. Tool: Remove Dir Recursively (source) (output)
  7. Tool: Recent files (source) (output)
  8. Tool: Dump a file (source) (output) c:\>dump
  9. Tool: Sort a string (source) (output)
  10. Tool: Sort a file (source) (output)
  11. Tool: Split a file (source) (output) c:\>split
  12. Tool: Browse file 1.0: (source) (output) (execution)
  13. Tool: QuickSort an array (source) (output)
  14. Tool: EndOfLine convert (source) (output) c:\>eol
  15. Tool: Add date lines (source) (output)
  16. Tool: JavaTelnet (source) (output)
  17. Tool: URLFetcher (source) (output)
  18. Tool: Page Turner 1.0: (source) (output) (execution)
  1. Web Server
  2. Tool: CaffeineCafe (source) c:\>server
  3. Tool: CaffeineCafeDefaults (source)
  4. Tool: SConnection (source)
  5. Tool: Dripper (source)
  6. Tool: EchoDripper (source)
  7. Tool: FileDripper (source)
  8. Tool: AliasMaint (source)
  9. Tool: PreloadMaint (source)
  10. Tool: PackageMaint (source)
  11. Tool: Launchable (source)
  1. Program Generation
  2. Tool: Applications and Applets (source) c:\>application or c:\>applet
  3. Tool: Port a directory tree client (source) (output)
  4. Tool: Port a directory tree dripper (source) (output)

About


  1. the author
  2. revisions



by Noel Enete . . . www.enete.com . . . noel@enete.com
Java is a Trademark of Sun Microsystems, Inc.