如何使用摆动计时器来延迟加载进度条(How to use the Swing Timer to delay the loading of a progress bar)
我需要找到一种使用进度条的Swing Timer的方法。 我尝试使用Thread.sleep(),但它使应用程序崩溃时。 任何使用Swing Timer而不是Sleep()的方法?
public void piiEros(int dist) { Pii pii = new Pii(); pii.setVisible(true); for(int pc = 0;100 > pc; pc++) { try { Thread.sleep(dist/100); } catch (InterruptedException ex) { Logger.getLogger(Trav.class.getName()).log(Level.SEVERE, null, ex); } pii.pg.setValue(pc); } pii.dispose(); o.Eros(); }
注意:Pii是带有进度条的课程。 Dist是它加载的速度。 Trav是该方法所在的类.Pc代表%,在酒吧显示的内容多少。 o.Eros打开另一个GUI。
I need to find a way to use the Swing Timer with a progress bar. I tried using Thread.sleep(), but it crashed the app when I used it. Any ways to use the Swing Timer instead of the Sleep()?
public void piiEros(int dist) { Pii pii = new Pii(); pii.setVisible(true); for(int pc = 0;100 > pc; pc++) { try { Thread.sleep(dist/100); } catch (InterruptedException ex) { Logger.getLogger(Trav.class.getName()).log(Level.SEVERE, null, ex); } pii.pg.setValue(pc); } pii.dispose(); o.Eros(); }
NOTES: Pii is a class with th Progress Bar. Dist is the speed at which it loads. Trav is the class the method is in. Pc stands for %, how much is done is displyed on the bar. o.Eros opens anotherr GUI.
原文:https://stackoverflow.com/questions/15668715
更新时间:2022-01-05 06:01
最满意答案
尝试这个:
Config::set('database.fetch', PDO::FETCH_ASSOC); $pools = DB::table('addresses as a') ->join('incodes as i', 'i.id', '=', 'a.incode_id') ->join('draws as d', 'd.incode_id', '=', 'i.id') ->join('users as u', 'u.id', '=', 'a.user_id') ->where('d.isactive', '=', '1') ->select('u.id as user_id', 'd.id as draw_id') ->distinct() ->get(); Pool::insert($pools); foreach ($pools as $pool) { if ($draw = Draw::find($pool['draw_id'])) { $draw->isactive = 0; $draw->save(); } }
Try this:
Config::set('database.fetch', PDO::FETCH_ASSOC); $pools = DB::table('addresses as a') ->join('incodes as i', 'i.id', '=', 'a.incode_id') ->join('draws as d', 'd.incode_id', '=', 'i.id') ->join('users as u', 'u.id', '=', 'a.user_id') ->where('d.isactive', '=', '1') ->select('u.id as user_id', 'd.id as draw_id') ->distinct() ->get(); Pool::insert($pools); foreach ($pools as $pool) { if ($draw = Draw::find($pool['draw_id'])) { $draw->isactive = 0; $draw->save(); } }
相关问答
更多-
Meteor / Mongo - 从模板中检索_id以在函数中使用(Meteor / Mongo - Retrieving _id from template to use in function)[2024-03-20]
根据您的方法调用,您似乎只想更新此页面上的某个特定公司,并且只会在.find()中返回一个。 如果不是这样,您需要更新您的出版物和您的路线,只返回一个组织。 以下是根据我的假设使事情有效的代码:Update your Company Details
{{#with company}} -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
尝试这个: Config::set('database.fetch', PDO::FETCH_ASSOC); $pools = DB::table('addresses as a') ->join('incodes as i', 'i.id', '=', 'a.incode_id') ->join('draws as d', 'd.incode_id', '=', 'i.id') ->join('users as u', 'u.id', '=', 'a.us ...
-
使用LINQ toSQL从存储过程返回新插入的行id(Return newly inserted row id from stored procedure using LINQ toSQL)[2023-06-27]
在@ user2946329的帮助下以及Google上的一些搜索,我设法得到答案。 我改变了我的存储过程,如下所示: insert into Workshop(title, date, time, mandatory, sid) values(@title, @date, @time, @mandatory, @sid) declare @wid int set @wid = SCOPE_IDENTITY() select @wid AS wid 我使用select语句而不是return返回最后插入的行i ... -
从AddOrUpdate中检索id(Retrieve id from AddOrUpdate)[2021-02-15]
首先将对象分配给一个变量: public int AddOrUpdateColor(string ColorCode, int ColorInt) { var color = new ColorPaletteColor { ColorCode = ColorCode, ColorInt = ColorInt }; db.ColorPalletteColors.AddOrUpdate(c => c.ColorC ... -
你只需要添加一个类型注释来使类型检查成功: λ> fromSql $ toSql "foobar" :: String "foobar" 如果您使用的是更多上下文代码,则可以在可以推断的情况下跳过注释,例如: λ> putStrLn $ fromSql $ toSql "foobar" foobar 由于putStrLn类型为String -> IO () ,因此会自动为您推断类型。 试图给出一些直觉,为什么这是必要的: toSql的类型是: toSql :: Convertible a SqlValu ...
-
你有额外的dot并在DOM对象上调用attr而不是直接访问id 更改 $('.showmovingEdit').[0].attr('id') ^ 至 $('.showmovingEdit')[0].id 或使用get() $('.showmovingEdit').get(0).id 或使用eq() $('.showmovingEdit').eq(0).attr("id"); 编辑 每个jQuery对象也伪装成一个数组,因此我们可以使用数组解除引用运算符来获取 ...
-
因为sql错了没有回复 because the sql was wrong nothing was being returned
-
我认为以下代码可能是您想要的: