首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列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
26
问题
下列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://jikaoti.com/ti/jtH0FFFM
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
有两个关系R和S如下:由关系R通过运算得到关系S,则所使用的运算为
数据独立性是数据库技术的重要特点之一,所谓数据独立性是指
数据库管理系统中负责数据模式定义的语言是
下列描述中错误的是
对长度为n的线性表排序,在最坏情况下,比较次数不是n(n一1)/2的排序方法是
在面向对象方法中,实现信息隐蔽是依靠
在数据库系统中,用户所见的数据模式为
代码编写阶段可进行的软件测试是
下列关于列表的说法正确的是()。
下面程序段:booleana=false;booleanb=true;booleanc=(a&&b)&&(!b);booleanresult=(a&b)&(!b);执行完后,正确的结果是
随机试题
老年男性,反复咳嗽、咳痰4~5年,近两个月来病情加重,痰量多,青霉素氨基糖苷类抗生素治疗效果欠佳。查体:背部双下肺野可闻湿啰音,血WBC7.6×109/L,N76%。该患者诊断应为
甲服装公司与乙银行订立合同,约定甲公司向乙银行借款300万元,用于购买进口面料。同时,双方订立抵押合同,约定甲公司以其现有的以及将有的生产设备、原材料、产品为前述借款设立抵押。借款合同和抵押合同订立后,乙银行向甲公司发放了贷款,但未办理抵押登记。之后,根据
关于盗窃罪,下列哪些选项是正确的?()
网络计划的目标由()所决定。
权证持有人向发行人购买或出售标的证券的价格即( )。
甲公司2011年建造办公楼领用外购原材料20000元,原材料购入时支付的增值税为3400元;因自然灾害毁损原材料一批,其实际成本10000元,经确认损失材料的增值税1700元。则A公司计入“应交税费——应交增值税(进项税额转出)”科目的金额为(
力求本学期考得好,力求得到本学期的奖学金,属于()。
布拉格之春
设f(x)=则方程f(x)=0的根的个数为()。
[*]
最新回复
(
0
)