I was recently given with the task of completely revising one of my company's software Gui appearance. Up until now I only done basic look-n-feel changes. Mostly upgrading the Gui from the default Metal L&F to System L&F with some GridBagConstraints handling. But this task is something different:
We have a graphic designer who drew the desired design:
I know how to create this kind of functionality. I might use a double JTabbedPanes or just add Jpanels all around.
My problem is how to incorporate the graphics with gui objects. What should I ask the designer to give me in order to make a Java Swing application that looks like this - with the rounded tabs and the merging of tab-panel colors? How can I make JPanels or a JTabbedPanes wear this fancy costume when all I am given right now is this drawing above?
Most custom Swing GUIs are made using JLabels with ImageIcons and custom handling code. For example:
This code creates a custom GUI with a custom frame, border, and a grip for dragging the window, including exit and minimize buttons that glow when your mouse enters them, making them look proffesional. (The images for each component need to be in the root of the project for this to work.) If you want to create custom tabbed panes, create
JLabels
withImageIcons
that look like rounded tabs or anything that you want them to look like, each with its corresponding text on it, and add handling that will make it look selected by changing its color or adding a border around it and bring its corresponding panel to the front, hiding all other panels.Alternatively, you can create a custom Look and Feel, but this is harder to do and does not give you the freedom that using
JLabels
withImageIcons
does.You can also use JavaFX, a rich GUI platform that was designed to replace Swing, but as far as Swing goes, the above code is your best bet for a Swing application.