Is there a consistent or good way to ignore GUI-specific code?
The answer, in short, is no.
The problem with using any particular GUI library is that each GUI comes with a set of basic design principles that affect every use of the library. Unless there are two such libraries that in each case agree with these design principles, there is no simple substitution of one GUI for another.
There are several libraries that try to impose their design on many disparate graphical interfaces under each of their designs, but these libraries require a fierce number of programs. Furthermore, an attempt to force one set of design paradigms to another is not usually successful.
Examples of such libraries are QT, wxWidgets and, of course, the AWT Java base.
In the end, you pretty much have to agree that you're going to choose a library and get stuck in it.
Tom west
source share