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
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.
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?
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.
Spring Boot, Swing, JavaFX, Vaadin, and Play are some of the best Java Frameworks for Desktop Applications.
Yes. Absolutely. Java is still 100% supported by Google for Android development. The majority of Android apps today have some mix of both Java and Kotlin code.
The Android platform provides Java framework APIs to expose the functionality of some of these native libraries to apps. For example, you can access OpenGL ES through the Android framework's Java OpenGL API to add support for drawing and manipulating 2D and 3D graphics in your app.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With