File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes java gui on linux? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "java gui on linux?" Watch "java gui on linux?" New topic
Author

java gui on linux?

Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
I have programmed using GTK++ , and QT with X11 libraries on linux based machines.

What I am trying to understand is what does java call to make it's gui.
What I mean is say you have a JFrame and setVisible ...etc so it pop's up a gui Frame box.

How it works in windows is when you install java it comes with dll's for awt and swing that call the win32 api's graphics/windows gui functions
I am wondering what java on linux does , is it just shipped with the equivalent awt.dll but as awt.so library that calls the x11 libraries.
I am assuming these dll's that where used for windows and the source that generates them would need to be completely rewritten and recompiled for a linux gui functions on a linux machine

Also is the native functions that JFrame and other gui java stuff uses calling desktop manger gnome functions , windows manager functions or more general x11 top level functions.
Since if you change the desktop manger or windows manager it seems to change the JFrame look and feel?

Wondering if anybody knows the inner workings of this and can elaborate
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Yes, the Linux JRE comes with its own set of native libraries. Swing ships with a set of LAFs (Look-And-Feels) on each platform; on Linux CDE/Motif and/or GTK+ LAFs are available, amongst others. See http://en.wikipedia.org/wiki/Pluggable_look_and_feel and http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html for more details.
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
cool,
also is it possible to get a LAF on linux that looks exactly like xp or vista running under gnome? Or is the look and feels for java gui programs (or maybe even more general any gui program)
restricted to the look and feels of the desktop/windows manager you are under?

If it is restricted to the desktop/windows manager that is running on your linux system then the only way to get a windows look and feel on a linux system is to install a desktop/windows manager that can look like a windows system one. Assuming of ofcourse your not running your java or gui program on wine , virtualbox or any other virtual based tool that emulates another system.
Yes /No?

Question 2
Is their anyway to create your own theme or look in feel under linux? Like in ubuntu I can go to the desktop properties and select from a whole bunch of different themes , colors , fonts ,...etc.
Is their away to create your own or import/get a new them that looks exactly like windows 7 or something else???
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
is it possible to get a LAF on linux that looks exactly like xp or vista running under gnome? Or is the look and feels for java gui programs (or maybe even more general any gui program) restricted to the look and feels of the desktop/windows manager you are under?

The Windows LAF can emulate XP and Vista depending on where it's running, according to the Oracle doc I linked to, but you'd have to do a little bit of patching to make it run on non-Windows JREs (see the isNativeLookAndFeel and isSupportedLookAndFeel methods in the com.sun.java.swing.plaf.windows.WindowsLookAndFeel class).

Is their anyway to create your own theme or look in feel under linux? ... Is their away to create your own or import/get a new them that looks exactly like windows 7 or something else?

The synth LAF is meant for customization. It's based on XML files, though - maybe someone, somewhere has written a GUI editor for it, but I doubt that. I also doubt that it lets you get anywhere near to a proper WIndows appearance, but that's pure conjecture on my part.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

The acronym to look for is "PLAF" - Programmable Look And Feel.

However, unless you're trying to con Windows users into using Linux, making Linux look/act like Windows isn't going to make you very popular!


Customer surveys are for companies who didn't pay proper attention to begin with.
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
No, just trying to get a program to look the same on any platform/machine out their. (Regardless of weather it is x11 , or windows )

startx -- : 1 ,2,... , ctrl+alt+f7,8,9,...
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
In that case, why not go with the Ocean or Nimbus LAFs?
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
Thanks didn't know that all set
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java gui on linux?
 
Similar Threads
JVM crash
Jasper Report: Can't connect to X11 window server
stop blinking cursor in Eclipse3.2 in Linux
Configuring eclipse to use dll files at runtime
JNI - Obtaining window handles from AWT