As I'm (re)building a GUI in Java, I see some things in Java Swing are not so pretty, or the options are not as rich as in some other GUI frameworks.
So in the old GUI, this is what we see
Now when I try to remake this with Swing, this is my best guess:
My question: is there a more elegant and neat way to make a toggle work in a menu, while also using an icon in Swift? I don't want a checkbox and an icon, I want an icon instead of a checkbox, at the place of the checkbox. As can be seen in the old GUI picture.
Related
I'm currently learning IntelliJ's GUI designer but I'm struggling to find documentation or any guides. So far I have watch a fantastic introductory youtube series from a guy called Scott Couprie, which I really recommend to any complete beginners reading this.
I would like to do three things. If anybody has a link to documentation or guides that'd be great.
Change the window title bar text.
EDIT: I have now discovered this can be changed with setTitle("Title").
Change the system menu icon. I am using MacOS so I don't even see an icon in the preview, so I'm not even sure where the icon goes.
EDIT: while I can't confirm this is working due to using MacOS, I see that you can use the following in the constructor:
ImageIcon img = new ImageIcon("images/16x16.png");
setIconImage(img.getImage());
Be able to click a button and go to another form. So far I have been able to switch panels after pressing a button, but only to other panels within the same form itself.
Thanks.
I have tried searching for related documentation or youtube videos but I'm not sure what terms to search.
This can be changed with:
setTitle("Whatever you want the title to say");
The tiny icons eclipse displays below its JMenuBar, what are those? How would one go about creating them? Are they part of the JMenuBar? Are they seperate from the JMenuBar?
I don't use Eclipse but from some images I've seen it looks to me like they are buttons on a JToolBar.
See the section from the Swing tutorial on How to Use Tool Bars for more information and examples.
I've set my program to appear in the system tray by doing what Oracle told to do. My first question is about the icon. I have a lot of programs in the system tray and mine is hidden. Can I make it to show in the bar without needing to click the arrow in the tray?
I also figured out that I can display a message by calling trayIcon.displayMessage(title, content, icon). I wonder if I can change the outlook of the balloon in the way Skype has done it.
Or do I need to use someting else do display a message? It should appear always in the front of all the applications and it shouldn't hinder other applications. For example if the user is playing a game, the information dialog shouldn't steal the focus from mouse and keyboard.
No you cant change the style of the baloon using the java systray mechanism. Skype doesnt use the java mechanism to show the systray. It is the systems task to style and display the baloon.
To show your icon, it is a windows configuration - when you click the arrow, there is a "customize" link, where you can configure which icons are displayed.
If you want to influence the style of the window, you need to implement your custom Frame that feels like and is positioned like a systray info window. And you would not use the Tray classes.
Concerning your question regarding skinning. The SystemTray displayMessage balloon can not be customized in any way.
i like the style of netbeans palette (Window -> Palette, best seen when creating a gui). i would like to integrate a similar collapsable panel in my application, but i have no idea how to find this component. i guess its not a standard swing component, although it looks kind of similar to a jTree. i poked arround the netbeans framework, but i couldnt find the corresponding class.
I know about swingx's JXTaskPane, but i would really prefer an easy, clean way to hide, show and group ui components, without fancy-animation bloating my app needlessly. The netbeans palette seems just perfect. but how is it called & where can i find it?
I develop a number of desktop Java applications using Swing, and while Swing is quite powerful (once you get the hang of it), there are still a lot of cases where I wish some advanced component was available right out of the box.
For example, I'd really like to see easy-to-use components (without writing them myself, which I could do given enough time) like:
Multi-line label
Windows File Explorer-like Icons or Thumbnails view
Drop-down button (like Firefox's old Back button)
5-star rating widget
Combo box with automatic history (like the text field on Google)
An Outlook-style accordion-style bar
and so on
I know of a couple of sources of free Swing components, like SwingLabs, home of JXTable, JXDatePicker, and a few others.
Where do you go for Swing components beyond those included with Java itself?
The following are worth a look:
swingX
Glazed lists
Substance look'n'feel
Flamingo components
Ken Orr's Mac Widgets
Jide's open source components
As for: "Windows File Explorer-like Icons or Thumbnails view"
They are built in in swing.
File explorer icons are accessed through FileSystemView class ( it is used by JFileChooser ) when the L&F is Windows of course.
FileSystemView.getFileSystemView();
Icon driveIcon = fsv.getSystemIcon( new File("C:\\"));
And the Thumbnails icon can be retrieved with the sun.com class that are discouraged by Sun
sun.awt.shell.ShellFolder getIcon( boolean largeIcon )
But this one may not perform very well some times ( due to native resources handling I think ).
I know you can get an awesome wrapping labe and an accordion from javaswingcomponents, however they are not open source implementations.
Otherwise Jide and SwingX are great choices.