Monday, December 10, 2007

More Java Fun

The TV-as-monitor fad went out this week. I really just need that machine to do more than I make it do, so I'm getting ready to throw XP Pro on it and replace my current desktop.

Besides, I couldn't read the screen from the bed anyway.

School has been interesting and I'm sure you'd like to read all about it, so:

Java is a little less intuitive than the .NET platform. Programming things like default actions and which element gains focus is a little harder in Java. In fact, I haven't figured it out. This weekend I had to write a program that accepted a list of names while ignoring duplicates, then allowed the user to search for a name in that list. Easy, right?

The flow of the program was easy: Accept a name or a list of names, put them in a list, then turn around and allow the user to search for a name in the list. The project was to have us use the LinkedList data structure and its methods. Very easy in design, but I got hung up on something so simple as sending the signal when the user was done typing names. I couldn't do this simple little procedural program, so I decided to do a full-fledged desktop application.

It's called (for lack of a better name) Name Reader.



Way easier to manage the input with an event-driven model rather than a command-line-based procedural program. The user puts a name in and presses the "Add" button, and voila!



When the list is big enough (or whatever), they can search for a name from the search box:



If the name is in the list, it will say so and give a position number. If not, it will also say so, but give a button with the option to add that name to the list.



Genius, huh?

Actually, I don' t think so either. I wish I could come up with something really grand so I can join the club of cool programmers. I have all the books; I just need that pinnacle of expertise that says "I have arrived!"

Anyway, here's the project file (NetBeans) if you want to look at it and improve upon it.

No comments: