java swing app with a custom titlebar? - java

Is there a way to write a Java Swing application with a custom chrome? Please take a look* at the frame for Microsoft's Zune 4.0 software.
I realize that colors, the shape of scroll bars, etc. are controlled by skins or looks and feels. Right now I'm trying to tackle the native window which houses the java components--the title bar mainly.
Thanks
(*) http://www.winsupersite.com/zune/zune4_shots.asp

By default the frame of a JFrame is native. This can be removed by calling Frame.setUndecorated. The Sun Window PL&F does not provide a title bar. You could hack aJInternalFrame so that it draws the frame, although that probably isn't going to be as easy as it may seem. Of course, if you are going the full custom route, you can draw whatever you want. From 6u10, Sun's JRE also provides APIs to make windows transparent and non-rectangular.

No part of a Swing component's look and feel is "native" in any way. Swing components are "lightweight", which means they are entirely drawn on the Java side, and not at all on the windowing system side.
To create custom "chrome" you create the UI delegates for one or more components. In yor case, you'd want to muck around with the delegates for JRootPane and JInternalFrame.

The Look and Feel of Swing apps are pluggable..that is it can change on the fly. You can create your own look and feel but its not a simple undertaking. To get started this tutorial explains. This article does a little more.
This project demonstrates what could be done. So its up to your imagination.

Related

How can I create title bar menu in Java

I wanna create a simple application with Java. I designed the main template in my head but I have a kind of design problem.
I am using JMenuBar and JMenu. It works fine but it's location is not exactly what I want.
In ubuntu, I use Eclipse and it has menu in titlebar:
As you can see , menus are at top.(File,Edit,Source,etc..)
However, My application is not the same.
Here is my application.
JMenu is working fine but in title bar there is no menu.
What can I do to create this menus ?
Are there any component for it ?
Thank you.
Best Regards.
Ă–mer.
You may be interested by the Jayatana project
You're using the right components, but have a Look and Feel (L&F) problem. Take a look here:
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
however, I can't guarantee that changing the look and feel will make it look exactly as you want.
The general problem is that Swing abstracts away from the OS's GUI components. Eclipse is also Java, but SWT instead of Swing, so it doesn't have the problem. There may be third party libraries that integrate better with the native L&F - Maurice seems to have found one. Alternatively, you could switch to SWT entirely, but that might be a bit much just to get the right L&F.

How to create the windows 8 FLAT native look in Java Swing programming?

I am creating a java swing application and I am badly need to get the flat GUI look like in windows 8 to my swing application. But I couldn't find it yet. Can you help me?
You can PROBABLY use the default look and feel of swing apps, undecorate everything, and for those icons; I would use buttons with internal panels, images, labels, etc. To get the scroll functionality you should use mouse listeners to detect scrolling and slide the ui accordingly.

How to make Java Swing application developed in NetBeans not have hideous buttons?

I developed a Java application in Netbeans, and I'm going to release it soon so I'm working on making it less ugly. Since I'm developing on a Mac, the GUI builder uses the Mac Look & Feel, which looks decent, but many of my users won't be using Macs. The default L&F is Nimbus, which looks fine except for the buttons, which have annoying borders that are not overridden by the manually setting the borders (you can see how the manual borders look in the image). With the manually set borders, the Nimbus L&F adds its own odd border inside the border I made, which just looks idiotic. Without the manually set borders, Nimbus's borders overlap in visually unappealing ways, and in order to avoid overlap I have to space the buttons really far apart, which I also don't like.
I tried using the other L&Fs available in Netbeans (Metal and something else), but they're just too ugly to stand.
Basically, I would like some advice on how to customize the way buttons look in this application. I don't want to write a button drawing function from scratch or design my own images. I just want a way to change the settings so things don't look stupid. I read in various places that the Substance L&F is good, but I can't find where to download it anywhere. If someone could link me to a download page for Substance or recommend another popular, simple and not stupid-looking L&F, I would greatly appreciate it.
Yeah pretty much all the L&Fs you'll find in Netbeans are worse than the default. The program will use the default Look & Feel of the operating system - so if it's being run on Windows it will have the "Windows-esce" buttons and fonts and on Mac will have the Mac style.
It all depends on what you're looking for. If you're application is meant to be professional and you don't mind it having different styles depending on the OS of the user then I'd leave it as default. It lends familiarity to your program which can truly make the user feel much more comfortable.
If you're after an indetical look for all users then, as you know, you just need to include the L&F with your program. I couldn't find a download for Substance but there are a few L&F's here - both commercial and free.
http://www.java2s.com/Product/Java/Swing/Look-And-Feel-LaF.htm

Change Look and Feel of JFrame?

How would I go about changing the Look and Feel of a JFrame and Swing components to custom pictures and what not? Is there a set of methods and API's or do I need to just make a custom JFrame that allows me to customize my JFrame further?
I'm trying to get something that looks like the World of Warcraft launcher or League of Legends launcher( best examples i've seen with custom everything xD). I'm pretty new to GUIs.
Not exactly an answer to the question, but since you're just staring with Java GUI, I'd recommend diving right into JavaFX -- a modern Java UI toolkit.
Please be sure to start with JavaFX 2.x -- not JavaFX 1.x, which is basically deprecated.

Custom Swing look and feel vs. custom components?

I'm writing a game using Swing and want to achieve a distinctive "steampunk" inspired look for the GUI. This will require some animated components, chunky metallic borders etc.
I know that I can get nice effects by overriding paintComponent and doing all of my rendering for custom lightweight components in that method.
Is this the way to go, or should I be looking at developing a whole new pluggable Look and Feel?
What are the pros/cons of each?
Personally, I think you should go for a completely new look and feel... you may also be able to build it off of Synth L&F rather than writing everything on your own.
Nimbus is an example of an L&F written on top of Synth.
Creating a new L&F is a longer road, but keeps your code simple. (If you only need a few changes it's not worth the effort.) For example, the animations can be coded in the L&F part, so you don't need to worry about it in your components. I would suggest to edit a L&F that is close to what you need.

Categories

Resources