多选题对于drawImage(image,x,y,width,height,this)方法解释正确的是()。Aimage是要绘制的图像Bx,y是表示图像的中心的位置Cwidth是源图像的宽度Dthis是容器

题目
多选题
对于drawImage(image,x,y,width,height,this)方法解释正确的是()。
A

image是要绘制的图像

B

x,y是表示图像的中心的位置

C

width是源图像的宽度

D

this是容器


相似考题
参考答案和解析
正确答案: C,D
解析: 暂无解析
更多“对于drawImage(image,x,y,width,height,this)方法解释正确的是()。     ”相关问题
  • 第1题:

    下面Applet程序的功能是统计在平面坐标系第一象限中,半径大于9,小于10的圆环中坐标值为整数的点有多少?并且给出其坐标值。请改正程序中的错误(有下画线的语句),使程序执行后,能得到预期的结果。

    import java.awt.*;

    import java.applet.*;

    /*

    <applet code=Di9Ti width=200 height=100>

    </applet>

    */

    public class Di9Ti extends Applet

    {

    public void paint(Graphics g)

    {

    int x,y,r1=5,r2=4;

    int count=0;

    for(x=1;x<y;x++)

    {

    for(y=1;y<r1;y)

    {

    if(x*x+y*y<=r2*r2||x*x+y*y>=r1*r1)

    break;

    g.drawStdng("x="+x+"y="+y,20+count*80,20);

    count++;

    }

    }

    g.drawString("count="+count,20,40);

    }

    }

    ex11_3.html:

    <html>

    <head>

    <title>A Simple Program</title>

    </head>

    <body>

    <applet code="Di9Ti.class"width=800 height=400>

    </applet>

    </body>

    </html>


    正确答案:xr1; y++ continue;
    xr1; y++ continue;

  • 第2题:

    下面是一个Applet程序,其功能是绘制三维矩形以使该矩形面凹下,并将图像放入凹下的矩形面中。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。

    注意:不改动程序的结构,不得增行或删行。

    源程序文件代码清单如下:

    import java.awt.*;

    import java.applet.*;

    import java.awt.image.*;

    import java.util.*;

    import java.net.*;

    /*

    <applet code="ex01_3.class"width=800 height=400>

    </applet>

    */

    public class ex01_3 extends Applet

    {

    private Image IMG nClick=over(this) title=放大;

    public void init()

    {

    URL url=getCodeBase();

    IMG nClick=over(this) title=放大=getImage(url,"ex01_3.gif");

    MediaTracker mt=new MediaTracker();

    mt.addImage(IMG nClick=over(this) title=放大,1);

    try

    {

    mt.waitForAll();

    } catch(Exception e)

    {

    e.printStackTrace();

    }

    setBackground(Color.black);

    }

    public void paint(Graphics g)

    {

    int thick=3,x=10,y=10;

    g.drawImage(IMG nClick=over(this) title=放大,x,y);

    g.setColor(Color.lightGray);

    int w = IMG nClick=over(this) title=放大.getWidth(this);

    int h = IMG nClick=over(this) title=放大.getHeight(this);

    for(int i=0;i<thick;i++)

    g.draw3DRect(x,y,w+(a*i),true);

    }

    }

    ex01 3.html

    <HTML>

    <HEAD>

    <TITLE>ex01_3</TITLE>

    </HEAD>

    <BODY>

    <applet code="ex01_3.class"width=800 height=400>

    </applet>

    </BODY>

    </HTML>


    正确答案:new MediaTracker(this) g.drawImage(imgxythis) g.draw3DRect(--x--yw+(2*i)h+(2*i)false)
    new MediaTracker(this) g.drawImage(img,x,y,this) g.draw3DRect(--x,--y,w+(2*i),h+(2*i),false) 解析:本题主要考查Applet图形绘制和图像显示。解题的关键是掌握绘制三维矩形的基本方法,掌握MediaTracker的基本用法,熟悉图形界面的坐标分布以及通过简单的方法来获得坐标。本题中,第1处,MediaTracker类的对象初始化需要将this指针作为参数传递给该类的构造函数;第2处,Graphics类的对象g调用drawImage()方法显示从磁盘文件中读取的Image对象,第4个参数需要将this作为参数传递给该方法;第3处,g调用draw3DRect()方法绘制三维矩形,最后一个参数为false表示矩形是凹下的,相反为凸起,第1个和第2个参数做递减是为了让显示效果看起来是矩形的左上方和图像的左上方有一定的距离,让人感觉矩形将图像包含在内。程序运行结果如下。

  • 第3题:

    在CSS语言中下列哪一项是"列表样式图象"的语法()。

    A.width:

    B.height:

    C.white-space:

    D.list-style-image:


    正确答案:D

  • 第4题:

    要向Applet传递参数,应该在下列drawing.html文件的下画线处填人的选项是( )。 … … <applet code=Drawlmage.class width=1 00 height= 100> </applet> … …

    A.<param image,"flower.gif">

    B.<param image value=flower.gif>

    C.<param name=image value="flower.gif">

    D.<param name="image"value="flower.gif">


    正确答案:D
    D。【解析】param<name="",value="">中name属性值不可重复,value是绝对路径,必须用引号引用起来。

  • 第5题:

    ●试题七

    【说明】

    下面是一个Applet程序,其功能是将完整的图像显示于Applet的区块中,然后可以通过拖动鼠标让图像随着鼠标拖动的轨迹而移动。

    程序运行结果如图5所示。

    图5

    import java.applet.*;

    import java.awt.*;

    /*

    <applet code="ex4_7.class" width=800 height=400 >

    </applet>

    */

    public class ex4_7 extends Applet{

    private Image iImg;

    private int xPos,yPos;

    public void init(){

    xPos = yPos =(1);

    iImg = getImage((2)"ex4_7.jpg");

    }

    public void paint(Graphics g){

    g.drawImage(iImg,xPos,yPos,(3));

    }

    public boolean(4)(Event e,int x,int y){

    xPos = x;

    yPos = y;

    (5);

    return true;

    }

    }

    ex4_7.html

    <HTML>

    <HEAD>

    <TITLE>ex4_7</TITLE>

    </HEAD>

    <BODY>

    <applet code="ex4_7.class" width=800 height=400 >

    </applet>

    </BODY>

    </HTML>


    正确答案:

    ●试题七

    【答案】(102getDocumentBase()

    3this

    4mouseDrag

    5repaint()

    【解析】本题主要考查在Applet窗口中显示图像,并结合鼠标事件处理的综合应用。解题关键是熟悉图像文件的加载过程,会跟踪鼠标拖动的事件,并将鼠标在Applet窗口中的坐标信息作为参数传递给drawImage()方法,用于在新的位置显示图像,从而实现拖动效果。本题中,getImage()方法应该有2个参数,第一个参数是getDocumentBase()方法的返回值,即图像文件的路径;drawImage()方法最后一个参数应该是this,确定是在当前运行的对象中绘制图像;应该调用repaint()方法,进行重画,而不是paint()方法。

  • 第6题:

    关于图片大小的设置,以下说法正确的是()。

    • A、在〈img〉标签中通过设置height和width属性值可设定图片高、宽度
    • B、height=60表示设置图片的高度为60像素
    • C、width=50%表示图片的宽度为显示器全屏宽度的50%
    • D、当只设置了height值而没设置width值时,图像宽度保留

    正确答案:A,B

  • 第7题:

    组件的setSize()方法签名正确的是哪项?()

    • A、 setSize(int width,int height)
    • B、 setSize(int x,int y,int width,int height)
    • C、 setSize(Dimension dim)
    • D、以上皆不是

    正确答案:A,C

  • 第8题:

    图像在网页显示的代码正确的是()

    • A、<img src="Images/exit.gif"width="69"height="24">
    • B、<imges src="exit.gif"width="69"height="24">
    • C、<img url="Images/exit.gif"width="69"height="24">
    • D、<imge src="Images/exit.gif"width="69"height="24">

    正确答案:A

  • 第9题:

    以下关于width属性和height属性语法格式正确的是()。

    • A、width:15;
    • B、width:60px;
    • C、height:100%;
    • D、height:100;

    正确答案:B,C

  • 第10题:

    You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that displays a high-resolution graphic image named Image1.jpg. You need to limit the width of the image to 200 pixels. You also need to preserve the aspect ratio of the image. Which code fragment should you use?()

    • A、 <Image Width="200" Source="Image1.jpg"/>   <Image Width="200" Height="200" Source="Image1.jpg"/>   <ImageWidth="200"><Image.Source>
    • B、 <BitmapImage DecodePixelWidth="200"DecodePixelHeight="200"UriSource="Image1.jpg" />   </Image.Source>
    • C、 </Image><Image Width="200"><Image.Source>
    • D、 <BitmapImage DecodePixelWidth="200" UriSource="Image1.jpg" /></Image.Source> </Image>

    正确答案:D

  • 第11题:

    多选题
    对于drawImage(image,x,y,width,height,this)方法解释正确的是()。
    A

    image是要绘制的图像

    B

    x,y是表示图像的中心的位置

    C

    width是源图像的宽度

    D

    this是容器


    正确答案: C,A
    解析: 暂无解析

  • 第12题:

    单选题
    以下代码片断中,属于绝对定位的是()。
    A

    #box{width:100px;height:50px;}

    B

    #box{width:100px;height:50px; position:absolute;}

    C

    #box{width:100px;height:50px; position:static;}

    D

    #box{width:100px;height:50px; position:relative;}


    正确答案: D
    解析: 暂无解析

  • 第13题:

    以下代码片断中,属于绝对定位的是()。

    A、#box{width:100px;height:50px;position:absolute;}

    B、#box{width:100px;height:50px;position:static;}

    C、#box{width:100px;height:50px;position:relative;}

    D、#box{width:100px;height:50px;}


    参考答案:A

  • 第14题:

    下面是一个Applet程序,程序的功能输出一个彩色窗体。请改正程序中的错误(有下划线的语句),使程序能输出正确结果。

    注意:不改动程序的结构,不得增行或删行。

    程序的输出结果为:

    import java.awt.*;

    import java.awt.image.*;

    import java.applet.Applet;

    public class MemoryImage extends Applet

    {

    Image IMG nClick=over(this) title=放大;

    public void init()

    {

    Dimension d=getSize();

    int w=d.width,h=d.height;

    int pix[ ]=new int[w*h];

    int index=0;

    for(int y=0;y<h;y++)

    for(int x=0;x<w;x++)

    {

    int red=(x|y)&&0xff;

    int green=(x*2|y*2)&0xff;

    int blue=(x*4|y*4)&0xff;

    pix[index++]=(255<<24)|(red<<16)|(green<<8)|blue;

    }

    IMG nClick=over(this) title=放大=createImage(new FilteredImageSource(w,h,pix, 0,w));

    }

    public void paint(Graphics g)

    {

    g.drawImage(IMG nClick=over(this) title=放大, 0,0,super);

    }

    }

    ex36_3.html:

    <html>

    <head>

    <title>A Simple Program</title>

    </head>

    <body>

    <applet code=" MemoryImage.class" width=800 height=400>

    </applet>

    </body>

    </html>


    正确答案:int red=(x|y)&0xff; IMG onClick=over(this) title=放大=createImage(new MemoryImageSource(whpix0w)); g.drawImage(IMG onClick=over(this) title=放大00this);
    int red=(x|y)&0xff; IMG nClick=over(this) title=放大=createImage(new MemoryImageSource(w,h,pix,0,w)); g.drawImage(IMG nClick=over(this) title=放大,0,0,this); 解析:本题主要考查JavaApplet程序的设计。解答本题的关键是掌握MemoryImageSource(int width,int height,int pixel[],int offset,int scanLineWidth)方法的使用;其中width和height指明图像的大小,pixel中包含每个像素点的值,scanLineWidth指明图像中每行的像素数。在本题中,int red=(x|y)&0xff;语句的功能是定义变量red使其值为(x|y)&0xff,IMG nClick=over(this) title=放大=createImage(new MemoryImageSource(w,h,pix,0,w));语句的功能是生成图像,g.drawImage(IMG nClick=over(this) title=放大,0,0,this);语句的功能是在指定的Applet显示区内画出图像。

  • 第15题:

    有关绘图,下面的说法正确的是( )。 Ⅰ:drawArt(int x,int y,int width,int height,ing stanAngle,int arcAngle)是用来指定在矩形的边界内从起始角度到结束角度之间画弧。 Ⅱ:drawLine(int x1,int y1,int x2,int y2)用来绘制从点(x1,y1)到(x2,y2)的线段。当计算出线段上点的坐标不是整数时,向该点的右下方取整。 Ⅲ:drawRet(int x,int y,int width,int height)绘制指定矩形的轮廓。 Ⅳ:drawPloygon(Polygon p)绘制由特定的点指定的多边形。

    A.Ⅱ、Ⅲ

    B.Ⅱ、Ⅲ、Ⅳ

    C.Ⅰ、Ⅱ

    D.Ⅰ、Ⅲ、Ⅳ


    正确答案:D
    解析:Graphics类有一些常用的绘图方法,用来绘制弧、直线、矩形横几何图形。drawLine(intx1,inty1,intx2,inty2)用来绘制从点(x1,y1)到(x2,y2)的线段。当计算出线段上的点的坐标不是整数时,向该点的左下方取整。

  • 第16题:

    下面是一个Apple(程序,其功能是播放动画。要求根据给出的3幅图片设计1个动画。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。

    注意:不改动程序的结构,不得增行或删行。

    程序运行结果如下:

    import java.awt.*;

    import java.applet.*;

    import java.awt.image.*;

    /*

    <applet code="ex24_3.class" width=800 height=400 >

    </applet>

    */

    public class ex24_3 extends Applet implements Runnable {

    Image[] images=new Image[4];

    Image image;

    int IMG nClick=over(this) title=放大Number=3;

    int currentImage=0;

    Thread thisThread;

    public void init(){

    for (int x=0;x<IMG nClick=over(this) title=放大Number;x++){

    images[x]= getImage(getCodeBase(),"IMG nClick=over(this) title=放大"+x+".gif");

    }

    image=images[0];

    }

    public void paint(Graphics g){

    g.drawImage(image[0],0,0,null);

    }

    public void update(Graphics g){

    paint(g);

    }

    public void start(){

    thisThread = new Thread(this);

    thisThread.start();

    }

    public void stop(){

    thisThread.stop();

    thisThread=null;

    }

    public void run(){

    while(true){

    currentImage++;

    currentImage=IMG nClick=over(this) title=放大Number;

    image=images[IMG nClick=over(this) title=放大Number];

    repaint();

    try{

    thisThread.sleep(100);

    }

    catch (Exception e){}

    }

    }

    }

    ex24_3, html

    <HTML>

    <HEAD>

    <TITLE>ex24_3</TITLE>

    </HEAD>

    <BODY>

    <applet code="ex24_3.class" width=800 height=400 >

    </applet>

    </BODY>

    </HTML>


    正确答案:g.drawImage(image00null) currentImage%=IMG onClick=over(this) title=放大Number image=images[currentImage]
    g.drawImage(image,0,0,null) currentImage%=IMG nClick=over(this) title=放大Number image=images[currentImage] 解析:本题主要考查Applet图形绘制和多线程相结合制作动画的综合应用。解题关键是熟悉Applet生命周期,熟悉线程的编程模式,熟悉Graphics类的基本绘图方法和图像处理方法等。本题中,第1处,应该是绘制当前的1幅图片,image对象定义的就是这一幅图像;第2处,将currentImage对imgNumber取模并把结果返回给currentImage,作为当前图像的索引值;第3处,将由currentImage索引的图像数组中的对象的值赋给image对象,用于显示。

  • 第17题:

    getImage()方法与drawImage()方法都是Image对象的方法。()

    此题为判断题(对,错)。


    答案:错

  • 第18题:

    设置表格的宽度为600的HTML代码是()

    • A、<table height=500 width=600> 
    • B、<table vspace=600 hspace=500> 
    • C、<table height=600 width=500> 
    • D、<table vspacet=500 hspace=600>

    正确答案:A

  • 第19题:

    对于drawImage(image,x,y,width,height,this)方法解释正确的是()。     

    • A、image是要绘制的图像
    • B、x,y是表示图像的中心的位置
    • C、width是源图像的宽度
    • D、this是容器

    正确答案:A,D

  • 第20题:

    JAVA中,对于drawImage(image,x,y,width,height,this)方法解释正确的是()。

    • A、image是要绘制的图像
    • B、x,y是表示图像的中心的位置
    • C、width是源图像的宽度
    • D、this是容器

    正确答案:A,D

  • 第21题:

    以下定位,脱离文档流的是()。

    • A、#box{width:100px ;height:50px;}
    • B、#box{width:100px ;height:50px; postion:absolute}
    • C、#box{width:100px ;height:50px; postion:relative}
    • D、#box{width:100px ;height:50px; position:static}

    正确答案:B

  • 第22题:

    多选题
    JAVA中,对于drawImage(image,x,y,width,height,this)方法解释正确的是()。
    A

    image是要绘制的图像

    B

    x,y是表示图像的中心的位置

    C

    width是源图像的宽度

    D

    this是容器


    正确答案: C,D
    解析: 暂无解析

  • 第23题:

    单选题
    You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that displays a high-resolution graphic image named Image1.jpg. You need to limit the width of the image to 200 pixels. You also need to preserve the aspect ratio of the image. Which code fragment should you use?()
    A

     <Image Width=200 Source=Image1.jpg/>   <Image Width=200 Height=200 Source=Image1.jpg/>   <ImageWidth=200><Image.Source>

    B

     <BitmapImage DecodePixelWidth=200DecodePixelHeight=200UriSource=Image1.jpg />   </Image.Source>

    C

     </Image><Image Width=200><Image.Source>

    D

     <BitmapImage DecodePixelWidth=200 UriSource=Image1.jpg /></Image.Source> </Image>


    正确答案: B
    解析: 暂无解析

  • 第24题:

    多选题
    组件的setSize()方法签名正确的是哪项?()
    A

    setSize(int width,int height)

    B

    setSize(int x,int y,int width,int height)

    C

    setSize(Dimension dim)

    D

    以上皆不是


    正确答案: C,B
    解析: 暂无解析