更多"下列JApplet使用重写paintCompon6t( )方法来绘制图"的相关试题:
[填空题]下列JApplet使用重写paintCompon6t( )方法来绘制图像,请填写正确的代码在横线处。
import java.awt.*;
import javax.swing.*;
public class Test extends JApplet
staic String fileName = "img( ).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)
this.i = img;
public void paintComponent(Graphics gg)
【15】 ;
gg.drawImage(i,20,20,this);
[填空题]下列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)
{
【15】 ;
gg.drawImage(i,20,20,this);
}
}
[简答题]下列程序打包到example包,main方法调用线程类输出0~9这10个数,请填写横线处的内容。
注意:请勿改动main( )主方法和其他已有语句内容,仅在横线处填入适当语句。
______
interface MyInterface
public abstract void print(int n);
class Mythread extends Thread ______ MyInterface
public void run( )
for(int i = 0; i < 10; i++)
this.print(i);
public void print(int n)
System.out.print(n +" ");
public class Example1_6
public static void main(String argv[])
Mythread th = new Mythread( );
______
[填空题]下列Applet在坐标(20,20)处显示一幅GIF图像,请填写正确的程序在横线处。
import java.awt.*;
import java.applet.*;
import java.net.URL;
public class Test13 extends Applet
{
Image i;
public void init( )
{
URL url=getDocumentBase( );
String name="IMG onClick=over(this) title=放大0.gif";
【15】 ;
}
public void paint(Graphics g)
{
g.drawImage( i,20,20, this);
}
}
[填空题]下列Applet当鼠标进入窗口时,在状态栏显示“鼠标已进入”的提示信息。请填写正确的程序在横线处。
import java.awt.*;
import java.awt.event.*;
public class Test 10 extends Applet
public void init( )
addMouseListener( new MouseAdapter( )
public void mouseEntered(MouseEvent me)
【15】 ;
repaint( );
);
[单项选择]说明:在每题的语句中有一划横线处,题后有ABCD四个答案,其中只有一个可以放入横线处使语句表达通顺。
这次期末考试,他______都在90分以上。
A. 一门门
B. 门门
C. 一门一门
D. 一门