Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

View RSS Feed

Uncategorized

Entries with no category

  1. Shutdown Hooks

    Shutdown hooks are threads to be run when the JVM is about to terminate. This can happen if all non-daemon threads have finished execution, System.Exit() has been called, or if the user is logging off/shutting down their OS among other operations.

    So to play around, I decided to write a simple shutdown hook that would print out "goodbye!" when the JVM was shutting down. The main program would spawn a number of threads which each would stay alive for some number of time. ...

    Updated September 21st, 2011 at 01:50 AM by helloworld922

    Categories
    Uncategorized
  2. Java Native Access and Eclipse Indigo Swing GUI editor

    Normally for native access, I would use JNI to run native code, especially code I've written which interfaces with Java components. However, often you just want to call native functions (particularly system calls).

    Rather than having to go through the whole JNI process (which is rather painstakingly slow), someone has created the JNA library which allows you to basically call native methods directly.

    As far as I understand, there are two main ways to use JNA:
    ...
    Categories
    Uncategorized
  3. Microsoft Excel and Java

    For those who are looking for a Java library which can read/write to Microsoft's spreadsheet formats (.xls, and the newer .xlsx), I recently stumbled upon a library called the Apache POI Project. It's not particularly a new project, but it is still under active development and maintained. As an added bonus, Apache POI also supports word documents, power point presentations, and other document formats.

    To me, one of the main benefits of Apache POI is the support for Microsoft Office ...

    Updated June 24th, 2011 at 12:40 AM by helloworld922

    Categories
    Uncategorized
  4. Minitip #2: Determining if a key is being pressed [WINDOWS SPECIFIC]

    Sometimes it's valuable to determine if a certain key is being pressed. This is especially valuable if you have multiple Swing components and you don't want to mess with keeping track of boolean flags across different objects, but is absolutely necessary if you're trying to get keypresses which are not received by any of your Swing components.

    In the forums, I've recommended writing JNI code which would allow the Java code to poll the hardware for key states, but never actually got ...

    Updated June 4th, 2011 at 02:08 AM by helloworld922

    Categories
    Uncategorized
  5. Minitip #1: Static imports

    So I'm going to try something new here: small, miniature tips which can help people improve their code. The focus will probably be towards the beginner/intermediate level, though there may be a few advanced tips every now and then.

    So let's get started!

    Static imports allow you to import static members of another class into your class. The main reason for this is to allow you to use those members without the long, drawn-out declaration of where that static member came ...
    Categories
    Uncategorized
Page 3 of 4 FirstFirst 1234 LastLast