16单元4 图形用户界面程序设计编程题信息.docx
《16单元4 图形用户界面程序设计编程题信息.docx》由会员分享,可在线阅读,更多相关《16单元4 图形用户界面程序设计编程题信息.docx(18页珍藏版)》请在冰豆网上搜索。
16单元4图形用户界面程序设计编程题信息
流水号
答题时间
分数
内容号一
权重一
内容号二
权重二
040072
0
0
040300
10
0
0
内容号三
权重三
题型
难度
题类
外型
能力
0
0
5
5
0
0
0
区分度
关联题号1
关联题号2
相关码
等效试题号
空行
选项个数
0
0
0
0
0
50
4
签名
拟题人
初审人
复审人
定稿人
倪晓瑞
编写一个国际象棋棋盘
importjava.awt.*;
importjavax.swing.*;
publicclassexercise9{
publicstaticvoidmain(Stringargs[])
{RectFrameframe=newRectFrame();
frame.setTitle("exercise11.7");
frame.setSize(300,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);}}
classRectPanelextendsJPanel{
/**
*
*/
privatestaticfinallongserialVersionUID=1L;
protectedvoidpaintComponent(Graphicsg)
{super.paintComponent(g);
g.fillRect(getWidth()/8,0,getWidth()/8,getHeight());
g.fillRect(3*getWidth()/8,0,getWidth()/8,getHeight());
g.fillRect(5*getWidth()/8,0,getWidth()/8,getHeight());
g.fillRect(7*getWidth()/8,0,getWidth()/8,getHeight());}
publicDimensiongetPreferredSize(){
returnnewDimension(100,50);}}
classFillRectPanelextendsJPanel{
/**
*
*/
privatestaticfinallongserialVersionUID=1L;
protectedvoidpaintComponent(Graphicsg)
{super.paintComponent(g);
g.fillRect(0,0,getWidth()/8,getHeight());
g.fillRect(getWidth()/4,0,getWidth()/8,getHeight());
g.fillRect(getWidth()/2,0,getWidth()/8,getHeight());
g.fillRect(3*getWidth()/4,0,getWidth()/8,getHeight());}}
classRectFrameextendsJFrame{
/**
*
*/
privatestaticfinallongserialVersionUID=1L;
publicRectFrame(){
getContentPane().setLayout(newGridLayout(8,1));
getContentPane().add(newRectPanel());
getContentPane().add(newFillRectPanel());
getContentPane().add(newRectPanel());
getContentPane().add(newFillRectPanel());
getContentPane().add(newRectPanel());
getContentPane().add(newFillRectPanel());
getContentPane().add(newRectPanel());
getContentPane().add(newFillRectPanel());
}
}
流水号
答题时间
分数
内容号一
权重一
内容号二
权重二
040073
0
0
020400
10
0
0
内容号三
权重三
题型
难度
题类
外型
能力
0
0
5
5
0
0
0
区分度
关联题号1
关联题号2
相关码
等效试题号
空行
选项个数
0
0
0
0
0
48
4
签名
拟题人
初审人
复审人
定稿人
倪晓瑞
编写一个名为OvalButton的自定义按钮类,它扩展JButton,把按钮上的文本显示在一个椭圆中。
importjava.awt.*;
importjavax.swing.*;
publicclassexercise10{
publicstaticvoidmain(String[]args)
{
DrawOvalframe=newDrawOval();
frame.setTitle("Exercise11.6");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(150,100);
frame.setVisible(true);
}
}
classOvalButtonextendsJButton{
/**
*
*/
privatestaticfinallongserialVersionUID=1L;
publicOvalButton(Strings)
{super(s);}
protectedvoidpaintComponnet(Graphicsg)
{
super.paintComponent(g);
g.setColor(Color.red);
g.drawOval(5,5,getWidth()-10,getHeight()-10);
}
/*publicDimensiongetPreferredSize()
{returnnewDimension(100,50);}
publicDimensiongetMinimumSize()
{
returnnewDimension(100,50);
}*/
}
classDrawOvalextendsJFrame{
/**
*
*/
privatestaticfinallongserialVersionUID=-2301011935626641177L;
publicDrawOval()
{
Containercontainer=getContentPane();
container.setLayout(newFlowLayout());
OvalButtonovalButton1=newOvalButton("Ok");
OvalButtonovalButton2=newOvalButton("Cancel");
container.add(ovalButton1);
container.add(ovalButton2);
}
}
流水号
答题时间
分数
内容号一
权重一
内容号二
权重二
040074
0
0
020400
10
0
0
内容号三
权重三
题型
难度
题类
外型
能力
0
0
5
5
0
0
0
区分度
关联题号1
关联题号2
相关码
等效试题号
空行
选项个数
0
0
0
0
0
40
4
签名
拟题人
初审人
复审人
定稿人
倪晓瑞
编写程序将数字显示成三角形图案如图所示:
1
12
123
1234
12345
123456
1234567
12345678
12345678910
1234567891011
importjava.awt.*;
importjavax.swing.*;
publicclassexercise3{
publicstaticvoidmain(String[]args)
{
JFrameframe=newJFrame();
frame.getContentPane().add(newDrawTrangle());
frame.setTitle("exercise11.7");
frame.setSize(300,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
classDrawTrangleextendsJPanel{
/**
*
*/
privatestaticfinallongserialVersionUID=1L;
protectedvoidpaintComponent(Graphicsg)
{
super.paintComponent(g);
g.setColor(Color.red);
g.setFont(newFont("Serif",Font.BOLD,20));
for(inti=1;i<=11;i++)
{
Strings="";
for(intj=1;j<=i;j++)
{
if(j<10)
{
s+=""+j;
}
else
s+=""+j;
}
g.drawString(s,20,20+i*20);
}
}
}
流水号
答题时间
分数
内容号一
权重一
内容号二
权重二
040075
0
0
040400
10
0
0
内容号三
权重三
题型
难度
题类
外型
能力
0
0
5
5
0
0
0
区分度
关联题号1
关联题号2
相关码
等效试题号
空行
选项个数
0
0
0
0
0
4