jframe to default show rectangle.
i want to know if it possible we show it similar to a circle?
and how?
It is possible to have non-rectangular JFrames. The simple way to do this is to use AWTUtilities.setWindowShape(Window, Shape). Read the page below for more details.
Someone else mentioned that it's possible to do this using the Robot class, but that unnecessary. Java now supports this natively where possible.
http://today.java.net/pub/a/today/2008/03/18/translucent-and-shaped-swing-windows.html
This article describes a clever hack that allows you to implement non-rectangular and translucent frames. You can apparently do it (non-portably of course) using native code hacks.
Related
Any parameter to set A JFrame's border/frame thickness or existence and still keep the title bar intact? I want an almost borderless frame with a thin blue line like this one and not like the default border.
If JFrame isn't the way to go, what is a good way to achieve that? (preferably that is compatible with WindowBuilder but that's probably asking for too much).
A search barely yields any mention and related questions on SOF don't seem to have answers so I thought I'd try to get a good answer once and for all.
JFrame#setUndecorated
Disables or enables decorations for this frame.
This method can only be called while the frame is not displayable. To make this frame decorated, it must be opaque and have the default shape, otherwise the IllegalComponentStateException will be thrown. Refer to Window.setShape(java.awt.Shape), Window.setOpacity(float) and Window.setBackground(java.awt.Color) for details
Please, consult the available documentation
Please note, you will become responsible for providing the title bar yourself, should you want it
A search barely yields any mention and related questions on SOF don't seem to have answers
Google provides a number of promising hits
I ended up switching to NetBeans and learning some Photoshop basics which you'll need thanks to a comment by #MadProgrammer
writing your own look and feel delegate
and ended up exactly with what you mentioned #theProgrammer101
You can make a JButton, and when it is clicked, call System.exit(0) , which will terminate the program
You can create a similar button for minimize action as well as your own drop down menus that are totally custom made and you won't need to rely on the default JFrmae window in case that bothers you too (I found it horrid).
check out this link for a good NetBeans tutorial with an nice example of writing your own look and feel delegate and this link for a great tutorial on getting started with Photoshop which is critical to GUI creation.
Thought i'd round up some of my research for anyone else who's just getting into GUI's.
This is a followup to Items decorations in a TreeViewer: I have a TreeView with my own Objects. I already have a LabelProvider that supplies Icons and Texts. Now I want to decorate the images with other images depending on some conditions. How can I do this? The referenced question uses ComposedImage, which I suppose is org.eclipse.emf.edit.provider.
Is there a way to do this with SWT/JFace in Eclipse 4.3?
I already tried using a ILightweightLabelDecorator (using the idea from the FAQ), but gave up wrapping that round my LabelProvider.
ILightweightLabelDecorator is really the best way to do this. Wrap your label provider with a DecoratingLabelProvider as described in this answer: Using a ILightweightLabelDecorator decorator Use the org.eclipse.ui.decorators extension point to declare your lightweight decorator.
you may want to look at org.eclipse.jface.viewers.DecorationOverlayIcon which is basically used by decoration providers.
I have a image which contains GUI components such as Button, Label, ComboBox, CheckBox etc. I want to write a Java program to process this image and identify each components and their positions, height and width. Is it possible? If possible, how should I do?
Thanks;
Kapila
You may use an Image Correlation.
Here you have an example in Mathematica:
The same for Combos:
yes it is possible. It more then can be covered in a simple response, but my suggestion would be to use an algorithm that does edge detection then define what you're looking for.
I would suggest looking at javacv, the java binding for opencv.
I work a lot with look and feel in java and it works well but the only problem that the only component that has no change is the title bar(caption) still have the same native look and feel of os(windows platform as example)
i want to know what's is the reason and how to fix this? any body help..........
thanks in advance
Check out Substance https://substance.dev.java.net/see.html
You can change the title bar look and feel with substance support.
Here are a few screenshots:
Some PL&Fs support rendering frame decorations, and some do not. I believe the Sun cross-platform PL&Fs (for instance Metal) support it, but platfrom-specific PL&F (for instance Windows) do not.
The feature is not on by default. To switch it on for all new frames use JFrame.setDefaultLookAndFeelDecorated. The API docs for the method show how to switch it on for frames individually.
If you want to create your own borderless window, instead of using a Frame/JFrame use a Window/JWindow. Frame/JFrame are extensions to Window/JWindow that provide borders and the maximize, minimize and close buttons. Usually those widgets are provided by the OS, but you can override them.
Use
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
Before any JFrame or JDialog creation.
Usually into main.
Is it possible to make a progressbar in Java like displayed on this page?
Image.So, not the default progressbar "filling-way".
If so, how?
Thanks
I found it self. Just call setIndeterminate(true);!!
I found it on java2s
You'd have to do some wicked overriding of either the paint or paintComponent methods (I forget which one exactly), but yeah it's possible. The best way is to look at existing tutorials on custom swing components: http://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html
They're pretty old, but still applicable.
I think the easiest way would be to write your own custom component. The alternative would be a custom look and feel (there's a lot of work involved in that), but it shouldn't be too difficult to write a custom component with your own indeterminate animation very similar to what you see there.