Increase size of title bar in Swing - java

I am trying my hand in swing applications and would like to know if there is a way to increase the height of the title bar of a JFrame/JDialog?
And also Can I get rid of the Swing icon and replace it with an icon of my own choice?
Sorry if this is a repeated question/too silly , I just haven't found a suitable answer anywhere yet :( Thanks !

.. if there is a way to increase the height of the title bar of a JFrame/JDialog?
Given that wold make that one app. inconsistent with all the other apps. that open on this machine, I'd sure hope not. (And as far as I know, 'no it is not possible'.)
Can I get rid of the Swing icon and replace it with an icon of my own choice?
See JFrame.setIconImage(Image).

Related

How to change the color of the Title bar when running a GUI program?

I want to change the color of the title bar and also the Java icon on the upper left of the frame, so I can make my program (GUI) look better. Is there a simple way to change it?
I'm not sure how useful this observation is, but under the X Window System (e.g. on Linux), the titlebar and the icons in it aren't usually under the control of the application, they're “decorations” under the control of the window manager (WM). I'm not sure exactly how this might impact a Java program — they might be able to use undecorated windows and add their own equivalent — but it's equally possible that what you want to do simply isn't possible (without an inordinate amount of effort) on any platform.

What is the border type of the digichat login button?

I tried many methods to make a JButton such as the "Connect" button which appears in the digichat applet,
but I failed! Oh, I want know: What is the border type of this button? I attached a photo to explain the button; can any one help me with ideas, or tell me how to create it?
It may very well be a custom border, implemented entirely from scratch or a CompoundBorder which is a combination of several standard borders.
There's no way to tell how they have solved it based on the screen shot.
The appearance is defined by the old Mac OS 9 Look & Feel, as shown here:
Although it's a considerably more laborious alternative, you can implement your own ButtonUI, as illustrated here and here.

Java Progress Bar is Grey

I implemented an indeterminate java progress bar in my program but for some reason the progress bar is grey instead of blue. Any ideas why this is happening?
This is how the progress bar looks; it is supposed to have moving blue lines shown below instead of the stationary grey ones as shown in the picture.
Maybe the JProgressBar is disabled. When working with a GUI Editor, search for the option enabled and make sure it is set to true.
You can do it manually as well by calling:
progressbar.setEnabled(true);
I will assume that you are talking about a awt/swing application. The progress bar color, along with every other GUI element, is regulated by the Look & Feel of the application. Swing/awt have standardized look and feels, but also some that are heavily platform-dependent. For more precise information, please provide a screenshot of your progress bar and also of the one that you think your bar should look like.
For information how to set the look & feel, look here:
http://docs.oracle.com/cd/E17409_01/javase/tutorial/uiswing/lookandfeel/plaf.html
EDIT:
Can you provide the code of your app where you define the progress bar? I assume it is a JProgressBar? Also, what OS do you use?
EDIT EDIT:
The progress bar you created can have its look and feel changed.
http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingJProgressBarLookandFeel.htm
Experiment with the mentioned properties like that:
UIManager.put("ProgressBar.selectionBackground", Color.blue);
Until you achieve a result that is suitable to you. Hope that helps.

Is it possible to remove the little dropdown arrow in a JInternalFrame?

I'm using a JInternalFrame and I want to remove the dropdown in the upper left of the frame, as it serves no purpose (I've disabled resizeable, closable, etc.)
I don't see a property for this, and I don't want to remove the entire title bar, as the title is necessary. I've looked around online, and basically come up empty here. I'm hoping it's something simple that I've just overlooked, as this is my first time using JInternalFrame, and I'm not exactly a GUI kind of guy to begin with.
internalframe.setFrameIcon(null);
Edit: hack to remove system menu in Windows:
BasicInternalFrameUI ui = (BasicInternalFrameUI)internalFrame.getUI();
Container north = (Container)ui.getNorthPane();
north.remove(0);
north.validate();
north.repaint();
The relevant Icon in The Synth Look and Feel, among the Nimbus Defaults, appears to have this key:
InternalFrame:InternalFrameTitlePane:"InternalFrameTitlePane.menuButton".icon
You may be able to use the approach shown in A Synth Example to replace the Icon.
setFrameIcon(anyBigImageThatCantBeDisplayed);
I´ve tried null parameter and got some visual issues...
So i added a big image(no background) that was already on my resource folder and the icon was no longer displayed as the menu...

How to make iGoogle like UI using java swing

I am developing desktop GUI application using java swing. And I want to show several "subwindow" on the same window(JFrame). And I want the layout is similar to iGoogle such that user can add and remove new subwindow. To be simple, I assume all the "subwindows" have the same size and similar content(all are showing chart). By the way, the maximum number of "subwindow" would not be a huge number. I think it is less than 8.
if there is no drag and drop, can I just use grid layout to
implement it?
if there is drag and drop, what is the easy way to
do it?
Thank You very much.
FYI: iGoogle http://www.google.com.hk/ig
I don't know what iGoogle is, but it sounds like you should be using internal frames. See the section from the Swing tutorial on How to Use Internal Frames.
If all the "sub windows" will be equal size and not draggable, I'd just use a simple layout. seems like a good case to use TableLayout. In a simple case where you know the max amount of slots, you could have 8 corresponding JPanels and add them to Container using the table layout (making sure to revalidate()) as the user requests them. if a user closes one, you just remove it from the container and revalidate. Hope that helps. if you don't need docking functionality, don't even go down that road is my advice.
EDIT:
you could also still implement drag and drop by using your own mouse handlers.

Categories