Is XML or XUL the future of Java GUI building?
Asked Answered
R

9

9

After spending a lot of time and code on programming in Swing, I thought this can't be state-of-the-art Java GUI building. After not finding a user-friendly visual gui bilder for eclipse I stumbled upon declarative GUI building with XML UI toolkits... and I thought: This must be it! I think it's the right way to go, easy and also close to web-programming.

But after looking around in the web and on SO, I got the impression that it is not very common! Although there are many implementations and APIs, it seems like most of them are kind of dead and had no updates in the last 5 years..

So I wonder: Is my feeling right, that XML is not very widespread for java GUIs? And if so - what are the reasons? Maybe it couldn't become accepted or it has some major drawbacks or people are doing everything in the web instead with fatclients or there are better alternatives, maybe javafx?

I just need to know if it is worth spending time in that area or better look for alternate ways. As I dont read developer magazines I just don't know what the trends in gui building are and which technologies are believed to have a future. But I can't imagine that people still spend so much time on writing nasty swing (or swt) apps.

Reversioner answered 27/5, 2009 at 13:47 Comment(1)
You should consider using NetBeans for your GUI building. It has always worked really well for me, even switching between IDEs is not that bad.Tobit
V
3

Sun's answer to that seems to be JavaFX.

It has a declarative language for specifying the GUI and there will be builder apps as well.

Valid answered 27/5, 2009 at 13:56 Comment(3)
JavaFX is a bog standard imperative language, not actually a declarative language. What it does have is syntactical support for setting a load of properties at initialisation time (plus binds).Carola
I just took a deeper look into JavaFX and it gives a good impression. basic controls are implemented with much lesser code. bindings are convenient and together with css-styling and charts and the coming authoring tools its something I will definitly spend more time on!Gannes
I was investigating JavaFX 2.0 and was rather happy with the product until I saw that they only support Windows. javafx.com/faq/#5Aloysia
U
5

There new fresh and interesting approach - it uses YAML. Check it out at http://code.google.com/p/javabuilders/

Undone answered 27/5, 2009 at 19:50 Comment(0)
V
3

Sun's answer to that seems to be JavaFX.

It has a declarative language for specifying the GUI and there will be builder apps as well.

Valid answered 27/5, 2009 at 13:56 Comment(3)
JavaFX is a bog standard imperative language, not actually a declarative language. What it does have is syntactical support for setting a load of properties at initialisation time (plus binds).Carola
I just took a deeper look into JavaFX and it gives a good impression. basic controls are implemented with much lesser code. bindings are convenient and together with css-styling and charts and the coming authoring tools its something I will definitly spend more time on!Gannes
I was investigating JavaFX 2.0 and was rather happy with the product until I saw that they only support Windows. javafx.com/faq/#5Aloysia
G
3

There is some prototype work going on for e4 (Eclipse 4), which would allow building a GUI by editing an Ecore model and customizing it via CSS.
See this blog post for some details and instructions to try it out yourself.

Grandma answered 27/5, 2009 at 14:7 Comment(0)
C
1

Five to ten years ago XML was very popular. Although fine to provide some kind of standardisation for transferring data between heterogeneous systems, it's not suitable for programming. It always starts with the easy stuff, and lets declare everything. But any real system requires code. XML then falls down. There is also the problem that XML is a bad syntax for humans, and even languages like Java are easier to read.

On the other hand, there is clearly a need for the rails of GUIs. Naked Objects is the closest reasonable attempt I have seen.

Carola answered 27/5, 2009 at 14:6 Comment(1)
You should learn more about XUL. It's never used alone, obviously; it's scripted with JavaScript (or, in the case of Miro, Python). Try it. It's really awesome.Preacher
L
1

I came to the same conclusions as you about the declarative frameworks out there. It is not worth learning a new GUI syntax unless it's widely supported. XUL as an interface language is widespread, but there is no java rendering framework for it. I'd say HTML+CSS+Javascript and a Servlet container is the best Java platform for GUIs today, but sadly I haven't found a platform independent way to display web pages like a desktop application.

Loupe answered 27/5, 2009 at 14:7 Comment(0)
R
1

If you use Eclipse, you can now use WindowBuilder to help you in creating Swing apps in a user-friendly visual GUI builder. It's now available as a free download, and Google has donated the Swing GUI builder framework to the Eclipse Foundation.

Rossierossing answered 15/2, 2011 at 17:59 Comment(0)
M
0

The answer is surely not going to be XML. What problem are you trying to solve? You want to have reusable building blocks, and a compact way of describing them. I don't see XML helping you there.

[edit] Creating a java code equivalent of XUL would be an immense improvement on XUL. XML makes it really, really hard to do good separation of concerns and once and only once. It is however perfect for the mongolian horde approach. You need a layer on top of swing, it only provides the building blocks.

Mantling answered 27/5, 2009 at 14:1 Comment(1)
it's just that i think swing coding is nasty. i like the structured, hierarchical design of xml documents and the clear separation of functionality, structure and design. personally i think it's better to read. and judging from what i saw about xul, it needed much less code than swing.Gannes
K
0

I'd second Thilos suggestion with javaFX. Additionally the trend is pointing to webapps, so I think that in the long run javaFX and web based UIs will catch up to swing+swt GUIs.

Katherine answered 27/5, 2009 at 14:2 Comment(0)
C
0

I do all my swing stuff by hand and none of my application is nasty. If you do not know how to create usable and good looking UI there is no technology to help you.

Christalchristalle answered 27/5, 2009 at 14:49 Comment(1)
cool it! maybe I didn't express myself very well. my apps aren't nasty at all (they are the most beautiful...) but the process of building a complex gui with swing is clearly nasty, at least for me :)Gannes

© 2022 - 2024 — McMap. All rights reserved.