Java visual stuff
Posted: Sun Jan 14, 2007 9:56 pm
Ok so I am working with a progress bar and I have got it to work no problem. Super! The problem though is that after I start the program that uses the progress bar, the rest of the elements freeze. Like the menu bar, if I minimize the applet as it runs the file upload then restore it the menu bar will be transparent kinda as it will not be the menu bar anymore but what was behind it (like when a program freezes and you try to maximize it again or something). Everything goes back to normal when the program finishes the main loop.
I was wondering how I could make this menu stay visible at all times without it going into freeze mode. Here is the relative code:
I use the SetContent in the loop to make the content text block not do the same thing the menu bar is doing.
I was wondering how I could make this menu stay visible at all times without it going into freeze mode. Here is the relative code:
Code: Select all
//THE UPLOADING LOOP
while ((current_byte = bufferedinputstream.read()) != -1)
{
iteration = iteration + 1;
float percent = percent_per_iteration * iteration;
shiznatix.VisualElements.SetProgressBarValue((int)percent);
shiznatix.VisualElements.SetContent("");
bufferedoutputstream.write(current_byte);
}
//END THE UPLOADING LOOP
//THE VISUAL ELEMENTS METHODS
public void SetProgressBarValue(int Percentage)
{
progress_bar.setValue(Percentage);
Rectangle progressRect = progress_bar.getBounds();
progressRect.x = 0;
progressRect.y = 0;
progress_bar.paintImmediately(progressRect);
}
public void SetContent(String str)
{
if (str != "")
{
content.append(str + "\n");
}
Rectangle progressRect = content.getBounds();
progressRect.x = 0;
progressRect.y = 0;
content.paintImmediately(progressRect);
}