Is progress bar related to computing power
Publish: 2021-04-26 08:08:02
1. The progress bar should be placed in the main thread, and there is no need to start the thread separately
when the calculation process is put into the thread, the data (including updatedata) should be processed in the dialog box, then the thread should be started, and the dialog pointer should be passed to the thread
in a thread, you can return (write back) a dialog variable, which can be used to control the progress bar in the dialog box. If you don't need accurate progress, you can also use waitingforsingsingleobject to control the end of the progress bar.
when the calculation process is put into the thread, the data (including updatedata) should be processed in the dialog box, then the thread should be started, and the dialog pointer should be passed to the thread
in a thread, you can return (write back) a dialog variable, which can be used to control the progress bar in the dialog box. If you don't need accurate progress, you can also use waitingforsingsingleobject to control the end of the progress bar.
2. Modify the status of the progress bar in action processing.
3. The progress bar is the progress of time. When the progress bar is finished, the password will be changed once
this is an active defense password updated regularly, which has a higher security level than a fixed password
the number above is the dynamic security input when sensitive operations are performed on the account.
this is an active defense password updated regularly, which has a higher security level than a fixed password
the number above is the dynamic security input when sensitive operations are performed on the account.
4. The progress bar can set a value
one is the maximum value and
one is the initial value. Use thread to make it increase initial value continuously
then get the playback time of your current song, and update every few seconds in the thread
of course, if the unit is MS, set it to 100 directly.
one is the maximum value and
one is the initial value. Use thread to make it increase initial value continuously
then get the playback time of your current song, and update every few seconds in the thread
of course, if the unit is MS, set it to 100 directly.
5. CPU capacity
memory size and frequency
hard disk reading and writing capacity
memory size and frequency
hard disk reading and writing capacity
6. It's directly related to network speed
it's also related to the configuration of your computer and your browser
it's also related to the configuration of your computer and your browser
7. Just check the IE view status bar
8. File byte: VAR file = new FileInfo (zippath). Length
the progress bar is displayed. You can find out if there is any overload in SharpZipLib library to transfer delegation. If not, you can add a
similar to
unzip (string filepath, other parameters.., action & lt; int> Report process)
{
while (decompressing)
{
...
var percent = according to the percentage of zip stream. Position or the number of decompressed files and the total length as the progress< br /> reportProcess(percent);< br /> }
}
var reportProcess = percent => this.progressBar.Value = percent;< br />UnZip(zipPath,...,reportProcess);
the progress bar is displayed. You can find out if there is any overload in SharpZipLib library to transfer delegation. If not, you can add a
similar to
unzip (string filepath, other parameters.., action & lt; int> Report process)
{
while (decompressing)
{
...
var percent = according to the percentage of zip stream. Position or the number of decompressed files and the total length as the progress< br /> reportProcess(percent);< br /> }
}
var reportProcess = percent => this.progressBar.Value = percent;< br />UnZip(zipPath,...,reportProcess);
9. 给你给程序你看看吧一看就会懂得
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class Example10_17{
public static void main(String args[]){
new BarWin();
}
}
class BarWin extends JFrame implements Runnable{
JProgressBar pbar1,pbar2;
Thread thread1,thread2;
JTextField text1,text2;
int number=50;
BarWin(){
pbar1=new JProgressBar(0,number);
pbar2=new JProgressBar(0,number);
pbar1.setStringPainted(true);
pbar2.setStringPainted(true);
text1=new JTextField(10);
text2=new JTextField(10);
thread1=new Thread(this);
thread2=new Thread(this);
Box boxV1=Box.createVerticalBox();
boxV1.add(pbar1);
boxV1.add(pbar2);
Box boxV2=Box.createVerticalBox();
boxV2.add(text1);
boxV2.add(text2);
Box baseBox=Box.createHorizontalBox();
baseBox.add(boxV1);
baseBox.add(boxV2);
setLayout(new FlowLayout());
add(baseBox);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(10,10,300,300);
setVisible(true);
thread1.start();
thread2.start();
}
public void run(){
if(Thread.currentThread()==thread1){
for(int i=1;i<=number;i++){
text1.setText("第"+i+"项="+f(i));
pbar1.setValue(i);
try{ Thread.sleep(500);
}
catch(InterruptedException e){}
}
}
if(Thread.currentThread()==thread2){
long a1=1,a2=1,a=a1;
int i=1;
while(i<=number){
if(i>=3){
a=a1+a2;
a1=a2;
a2=a;
}
text2.setText("第"+i+"项="+a);
pbar2.setValue(i);
i++;
try{ Thread.sleep(500);
}
catch(InterruptedException e){}
}
}
}
long f(int n){
long c=0;
if(n==1||n==2)
c=1;
else if(n>1)
c=f(n-1)+f(n-2);
return c;
}
}
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class Example10_17{
public static void main(String args[]){
new BarWin();
}
}
class BarWin extends JFrame implements Runnable{
JProgressBar pbar1,pbar2;
Thread thread1,thread2;
JTextField text1,text2;
int number=50;
BarWin(){
pbar1=new JProgressBar(0,number);
pbar2=new JProgressBar(0,number);
pbar1.setStringPainted(true);
pbar2.setStringPainted(true);
text1=new JTextField(10);
text2=new JTextField(10);
thread1=new Thread(this);
thread2=new Thread(this);
Box boxV1=Box.createVerticalBox();
boxV1.add(pbar1);
boxV1.add(pbar2);
Box boxV2=Box.createVerticalBox();
boxV2.add(text1);
boxV2.add(text2);
Box baseBox=Box.createHorizontalBox();
baseBox.add(boxV1);
baseBox.add(boxV2);
setLayout(new FlowLayout());
add(baseBox);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(10,10,300,300);
setVisible(true);
thread1.start();
thread2.start();
}
public void run(){
if(Thread.currentThread()==thread1){
for(int i=1;i<=number;i++){
text1.setText("第"+i+"项="+f(i));
pbar1.setValue(i);
try{ Thread.sleep(500);
}
catch(InterruptedException e){}
}
}
if(Thread.currentThread()==thread2){
long a1=1,a2=1,a=a1;
int i=1;
while(i<=number){
if(i>=3){
a=a1+a2;
a1=a2;
a2=a;
}
text2.setText("第"+i+"项="+a);
pbar2.setValue(i);
i++;
try{ Thread.sleep(500);
}
catch(InterruptedException e){}
}
}
}
long f(int n){
long c=0;
if(n==1||n==2)
c=1;
else if(n>1)
c=f(n-1)+f(n-2);
return c;
}
}
10.
The responsibility of the back end
Hot content
