首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列JApplet使用重写paintComponet()方法来绘制图像,请填写正确的代码在横线处。 import java.awt.*; import javax.swing.*; public class Test extends JA
下列JApplet使用重写paintComponet()方法来绘制图像,请填写正确的代码在横线处。 import java.awt.*; import javax.swing.*; public class Test extends JA
admin
2010-07-28
44
问题
下列JApplet使用重写paintComponet()方法来绘制图像,请填写正确的代码在横线处。
import java.awt.*;
import javax.swing.*;
public class Test extends JApplet
{
staic String fileName = "IMG onClick=over(this) title=放大().gif";
public void init()
{
Container cp = getContentPane();
cp.setLayout(new GridLayout(1,1));
Image i = getImage(getCodeBase(),fileName);
MyImagePanel ip=new MyInmagePanel(i);
cp.add(ip);
}
}
class MyImagePanel extends JPanel
{
Image i;
public MyImagePanel(Image IMG onClick=over(this) title=放大)
{
this.i = IMG onClick=over(this) title=放大;
}
public void paintComponent(Graphics gg)
{
【 】;
gg.drawImage(i,20,20,this);
}
}
选项
答案
super.paintComponent(gg)
解析
在Panel子类中重写paintComponent()方法,必须在绘制图像之前调用super.paintComponent()方法来对构件的背景进行绘制。
转载请注明原文地址:https://kaotiyun.com/show/iA9p777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
数据库管理系统中负责数据模式定义的语言是
下列叙述中正确的是
下列叙述中正确的是
一般情况下,当对关系R和S进行自然连接时,要求R和s含有一个或者多个共有的
下面关于Python中函数的说法错误的是()。
软件设计包括软件的结构、数据接口和过程设计,其中软件的过程设计是指______。
已知如下代码: booleanm=true; if(m==false) System.out.println("False"); else System.out.println("True"); 执行结果是()。
sum的值为0,则result=sum==0?1:num/sum的值为【】。
下列程序段:intresult;inta=17,b=6;result=(a%b>4)?a%b:a/bSystem.out.println(result);的结果为()
下面程序段的输出结果为publicclassTest{publicstaticvoidmain(Stringargs[]){booleana,b,c;
随机试题
A.健脾化滞,驱虫消积B.健脾和胃,化积消滞C.健脾益肾D.滋养肝肾,理气活血,通络化瘀
关于突破缺口,下列说法正确的有( )。
Hehadlosthistemperandhishealthinthewarandneverfound_____ofthemagain.
形式教育论认为教学的主要任务是______.
根据课程计划以纲要形式编定的有关课程教学内容的指导性文件是______。教学的基本组织形式是。
1.01,4.02,5.03,8.06,13.09,(),(),32.54
某制衣厂接受一批服装订货任务.按计划天数进行生产,如果每天平均生产20套服装,就比订货任务少生产100套;如果每天牛产23套服装,就可超过订货任务20套。那么,这批服装的订货任务是多少套?()
TheaverageBritishpeoplegetsix-and-a-halfhours’sleepanight,accordingtotheSleepCouncil.Ithasbeenknownforsomet
彼女は 夫と 別れた 事情を 始めた。
ThefirstThanksgivingDaywascelebratedbytheEnglishsettlersin______,Massachusetts.
最新回复
(
0
)