单选题在JPanel中绘图应覆盖哪个方法()Apaint(Graphicsg)BpaintComponent(Graphicsg)Cprint(Graphicsg)Drepaint(Rectangler)
单选题
在JPanel中绘图应覆盖哪个方法()
A
paint(Graphicsg)
B
paintComponent(Graphicsg)
C
print(Graphicsg)
D
repaint(Rectangler)
参考解析
解析:
暂无解析
相关考题:
在JAVA语言中,下列语句()可以画出一矩形框架,其距上边界为10,宽为30像素,高为40象素 A.Graphicsg=newCraphics();g.drawRect(10,0,30,40);B.Graphicsg=newCraphics();g.drawRect(0,10,30,40);C.Graphicsg=newCraphics();g.drawRect(30,40,10,0);D.Graphicsg=newCraphics();g.drawRect(30,40,0,10);
Importjava.applet.Applet;Importjava.awt*;PublicclassImageDemoextendsApplet{Imageimg;Publicvoidinit(){Img=getImage(getCodeBase(),”11.gif”);//1}Publicvoidpaint(Graphicsg){Intw=img.getHeight(this);Inth=img.getHeight(this);g.drawImage(img,120,60,w/2,h/2,this);//2g.drawImage(img,150,0,w*2,h*2,this);//3}}以上代码第()行将图像放大。A.1B.2C.3D.代码并没有将图像放大
importjava.awt.*;importjava.applet.*;pulicclassDrawRectextendsApplet{Publicvoidpaint(Graphicsg){g.setColor(Color.red);g.drawRoundRect(150,50,50,50,20,40);g.setColor(Color.green);g.fillRoundRect(150,140,50,50,20,20);}}根据代码,输出结果正确的有()。A.两个圆角矩形的绘制弧高都为20B.两个圆角矩形的绘制弧宽相同C.两个圆角矩形是左对齐的D.两个圆角矩形是上对齐的
用于设置组件大小的方法是( )。A.paint( )B.setSize( )C.getSize( )SXB 用于设置组件大小的方法是( )。A.paint( )B.setSize( )C.getSize( )D.repaint( )
下列方法与Applet显示无关的是( )。A.paint( )B.update( )C.draw( )SXB 下列方法与Applet显示无关的是( )。A.paint( )B.update( )C.draw( )D.repaint( )
在下列Java Applet程序的下划线处填入代码,使程序三整并能够正确运行。importjava.applet.*;importjava.awt.*;publicclassHelloWofil______{publicvoidpaint(Graphicsg){g.drawstring("HelloWorld!",25,25);}}
一个部件重绘时,方法调用按下面哪个次序? A.直接调用 paint()B.调用update ,而update会调用 paint()C.调用repaint(),由它调用update(), update 再调用 paint()D. 调用 repaint(),它将直接调用 paint
( 35 )如果应用程序要在 Applet 上显示输出,则必须重写的方法是A ) Graphics.drawString()B ) repaint()C ) paint()D ) update()
在JAVA中,为了使paint()方法执行,以下各项中,()是最佳的调用方法。 A、paint()B、repaint()C、paint(Graphics)D、update(Graphics)
在JPanel中绘图应覆盖哪个方法()A、paint(Graphicsg)B、paintComponent(Graphicsg)C、print(Graphicsg)D、repaint(Rectangler)