public class ProgressBar extends Widget implements Orientable
Note that like most things in GTK, most of the code that actually updates the ProgressBar will not run until control is returned to the main loop. Keep that in mind if you're wondering why the bar hasn't "updated".
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Constructor and Description |
---|
ProgressBar()
Instantiate a new ProgressBar.
|
Modifier and Type | Method and Description |
---|---|
double |
getFraction()
Get the current progress bar fraction
|
Orientation |
getOrientation()
Get the orientation of this Orientable.
|
double |
getPulseStep()
Get the current progress bar pulse step
|
String |
getText()
Getting the text superimposed on the ProgressBar itself.
|
void |
pulse()
Causes the ProgressBar to enter "activity mode", used to
indicate that the application is making progress but in a way that
can't be strictly quantized.
|
void |
setFraction(double fraction)
Set the fraction of the ProgressBar that shows as completed or
"filled-in".
|
void |
setOrientation(Orientation orientation)
Set the orientation of this Orientable.
|
void |
setPulseStep(double fraction)
Set the progress bar pulse step.
|
void |
setShowText(boolean value)
Sets whether the progressbar will show text superimposed over the bar.
|
void |
setText(String text)
Cause text to appear superimposed on the ProgressBar itself.
|
boolean |
showsText()
Tells whether or not the progress bar is able to show text.
|
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public double getFraction()
public Orientation getOrientation()
Orientable
getOrientation
in interface Orientable
public double getPulseStep()
public String getText()
public void pulse()
An example of this is web: most URLs addressable via
http://
are files of known size, and so when downloading
them, a web browser can report exactly what percentage has been
downloaded relative to the file size that was psssed in the initial
HTTP header. Dynamic web pages, on the other hand (ie, your average PHP
or JSP script), do not have a known size at the time the HTTP headers
are sent, and so the web browser doesn't know ahead of time how many
bytes are on the way. In this scenario, all the application can do is
"pulse" the ProgressBar back and forth to indicate that traffic is
continuing to arrive but that the percentage complete is not known, and
that is what this method is for.
Each time this method is invoked, the a little block inside the ProgressBar is moved a small amount. You should therefore call this method fairly frequently (ie with reasonably small time intervals) to cause the effect of the block moving back and forward along the ProgressBar.
public void setFraction(double fraction)
fraction
- a value between 0.0 (not started) and 1.0 (fully complete)IllegalArgumentException
- If fraction is greater than 1.0 or less than 0.0public void setOrientation(Orientation orientation)
Orientable
setOrientation
in interface Orientable
public void setPulseStep(double fraction)
pulse()
; is called.fraction
- a value between 0.0 and 1.0IllegalArgumentException
- If fraction is greater than 1.0 or less than 0.0public void setShowText(boolean value)
setText(String)
method with an empty
String.public void setText(String text)
text
- Use null
if you want to clear any text there.public boolean showsText()