JProgressBar如何控制程序的流程?谢谢 学习。他好象不能控制程序的运行吧,应该是模拟程序的运行进度,也不是真的就那样。只是在程序的线程运行过程中,去访问JProgressBar,更新他的值(大部分用颜色填充),来给你一种进度的感觉。继续学习。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我看到了的一则代码,我用后觉得有控制但是不是很好,大家看看,给些意见! m_counter = 0; progress1.setValue(m_counter); jPanel11.remove(jScrollPane4); jPanel11.add(panel1, BorderLayout.CENTER); jTabbedPane2.setVisible(true); jTabbedPane2.paintAll(jTabbedPane2.getGraphics()); UpdateThread update = new UpdateThread(); update.start(); MyNode node = new MyNode(Schema, BO_name, "bo", level); MyModel model = new MyModel(node); JTree jTree2 = new JTree(model); jScrollPane4.getViewport().add(jTree2, null); if (!update.isInterrupted()) { update.interrupt(); update.stop(); } while (m_counter < m_max) { progress1.setValue(m_counter); jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(), progress1.getWidth(), panel1.getHeight() / 7); m_counter = m_counter + 2; try { Thread.sleep(50); } catch (Exception ex) { } 线程 class UpdateThread extends Thread { Runnable runme; public UpdateThread() { } public void run() { m_counter = m_min; try { while (m_counter <= m_max) { progress1.setValue(m_counter); jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(), progress1.getWidth(), panel1.getHeight() / 7); m_counter = m_counter + 2; try { Thread.sleep(500); } catch (Exception ex) { } } } catch (Exception e) { while (m_counter < m_max) { progress1.setValue(m_counter); jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(), progress1.getWidth(), panel1.getHeight() / 7); m_counter = m_counter + 2; try { Thread.sleep(50); } catch (Exception ex) { } } return; } } } 你最大值m_max是怎么得到的? 刚才,发作地方了。抱歉!我就是因为m_max无法得到,所以没办法控制的。各位有什么想法?谢谢 第一次提问 关于右移求解 菜鸟提问:请问J2EE和J2ME有联系吗?不学J2EE是不是可以直接学习J2ME 如何获得查询的表名? 小弟很急!!!!!!!!!!!!! 急 rmiregistry(port)? 有哪位大侠知道jbuilder 企业版for linux的下载地址,多谢多谢 调查--- 大家都在用JAVA做什么???? java问题,请问有没有控制输出小数点后两位的函数? eclipse无法用键盘输入求解决 请教,在input框的value中加"怎么加 请问,如何替代字符串中的几个字符
我用后觉得有控制但是不是很好,大家看看,给些意见!
m_counter = 0;
progress1.setValue(m_counter);
jPanel11.remove(jScrollPane4);
jPanel11.add(panel1, BorderLayout.CENTER);
jTabbedPane2.setVisible(true);
jTabbedPane2.paintAll(jTabbedPane2.getGraphics());
UpdateThread update = new UpdateThread();
update.start();
MyNode node = new MyNode(Schema, BO_name, "bo", level);
MyModel model = new MyModel(node);
JTree jTree2 = new JTree(model);
jScrollPane4.getViewport().add(jTree2, null);
if (!update.isInterrupted()) {
update.interrupt();
update.stop();
}
while (m_counter < m_max) {
progress1.setValue(m_counter);
jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(),
progress1.getWidth(),
panel1.getHeight() / 7);
m_counter = m_counter + 2;
try {
Thread.sleep(50);
}
catch (Exception ex) {
} 线程
class UpdateThread
extends Thread {
Runnable runme;
public UpdateThread() {
} public void run() {
m_counter = m_min;
try {
while (m_counter <= m_max) {
progress1.setValue(m_counter); jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(),
progress1.getWidth(),
panel1.getHeight() / 7);
m_counter = m_counter + 2;
try {
Thread.sleep(500);
}
catch (Exception ex) {
}
}
}
catch (Exception e) {
while (m_counter < m_max) {
progress1.setValue(m_counter);
jTabbedPane2.paintImmediately(progress1.getX(), progress1.getY(),
progress1.getWidth(),
panel1.getHeight() / 7);
m_counter = m_counter + 2;
try {
Thread.sleep(50);
}
catch (Exception ex) {
}
}
return;
}
}
}
你最大值m_max是怎么得到的?