Java desktop development framework similar to Android?
Asked Answered
G

3

6

I've recently dived head-first into developing Android apps in Java. It's all very new to me as my experience is in web development with PHP. But I need to adapt pretty quickly to a desktop environment as well (i.e. Windows).

To ease the learning curve a bit, are there any Java desktop development frameworks that are similar to the Android framework? When it comes to Desktop applications, what Java GUI and/or MVC framework(s), toolkits, and/or libraries would you recommend to someone whose only real Java/GUI experience is with Android?

Notes

  1. While a single, unified framework providing GUI management, widgets, and so forth would be nice, it's not that important; I'm just looking for some recommendations on a basic application framework to get me started, as well as a GUI library that might work well with said framework.

  2. Maybe it would help a bit if I elaborate a bit on what I'm trying to do. My goal is to build a fairly basic Android app for creating and managing certain records, which are stored locally but which can be sync'd with a remote server. Then I need a desktop app which lives in the Windows system tray, and you click it to pop up a manager window that provides similar functionality to the Android app. What libraries would you suggest on the desktop side to achieve these aims?

  3. A couple of the things I appreciate about the Android framework that I'd love to find in a desktop-oriented framework:

    • Android does a ton of the boilerplate work for you, and you just fill in the rules that make your app unique.

    • Android allows you to use XML files to describe the presentation's physical layout, which is nice for keeping the code that handles user interactions separate from the code that describes the layout.

    • Android provides a very user-friendly SDK and entire tool stack that makes it super easy to jump in, experiment, and learn.

Gabbert answered 26/12, 2011 at 16:39 Comment(0)
I
3

Well, you can give Apache Pivot a try. It uses XML files to define the content of the user interface. The UI classes include windows, dialogs, buttons, lists, text input, layout, drag and drop, and others.

As Apache Pivot site states:

Pivot allows developers to easily construct visually-engaging, cross-platform, connected applications in Java or any other JVM language, such as JavaScript, Groovy, or Scala.

Pivot enables developers to build solutions using the tools they already know, decreasing delivery time and reducing technology sprawl.

Below is the example of XML that is used to create the UI of "Hello Word" application:

<Window title="Hello BXML!" maximized="true"
            xmlns:bxml="http://pivot.apache.org/bxml"
            xmlns="org.apache.pivot.wtk">
            <Label text="Hello BXML!"
                styles="{font:'Arial bold 24', color:'#ff0000',
                    horizontalAlignment:'center', verticalAlignment:'center'}"/>
</Window>

Or another one example of simple application GUI:

<Window title="Hello" maximized="true"
    xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns="org.apache.pivot.wtk">
    <content>
        <BoxPane styles="{padding:4, horizontalAlignment:'center', verticalAlignment:'center'}">
            <Label wtkx:id="label1" text="Please enter your name"
              styles="{font:'Arial 20', color:'#ff0000',
                  horizontalAlignment:'center', verticalAlignment:'center'}"/>
              <TextInput wtkx:id="text1"  /> 
              <PushButton wtkx:id="button1" buttonData="Enter"/>
        </BoxPane>
    </content>
</Window>

It in some way resembles the Android GUI architecture.

Islamism answered 8/2, 2014 at 4:48 Comment(1)
This is fantastic, I'd never heard of Pivot before but it seems like exactly what I was looking for at the time. I'm no longer involved much in Java development, but I think this answer is good enough to steal the Accept two years later.Gabbert
M
5

There's nothing that resembles the Android GUI/architecture for the desktop, really.

The two java desktop players are Swing (original cross-platform-ish GUI) and SWT (Eclipse and native components). Griffon is a desktop Groovy MVC framework that abstracts away a lot of the work.

Depending on your needs, building a rich client inside Eclipse or NetBeans is an option.

Building a rich web-based platform might even make sense; you could distribute with an embedded server using any number of Java web technologies--this is often the most convenient, particularly if you want to be able to host the same functionality across platforms, or market it as a service while still allowing local deployment.

Mf answered 26/12, 2011 at 16:51 Comment(2)
I'm aware of Swing and SWT, as far as that they're the most popular GUI libraries for Java development. I'm hoping to find something a little closer to the Android framework, even if it isn't really an integrated solution.. what are your thoughts about SwiXML, for instance? And aren't there any MVC frameworks out there for constructing apps with Java (not Groovy)?Gabbert
@BrianLacy I don't know of any formal Java-only MVC-beyond-Swing's-version frameworks, but that doesn't mean there aren't any. SwiXML seems fine, but I personally wouldn't bother with it, but YMMV. There are a variety of builder-like solutions available, but I'm not overly-familiar with any of them.Mf
I
3

Well, you can give Apache Pivot a try. It uses XML files to define the content of the user interface. The UI classes include windows, dialogs, buttons, lists, text input, layout, drag and drop, and others.

As Apache Pivot site states:

Pivot allows developers to easily construct visually-engaging, cross-platform, connected applications in Java or any other JVM language, such as JavaScript, Groovy, or Scala.

Pivot enables developers to build solutions using the tools they already know, decreasing delivery time and reducing technology sprawl.

Below is the example of XML that is used to create the UI of "Hello Word" application:

<Window title="Hello BXML!" maximized="true"
            xmlns:bxml="http://pivot.apache.org/bxml"
            xmlns="org.apache.pivot.wtk">
            <Label text="Hello BXML!"
                styles="{font:'Arial bold 24', color:'#ff0000',
                    horizontalAlignment:'center', verticalAlignment:'center'}"/>
</Window>

Or another one example of simple application GUI:

<Window title="Hello" maximized="true"
    xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns="org.apache.pivot.wtk">
    <content>
        <BoxPane styles="{padding:4, horizontalAlignment:'center', verticalAlignment:'center'}">
            <Label wtkx:id="label1" text="Please enter your name"
              styles="{font:'Arial 20', color:'#ff0000',
                  horizontalAlignment:'center', verticalAlignment:'center'}"/>
              <TextInput wtkx:id="text1"  /> 
              <PushButton wtkx:id="button1" buttonData="Enter"/>
        </BoxPane>
    </content>
</Window>

It in some way resembles the Android GUI architecture.

Islamism answered 8/2, 2014 at 4:48 Comment(1)
This is fantastic, I'd never heard of Pivot before but it seems like exactly what I was looking for at the time. I'm no longer involved much in Java development, but I think this answer is good enough to steal the Accept two years later.Gabbert
I
2

If your motive is really Android app development, I would suggest don't worry about Java GUI, because both are different worlds. Android does use Java/Object Orientation as development language (sytax and semantics), but it doesn't care about Java GUI apis and someother apis. If you really want to learn Java desktop GUI, there are few packages called Swing. You may look at those.

Issuant answered 26/12, 2011 at 16:46 Comment(1)
I've got to build BOTH an Android and a desktop app that integrate with a server to share and manipulate the same data in different ways. If I didn't need to worry about Desktop GUI development I wouldn't have asked. :)Gabbert

© 2022 - 2024 — McMap. All rights reserved.