Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Nebula ProgressCircle"
m |
|||
Line 18: | Line 18: | ||
* You (eventually) set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter. | * You (eventually) set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter. | ||
* If you want to display the text, just use '''setShowText(true)'''. In this case, please fill the pattern with the '''setTextPattern''' method. 2 Constants are provided: '''PERCENTAGE_PATTERN''' and '''INTEGER_PATTERN'''. | * If you want to display the text, just use '''setShowText(true)'''. In this case, please fill the pattern with the '''setTextPattern''' method. 2 Constants are provided: '''PERCENTAGE_PATTERN''' and '''INTEGER_PATTERN'''. | ||
+ | |||
When you set another value for this widget, an image is displayed to show the transition between the previous value and the new value. | When you set another value for this widget, an image is displayed to show the transition between the previous value and the new value. | ||
− | + | ||
− | + | final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); | |
− | final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); | + | circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); |
− | circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); | + | circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); |
− | circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); | + | circle.setMinimum(-100); |
− | circle.setMinimum(-100); | + | circle.setMaximum(100); |
− | circle.setMaximum(100); | + | circle.setSelection(52); |
− | circle.setSelection(52); | + | circle.setThickness(10); |
− | circle.setThickness(10); | + | circle.setCircleSize(100); |
− | circle.setCircleSize(100); | + | circle.setShowText(true); |
− | circle.setShowText(true); | + | |
− | + | ||
You can use it also to display a countdown (like an egg cooker). | You can use it also to display a countdown (like an egg cooker). | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | final LocalTime time = LocalTime.of(0, 2, 40); | + | |
− | circle.startCountDown(time); | + | final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); |
− | + | circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); | |
+ | circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); | ||
+ | circle.setThickness(10); | ||
+ | circle.setCircleSize(100); | ||
+ | circle.setShowText(true); | ||
+ | |||
+ | final LocalTime time = LocalTime.of(0, 2, 40); | ||
+ | circle.startCountDown(time); | ||
=Example= | =Example= | ||
Line 52: | Line 51: | ||
An example called '''ProgressCircleSnippet''' is located in the plugin '''org.eclipse.nebula.widgets.progresscircle.snippets'''. | An example called '''ProgressCircleSnippet''' is located in the plugin '''org.eclipse.nebula.widgets.progresscircle.snippets'''. | ||
− | This example is also available here : [https:// | + | This example is also available here : [https://github.com/eclipse/nebula/blob/master/widgets/progresscircle/org.eclipse.nebula.widgets.progresscircle.snippets/src/org/eclipse/nebula/widgets/progresscircle/snippets/ProgressCircleSnippet.java ProgressCircleSnippet.java] |
Latest revision as of 07:03, 19 March 2020
Introduction
Contents
This widget is a graphical presentation of a ratio. It can be considered as another vision of the progress bar. Please notice that there is no interaction with the user.
Usage
The usage is very simple :
- You create a ProgressCircle widget
- You set the minimum, maximum and selection values with the methods setMinimum, setMaximum, setSelection
- You (eventually) set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter.
- If you want to display the text, just use setShowText(true). In this case, please fill the pattern with the setTextPattern method. 2 Constants are provided: PERCENTAGE_PATTERN and INTEGER_PATTERN.
When you set another value for this widget, an image is displayed to show the transition between the previous value and the new value.
final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); circle.setMinimum(-100); circle.setMaximum(100); circle.setSelection(52); circle.setThickness(10); circle.setCircleSize(100); circle.setShowText(true);
You can use it also to display a countdown (like an egg cooker).
final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); circle.setThickness(10); circle.setCircleSize(100); circle.setShowText(true); final LocalTime time = LocalTime.of(0, 2, 40); circle.startCountDown(time);
Example
An example called ProgressCircleSnippet is located in the plugin org.eclipse.nebula.widgets.progresscircle.snippets.
This example is also available here : ProgressCircleSnippet.java