Java: JProgressBar - java

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.

Related

Make a borderless JFrame

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.

How to compose images in Eclipse Kepler?

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.

Getting rid of flicker in SWT

We are using a the following class to show a progress-bar in our Java application: TextProgressBar
Unfortunately we are having some problems with flickering when using that (Win 7, Java 7). Do you have any tips on how we can avoid that? Can we somehow repaint it less frequently, use double-buffering or something else? Any tips are greatly appreciated!
First, try passing SWT.DOUBLE_BUFFERED in for the style parameter on construction. If that fails to improve the situation, move up the parent chain and add SWT.DOUBLE_BUFFERED to their constructor call instead.
If you don't have control over the parent, then you'll likely need to wrap your control in another Composite that has this flag enabled.
try SWT.NO_BACKGROUND first, and if not use SWT.DOUBLE_BUFFERED.
Do not use both at the same time, because there is no point.
See the discussion
Disclaimer: I know that the question asks specifically about the TextProgressBar. However, I believe that many views of this question are not limited to this widget.
I had a problem with the flickering of the Text widget, which I could not resolve neither by using the SWT.DOUBLE_BUFFERED style, nor by wrapping it with the Composite, nor by applying any combination of them.
Finally, I was able to resolve this problem by simply changing the widget type from Text to StyledText. There is no flicker even without the SWT.DOUBLE_BUFFERED style and without the Composite wrapper.
Hope this will help someone who was attracted by the broad title of this question.
you can try delaying the time with thread.sleep(). It worked for me when i had the same problem when working with jTables

if it possible reconfigure a jframe

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.

how do I create a Java swing UI like this?

Below UI is something I'd like to aim for. But I have no idea, how they have the "skin" of the app. On my end, the Java application looks like it was made in 1990s. I want to change a look to a more modern style.
What components are they using possibly here? JSplitpane for one. but I'm not sure how they created that "Dokument/Vorschau" tabs.
First using a look and feel like Nimbus, can easily change the look of your application to a have a more modern feel.
Second, you will need to customize the font, color, borders, node icons, etc. of each component type to achieve a non-standard look. Some of these can be changed with updates to the UIDefaults of the look and feel but many will be made by calling methods on the specific instance of the component you are dealing with.
Try a javax.swing.JTabbedPane.
If you really want to change the complete look-and-feel of your application from scratch, you should take a look at Synth L'n'F. You can define style and appearance of components and bind them to components which match certain criteria.
(My opinion on that matter: heavily themed apps usually look and feel out-of-the-place and only make it harder to use the app, so I'd actually try to avoid themeing)

Categories

Resources