题目

[问答题]请完成下列Java程序:创建一个进度条,可以控制其开始和暂停。要求进度条与线程关联,由线程控制,点击开始按钮开始进度条的滚动,点击停止按钮,暂停,继续点击开始按钮则继续进行。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
importjavax.swing.*;
importjavax.swing.event.*;
importjava.awt.*;
importjava.awt.event.*;
publicclassex15_2extendsJPanel
ThreadProgthProgress;
JProgressBarjPb;//声明一个进程条对象
staticJFramejf;
publicex15_2()
setLayout(newBorderLayout());
jPb=newJProgressBar();
add(jpb,"Center");
JPanelbtnPanel=newJPanel();
JButtonbtnStart=newJButton("开始");
btnPanel.add(btnStart);
btnStart.addActionListener(newActionListener()
publicvoidactionPerformed(ActionEventae)
__________;
);
JButtonbtnStop=newJButton("停止");
btnPanel.add(btnStop);
btnStop.addActionListener(new

提示:未搜索到的试题可在搜索页快速提交,您可在会员中心"提交的题"快速查看答案。
答案
查看答案
相关试题
[单项选择题]下列代码的输出结果是()。classparentvoidprintme()System.out.println("parent");classchildextendsparentvoidprintme()System.out.println("child");voidprintall()super,printme();this.printme();printme();publicclasstestpublicstaticvoidmain(Stringargs[])childmyc=newchild();myc.printall();
A.parentchildchild
B.parentchildparentC.parentchildD.编译错误
[填空题]与显示相关的Applet方法有【10】(),repaint()和update()。
[填空题]下列程序的运行结果是【14】。
publicclassTest
publicstaticvoidmain(Stringargs[])
Strings1="hello!";
System.out.println(s1.toUpperCase());
[单项选择题]在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干城市的名称。当单击列表框中的某个城市名时,该城市名从列表框中消失,并在标签中显示出来。下列能正确实现上述操作的程序是【】
A.PivateSubListl_Click()Label1.Caption:List1.ListlndexList1.RemoveltemList1.TextEndSub
B.PrivateSubListl_Click()Label1.Name=List1.ListlndexListl.RemoveltemListl.TextEndSub
C.PrivateSubList1_Click()Labell.Caption=Listl.TextList1.RemoveltemListl.ListlndexEndSub
D.PrivateSubList1_Click()Label1.Name=List1.TextList1.RemoveltemList1.ListlndexEndSub
[单项选择题]执行下面程序后,结果是   publicclassTestrr     publicstaticvoidmain(Stringargs[])      inti=0xFFFFFFF1;      intj=-i;      System.out.println("j="+j);       
A.j=-15
B.j=-16
C.j=16
D.j=15
联系我们 会员中心
返回顶部