I'm new to Java GUI programming and I want to make a Java GUI application which can run both in Windows and Linux with the same code (the same executable/object file).
Is that possible without any compatibility problems/errors/bugs?
What else (like libraries, classes, packets) will I need to be able to design the GUI in Java?
Should these libraries be present in every computer and every OS to be able for the application to run? Or the Java Virtual Machine (JVM) installed on a computer is enough?
To create the GUI, you use the Java Foundation Classes/Swing (JFC/Swing) and Abstract Window Toolkit (AWT) API. The many classes and interfaces in those packages allow you to easily create buttons, check-box objects, text fields, and other components, as well as components to organize them.
August 4, 2022. A cross-platform GUI is a great tool for designing apps and software that can run seamlessly on: Android, iOS, macOS, Windows, and Linux. So why create apps for different platforms when you can make one for all in less effort and expense?
Swing is the framework that can help you write GUI applications in Java. Have a look at the Swing tutorial from Oracle: http://docs.oracle.com/javase/tutorial/uiswing/
About platform compatibility: Most Linux distribution installs OpenJDK (open source alternative of Java) as default Java compiler. Mostly it works fine with the program written with Oracle JDK. But if you want to be sure, you can install Oracle JDK on Linux too.
About development IDE: Eclipse and Netbeans are both available across multiple platforms including Windows and Linux.
javax.swing.*
, already included into JRE/JDK)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