java L&F to obtain modern "wpf" look - java

Recently I found some absolutely beautiful applications made using WPF.
I'd really like to add this lovely look to my java applications.
Do you know if there are look and feels which make it possible?

First of all think what are the key concepts of the new metro-UI ?
Its flat and simple
1) use metro studio 2 to create icons for the project, use flat borders always
2) either create a full L&F or simply create small custom components ? or use Java FX (http://pixelduke.wordpress.com/2012/10/23/jmetro-windows-8-controls-on-java/ , http://pixelduke.wordpress.com/category/javafx/page/3/)
I was able to come little bit close to metro like text-buttons and background repeat panels, you might also want to see my repo here https://github.com/JaDogg/BhathiGUI
above image is for my near metro custom controls
NOTE : this will not create an actual metro app just one that looks like it
Update
Here is a screenshot of JavaFX application built using Undecorator and JMetro (JavaFX8)

Java was always stingy on new L&F. So new WPF style (developed for Windows 8 apps) is not available yet and i doubt it will be anytime soon.
The latest L&F released and provided together with Java SE was NimbusLookAndFeel. It is based on SynthLookAndFeel, which supposed to be a base for any custom L&F from now on.
There are also native L&Fs with:
Windows 2000 and Vista/7 styles (WindowsLookAndFeel)
GTK style (GTKLookAndFeel)
Mac OS style (AquaLookAndFeel)
There are also some good commercial L&Fs:
Java Look and Feel (L&F)
So if you really want to have such L&F - you will have to modify some existing L&F so it matches WPF styling or wait for a miracle (that someone will release such L&F).

Related

Corrupted java swing component

I'm working on a Java Swing project,
I have an issue with some component while running projects vs running the interface here's some screen shoot :
This look when I run only the jFrame
This is when I run A Frame that lead to this
and this when i run the full project
I want to know why this look difference and how to resolve it.
I'm Using netbeans 12.2 with jdk 15.0.2 on a windows 64 bit machine
Java Swing by default uses native GUI components. The upside of this is that when done correctly, your Java application will have a Windows style on Windows and a Linux on Linux etc. To get a fixed style, you can set the Java Look And Feel to a LAF that is always available, such as the built-in METAL LAF. This page contains much more specifics on Java Look And Feels, how to set them and even how to create your own if you wish.

Changing the default icon in Netbeans' native deployment feature for Java apps

I know the question is very long, but in a nutshell it's just that. As you know Netbeans has a feature with the help of inno setup that allows the creation of .exe installers of Java applications. The problem is that I would like to change the default icon it has (a grey java icon) for a custom one.
I have searched a lot through both Stack and Google and I haven't found anything. The closest it got is to change it via Launch4j. The thing is if it is possible to do it within Netbeans.
Furthermore, I was wondering if there is a possibility to add several languages to the installer and some other features like the creation of a desktop icon. I guess if the option exists it would be in the same place as the change-icon... but I am completely lost regarding this issue.

Swing and GTK font

I have write a little GUI with java Swing. But i have some little problems with the default look and feel using com.sun.java.swing.plaf.gtk.GTKLookAndFeel
As you can see the menus and the buttons doesn't have the same font of the other application in my Desktop (In the picture Eclipse and Nautilus), I'm using GTK on Gnome2.
Meanwhile using the relative look and feel on windows there are not differences:
The font look identical.
How is it possible this? Which parameters can I modify to edit the font look on GTK?
You should let the System decide which L&F to use
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
In your above image you are using Ubuntu with Unity (I guess?), but Unity does not use GTK but Nux.
Another way to create a native Look and Feel is the using the SWT (Standard Widget Toolkit) that provides you with system dependent libraries for Windows, Linux and OSX, so that the graphical elements in your program use the actual native elements from those systems. But I have to warn you, it may not be that easy (and sometimes even weird and annoying :) ) to use, because you cannot use any Swing components. So maybe that's not worth the trouble – it's for you to decide.
Consider setting defaults for the fonts on components after setting your look and feel.
UIManager.put("Menu.font", new FontUIResource(your_desired_font));
UIManager.put("Button.font", new FontUIResource(your_desired_font));
Windows L&F is using by default new Font("Tahoma", Font.PLAIN, 11);
For GTK, set the font standard by UIManager.getLookAndFeelDefaults() does not work... then I found a hack via reflection that works, you can find it here in response:
https://stackoverflow.com/a/31345102/3757320

Java GUI designing outline?

I made a program in C# and I was trying to port it over to java. The design of the GUI is this: http://img507.imageshack.us/img507/7728/34685005.png
The faded separator lines starting after Client Downloader passing through Version 1.0 and stopping before Client Downloader. Are those lines available in java? I'm using jFormDesigner and I'm unsure if those lines are there.
If they are available what are they called? Thanks.
First, if you are trying something complex I would suggest not use a GUI building tool and instead code it by hand.
Look into a Title Border here: http://download.oracle.com/javase/tutorial/uiswing/components/border.html
It will give you the part on the top. You might need to create a custom version to get the "Version 1.0", text or there might already be a third party lib somewhere that has that capability.
You might use SwingX JXTitledSeparator.

How to make your desktop Java app looks like Open Office or Eclipse etc.?

How to make your desktop Java app looks like Open Office or Eclipse etc ?
Installation process looks like any Windpws app. installation. There is no Java logo on the to on a app window. You run it by .exe file. How it is done? Is this jar->exe conversion?
Is there any free tool to do that?
For the native look, you can obviously go the SWT way, like Eclipse does, however it's a painful one. You could/should prefer the Swing look'n'feel, by using, as an example, the Substance Look'n'Feel.
For the installation part, you can use
InstallAnywhere
IzPack
For the exe wrapper, you can use
Launch4J
JSmooth
or others ...
However, I think that, by doing so, you're doing it wrong.
indeed, instead of the classical download/install step, which is cumbersome, you can go the Java Web Start way : user only has to click one webpage link to install application to its machine (with an update mechanism directly integrated in), an install that go as far as potentially including desktop and start menu shortcuts, and an element in the Windows install panel to remove installed software.
I tried Jar2Exe, and JSmooth, they both produce exe files from jar archives.
The question is a little unclear, but I think that what you're after is making your java app behave like a native app (stuff like running it when an icon is double-clicked, etc...). There is an excellent tutorial on this here.
Note that, for the graphic part, Eclipse uses a library called SWT, which is a set of widgets that feel and behave in a different way that Java Swing or AWT.
Anyway, if you go the normal Java (Swing) way, the Java logo on the top of an app window is setIconImage() method in JFrame components.
Riduidel already told you about .exe wrappers and installers you can use. For the installer, I also suggest you to consider Java Web Start instead of a normal Windows installer.
I think it uses LookAndFeel, I let you read: http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e){}
EDIT: I didn't read the entire question ^^' Maybe it will be useful to someone...

Categories