The Source for Java Technology Collaboration
User: Password:



Simon Morris's Blog

Swing Archives


Card Sharp

Posted by javakiddy on November 21, 2007 at 02:38 AM | Permalink | Comments (14)

It's a creepy thought, but hidden amidst the garish flickering displays and eternal night of some far flung casino there may still stand a Video Poker machine running code written by yours truly. It's been the best part of a decade and half, but the industry as I recall it was never fond of re-inventing the wheel. Y'see for Poker machines 'unit testing' (as we now know it) didn't result in simple pass or fail outcomes, but in a slew of figures detailing how the code had survived each play scenario during overnight simulations. How would it play for novices? How did it stand up to experts? Crucially, how much money was it likely to rake in for the site operator? And just when everything seemed to be working fine each jurisdiction's gambling authority would demand to paw over the source, looking for potential cheats (we're talking tax evasion here, they weren't always bothered if the punters got scammed! :)

Still, at least I didn't have the tedious job of drawing the graphics!

If you've every drawn a pack of 52 playing cards you'll know what a fiddly cut'n'paste job it can be. Cards with the same symbols don't have the same layout, conversely cards with the same layout don't have the same symbols (duh!) At least the Poker machines had a fixed screen size. Anyone targeting modern PCs and mobile devices needs multiple decks to ensure they always look sharp at any resolution.

It's just an extreme example of a dilemma facing many user interface designers, in a world rapidly fragmenting into living room widescreens, pocket hand-helds, and all shades of resolution in between.

SVG (Scalable Vector Graphics) is a W3C backed XML format for vector graphics, attracting increasing attention. This is, I'm sure, due in no small part to the emergence of technologies like Flash, Adobe AIR and Microsoft Silverlight, with their reliance on vector graphics for scalable crispness, efficient bandwidth, and easy animation capabilities.

SVG is a technology I've been meaning to investigate for some time, and revisiting the playing card problem seems like an ideal test case to learn the ins-and-outs of working with vector images in Java.

Continue Reading...



Java ME is Dead, Long Live Java ME !

Posted by javakiddy on October 29, 2007 at 08:05 AM | Permalink | Comments (6)

No sooner had the words slipped from James Gosling's lips than programmer friends were emailing me with "I told you so" messages. Later clarifications will no doubt do little to rein in the idea that Java ME is on the way out, to be supplanted by JavaFX Mobile. Yet for all the good it will do to protest that the latter is merely a layer atop the former (well, more or less) it must be acknowledged that JavaFX has made mobile Java development seem somewhat sexy (again?)

There used to be an old programming motto, "every program expands until it can send mail." A modern equivalent might be "every user interface gets prettier until it requires 3D graphics hardware." If the iPhone has proven anything, it's that the mobile space has outgrown the functional card-based UI's of MIDP's LCDUI, and ventured into the glossy world of tilt sensors and swishy transition animations. And the public are clearly all too willing to get excited about a product merely on the basis of tilt sensors and swishy transitions — because, let's face it, sans UI gimmicky the iPhone is actually a decidedly under-achieving phone.

If nothing else there is one strong factor qualifying Java ME's continued existence: no matter how small the gap between the silicon in your hand and on your desktop, ultimately hand helds are, erm well, hand held! Take for example Sony's Playstation Portable. Whether you're a fan of the brand or not, one has to admit that for a box of that size the PSP delivers quite a solid CPU and graphics punch. Yet the PSP's XrossMediaBar (XMB) navigation is a far cry from what one would normally expect on a desktop application, combining simplicity and clarity with just a hint of bling.

Clearly, sitting somewhere between the uninspiring card UI's of MIDP and the rich keyboard/mouse driven UI's of the desktop, there exists a middle ground. A place where simplicity is paramount, and intuitive-ness (new word!) is king; where developers lack the luxury of a desktop screen/keyboard/mouse, nor can they expect users to lug around a 400+ page user manual. With room to show only one aspect of an application at a time, UI designers must work harder to provide a sense of how all the components fit together. Powerful yet simple navigation is the key: where am I?, how do I get where I want to go?, and how might I get back again once I'm finished?

This is fertile ground into which a rejuvenated Java ME can grow...

Continue Reading...



The Lost Generation

Posted by javakiddy on August 28, 2007 at 09:25 AM | Permalink | Comments (4)

It's exam results season once again in the UK, and as usual newspapers are complaining how easy modern exams are. If they're to be believed in days of yore a Mathematics pass grade involved proving Fermat's Last Theorem — today one merely need find the exam room and spells one's name correctly.

A junior school teacher recently told me current practice advises against correcting more than five spelling errors in a pupil's text, for fear of smothering their creativity with a smog of red ink. Initially I reacted with incredulity, but upon reflection I realised each generation's education slaughters a few sacred cows of the previous generation.

In the final three years of high school my own "Eng Lit." education took in three Shakespeare plays, a couple of Arthur Miller offerings, some Orwell, brief excursions into Dickens and Brontë, a smattering of Dylan Thomas, and sundry other classics (To Kill a Mockingbird and Hobson's Choice stick in the mind.) And that's just the stuff I can remember! I considered this modestly taxing, until I recalled my father's generation apparently studied Latin and learnt their poetry by heart. Much as I appreciated "Under Milk Wood", "If", etc., I'm eternally grateful I don't have them etched indelibly onto my brain.

Times change, priorities change. Education is shaped by the present, and in turn it helps shape the future. Nothing demonstrates this more than the World Wide Web revolution of the past decade (just in case you thought I'd forgotten this is technology blog!)

If environment shapes our learning, what has the last decade done to today's programmers? And if the internet is now to be nudged back towards the (neo-)desktop via RIAs (Rich Internet Applications), how might that web-centric education obfuscate, or even hinder, that transformation?

Continue Reading...



Swing, and that New Car Smell

Posted by javakiddy on May 01, 2007 at 04:12 AM | Permalink | Comments (24)

Car manufacturers have known for a long time that it's the little things which can make or break the sale of a vehicle. The reassuringly solid clunk of the doors as they close. The satisfyingly robust feel of the knobs, switches and handles. Even that strange hybrid plastic/fabric/wood/solvent smell which greets a potential buyer upon opening the door of a brand new car.

Of course, once the buyer is five miles down the road, the dealership a distance spec in the rear view mirror of his brand new car, the relevance of these little details begins to fade. Pretty soon that new car smell will be replaced by the odor of the family dog, snatched cups of service station coffee, and the guilty memories of a late night 'drive-thru' meal. Eventually the door will develop a slight creak, and the once virgin switches will become tainted from the imprint of a hundred fingertips. But car manufacturers know it's worth the extra effort, because at that crucial make-or-break moment when the potential owner is casting yet another uncertain eye over the glistening vehicle on the dealership forecourt (with the saleman's eyes burning into the back of his neck) it is these little irrelevant details which can make all the difference.

But what does this have to do with Swing?

Continue Reading...



March of the Ants

Posted by javakiddy on April 11, 2007 at 07:03 AM | Permalink | Comments (6)

I spent a little time over the Easter break playing about with the new streamlined integration of JOGL into Swing, as promoted by Chris Campbell in his blog some eighteen months back. To be honest, there really isn't an awful lot to 'play about' with. The interoperability with Java2D is just a lot more efficient (and usable) without any need to do something special. So what I really did was to brush up on my somewhat rusty, and admittedly rather limited, OpenGL skills.

For those who haven't sampled the delights of OpenGL directly, it might be worth explaining that it was originally envisioned as a kind of be-all-and-end-all for any sort of geometry based computer graphics. From video games to Computer Aided Design, OpenGL has a range of disparate functionality which can be adapted to fit. As such there's a lot of stuff which, at first glance, might cause one to think "why would I ever need that?"

Sometimes, though, cool effects can be found in the most arcane of functionality.

Continue Reading...



Getting Animated

Posted by javakiddy on March 08, 2007 at 07:13 AM | Permalink | Comments (13)

Well, given feedback from around the web it seems a lot of people liked my recent little foray into the realm of Swing eye candy, which is both very flattering, and also rather worrying. Do so many of you really value GUI bling?

I continued to play about with the code after I last posted it, and the final (for now!) bling'd up version can be WebStart'd from the link below. I must warn you, it takes eye candy to new depths of pointlessness! But these little experiments were never about testing the appropriateness or otherwise of various effects in a user facing GUI. Instead I was attempting to assess how easy it is to pull off such effects using bog-standard AWT/Swing API calls.

I found Swing highly compliant, which was reassuring. Instead the bulk of the head-scratching went not on getting Swing to 'swing', but on the custom PLaF and the movement mechanics behind the transitions. The movement mechanics in particular required a lot of boilerplate code.

In the end I wrote a mini API for tracking movement over time, and it was this utility API which proved to be far far more interesting than the main Swing code itself. So, despite the presence of rival animation solutions, I found myself drawn towards tinkering with this mini library, and eventually went back to the drawing board, rebuilding the code from scratch to be more universal and tighter in design.

The rest of this article will look at the results via a little trial animation I crafted.

Continue Reading...



Swing Bling

Posted by javakiddy on February 23, 2007 at 03:22 AM | Permalink | Comments (28)

I recently watched the interesting Screencast by Adobe's James Ward, entitled "Web 2.0 Design Trend & Tools". It shows off some of the stuff Adobe are doing with Flash and Flex to make them better suited for the Rich Internet Applications space, and I have to say I found what I saw quite impressive.

RIA's seem to be the buzzword of the moment, now that the shine has started to come off Ajax. Developers are starting to ask why they can't have the power of a desktop interface, coupled with the convenience of a web app. And while Adobe has recently bolstered its animation centric technology with data handling capabilities, Sun has been busy beefing up Java's desktop and graphics support.

But the one thing that Swing still lacks is eye candy. Swishy, bouncy, scrolly stuff. Now personally I can't stand it. The first thing I do when faced with a fresh install of Windows is to switch off the GUI effects (although, paradoxically, I actually quite like the OS X effects!) But the Flex demo got me wondering: just how easy would it be to add swishy, bouncy, scrolly stuff to a standard Swing GUI?

Throughout the first part of the Flex demo there's a tab bar with a subtle animation effect, and I figured it would be interesting to find out just how much work is actually involved in duplicating this kind of effect in Swing. Then I thought "sod it, in for a penny, in for a pound" — why not just turn the eye candy knob right up to eleven, and go all out for as much bling as I could possibly manage without reaching for a sick bag?

Continue Reading...



Swing Magic

Posted by javakiddy on July 24, 2006 at 06:26 AM | Permalink | Comments (17)

I suppose if the following was on the Java Posse's podcast it would be referred to as "Pimping my Swing app".

Pimp My Swing App is the Posse's alternative title for the Extreme GUI Makeover sessions at JavaOne — the idea is to play around with AWT, Swing and any other image producing API you can get your mitts on to create strange, wonderful and unique looking user interfaces. And, yes, this past weekend I spent a little time Swing app 'pimping' myself (whatever that actually means!) with some interesting results...

Continue Reading...



REQ: alt.web-browser.die.die.die

Posted by javakiddy on June 30, 2006 at 05:55 PM | Permalink | Comments (19)

In Where Swing should Venture Eitan Suez ponders the possibilities of making Swing applications deployable as web apps. Flip a deployment switch one way and you get a desktop application, another way and you get a web app.

Now I don't want to attack Eitan's comments directly, but for me his blog raises a more general point about the way user-facing software has been going recently. And so with good humour (and tongue planted firmly in cheek) I feel compelled to ask the following: why does everyone want the web to look and feel like a desktop app?

(Or, put another way: can't we desktop developers have an API all to ourselves, without the web apps mob muscling in?)

Continue Reading...





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds