Graphics g=new Craphics(); g.drawRect(10,0,30,40);
Graphics g=new Craphics(); g.drawRect(0,10,30, 40);
Graphics g=new Craphics(); g.drawRect(30,40,10, 0);
Graphics g=new Craphics(); g.drawRect(30,40,0,10);
第1题:
阅读以下应用说明、图和Java代码,根据要求回答问题1至问题5。
【说明】
Stack类是java. ntil包中专门用来实现栈的工具类。以下Java程序是一个不使用库函数而实现字符串反转的程序。例如,输入:123456,则输出:654321:输入:asdfeg,则输出:gefdsa。
【Java程序】
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class UseStack extends Applet implements ActionListener
{ Stack MyStack;
Label prompt=new Label("输入要反转字符:");
Button pushBtn=new Button("压栈");
Button popBtn=new Button("弹栈"); //反转
TextField input=new TextField(5);
int[] DrawStack =new int[10]; //记录堆栈中数据
int[] PoppedOut=new int[20]; //记录被弹出的数据
int StackCnt=0; //记录模拟堆栈的数组中的数据个数
String msg=" ";
public void init()
{ MyStack=new Stack();
add(prompt);
add(input);
add(pushBtn);
add(popBtn);
pushBtn.addActionListener(this);
(1)
}
public void paint(Graphics g)
{ for (int i=10; i<StackCnt; i++) //模拟显示堆栈内部的数据排列情况
{ g.drawRect(50,200-i*20,80,20);
g.drawString(Integer.toString(DrawStack[i]),80,215-i*20);
}
for (int i=0;(2) ) //显示被弹出的数据
g.drawString(Integer.toString(PoppedOut[i]),200+i*20,100);
g.drawString("堆栈",70,236);
g.drawString("栈底",135,225);
g.drawString("栈顶",160,225-StackCnt*20);
g.drawString(msg,200,140);
}
public void actionPerformed( (3) )
{ if (e.getAct ionCommand () == "压栈") //压栈操作
{ if(StackCnt<10)
{ MyStack.push(new Integer( (4) ));
DrawStack[StackCnt++]=Integer.parseInt(input.getText() );
input.setText (" ");
}
else
msg="输入数据过多,请先弹栈!"
}
else if (e.getActionCommand () == "弹栈") //弹栈操作
{ if( (5) )
{ StackCnt--;
PoppedOut[PopCnt++]=[(Integer)(MyStack.pop())).intValue();
}
else
msg="堆栈已空,不能再弹栈!";
}
repaint();
}
}

第2题:
下列Applet使用drawLine()方法绘制矩形,左上角坐标为(20,40),长为60,宽为 40。请选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex32 extends Applet { public void paint(Graphics g) { g.setColor(Color.blue); g.drawLine(20, 40, 80, 40); ______ g.drawLine(20, 80, 80, 80); g.drawLine(20, 80, 20, 40); } }
A.g.drawLme(80, 40, 80, 80);
B.drawLine(40, 40, 80, 80);
C.g.drawLine(80, 20, 80, 80);
D.drawLine(80, 40, 80, 80);
第3题:
关于下面程序段的说法,正确的是 import java.applet.*; import java.awt.*; public class Test extends Applet{ Image IMG nClick=over(this) title=放大; public void init(){ IMG nClick=over(this) title=放大=new Image(); } public void paint(Graphics g){ g.drawImage(IMG nClick=over(this) title=放大,0,0,this); } }
A.该程序段可以正常运行
B.程序中所创建的Image为空,但可以显示
C.程序中所创建的Image不为空
D.程序中所创建的Image为空,不能显示
第4题:
下列Applet实现了使用灰度值递减的顺序显示0~9,选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; import java.awt.Color; public class ex24 extends Applet { public void paint(Graphics g) { int r = 0, g1 = 0, b = 0, j = 10; for(int i - 0; i < 10; i ++) { g.setColor(new Color(r, g1, b)); r += 25; g1 +=25; b +=25; j += 10; } } }
A.g.drawString(i, j, 30);
B.g.drawString("" + i, j, 30);
C.drawString(i,j, 30);
D.drawstring("" + i,j, 30);
第5题:
在JAVA语言中,下列语句()可以画出一矩形框架,其距上边界为10,宽为30像素,高为40象素
第6题:
在g.drawRect(15,18,300,20)的语句中,()代表矩形的宽度和高度。
第7题:
You are the administrator of Company’s network. Your Windows 2000 Professional computer has a removable disk device installed. The device can use storage modules of varying sizes. You use these storage modules to transfer graphics files between your location and a printing company. The printing company uses Windows 98. You insert a new 1 GB disk device into your computer and format the new disk device as NTFS with the default options. You then place large graphics files on the disk device and deliver it to the printing company. The printing company reports that they are unable to access the files. You want the printing company to be able to access the graphics files on the new disk device. What should you do? ()
第8题:
You are the administrator of ExamSheet.net's network. Your Windows 2000 Professional computer has a removable disk device installed. The device can use storage modules of varying sizes. You use these storage modules to transfer graphics files between your location and a printing company. The printing company uses Windows 98. You insert a new 100 MB disk device into your computer and format the new disk device as NTFS with the default options. You then place large graphics files on the disk device and deliver it to the printing company. The printing company reports that they are unable to access the files. You want the printing company to be able to access the graphics files on the new disk device. What should you do?()
第9题:
Graphics g=new Craphics(); g.drawRect(10,0,30,40);
Graphics g=new Craphics(); g.drawRect(0,10,30, 40);
Graphics g=new Craphics(); g.drawRect(30,40,10, 0);
Graphics g=new Craphics(); g.drawRect(30,40,0,10);
第10题:
Java.awt.Font
Java.awt.Graphics.Font
Java.Graphics.Font
Java.Font
第11题:
demonstrating
concerning
preventing
allowing
第12题:
Format the new disk device as NTFS with a 4 KB cluster size.
Format the new disk device as FAT32 with a 4 KB cluster size.
Format the new disk device as FAT32 with a 1 KB cluster size.
Format the new disk device as FAT16 with a 4 KB cluster size.
第13题:
本题中,鼠标在窗口中单击一下,就在单击的位置生成一个小矩形,如果在小矩形上双击鼠标左键,则删除小矩形。 import java.awt.*; import java.awt.event.*; import javax swing.*; class MousePanel extends JPanel extends MouseMo- tionListener {public MousePanel {addMouseListener(new MouseAdapter {public void mousePressed(MouseEvent evt) {int X=evt.getX; int Y=evt.getY; current=find(x,y); if(current<0) add(x,y); } public void mouseClicked(MouseEvent evt) {int X=evt.getX; int Y=evt.getY; if(evt.getClickCount>=2) {remove(current); } } }); addMouseMotionListener(this); } public void paintComponent(Graphics g) {super.paintComponent; for(int i=0;i<nsquares;i++) draw(g,i); } public int find(int X,int y) (for(int i=0;i<nsquares;i++) if(squares[i].x-SQUARELENGTH/2<= x X<=squares[i].x+SQuARELENGTH/2 squares[i].Y-SQUARELENGTH/2< =Y y<=squares[i].Y+SQUARELENGTH /2) return i ; return-1 ; } public void draw(Graphics g,int i) {g.drawRect(squares[i].X-SQUARE- LENGTH/2。 squares[i].Y-SQUARELENGTH/2, SQUARELENGTH, SQUARELENGTH); } public void add(int X,int Y) {if(nsquares<MAXNSQUARES) {squares[nsquares]=new Point(x,y); current=nsquares ; nsquares++; repaint; } } public void remove(int n) {if(n<0 ‖ n>=nsquares)return; Nsquares- -; squares[n]=squares[nsquares]; if(current= =n)current= -l; repaint; } public void mouseMoved(MouseEvent evt) {} public void mouseDragged(MouseEvent evt) {} private static final int SQUARELENGTH=10: private static final int MAXNSQUARES=100; private Point[]squares=new Point[MAX- NSQUARES]; private int nsquares=0; private int current=-l; } class MouseFrame. extends JFramc {public MouseFrame {setTitle("java3"); setSize(300,200); addWindowListener(new WindowAdapter {public void windowClosing(WindowEvent e) {System.exit(0); } }); Container contentPane=getContentPane; contentPane.add(MousePanel); } } public class java3 {public static void main(String[]args) {JFrame. frame=new MouseFrame; frame.show; } }
第14题:
请将下面的Applet程序补充完整。
import java. awt. *;
import java. applet. *;
public class Hi【 】{
public void paint(Graphics g){
g. drawString("Hi!", 25, 25);
}
}
第15题:
下面是一个Applet程序,程序的功能是用鼠标画图。本题是通过单击鼠标后画出一个Java字。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。
注意;不改动程序的结构,不得增行或减行。
源程序文件代码清单如下;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code=SimpleHitMouse.java width=800 height=400>
</applet>
*/
public class SimpleHitMouse implements Applet
{
private java.util.Vector points=new java.util.Vector();
public void init()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
points.add(new Point(e.getX(),e.getY())
paint();
}
}
public void update(Graphics g)
repaint(g);
}
public void paint(Graphics g)
{
for(int i=0;i<points.size();i++)
{
Point dot=(Point)points.elementAt(i);
g.drawString("x",dot.x,dot.y);
}
}
public static void main(String args[ ])
{
Frame. fram=new Frame("CelayTree");
SimpleHitMouse dot=new SimpleHitMouse();
dot.init ();
dot.start ();
fram.add ( "Center", dot );
fram.setSize( 400,300 );
fram.addWindowListener( new WindowAdapter(){
public void windowClosing( WindowEvent e )
{
System.exit(0);
}
});
fram.show ();
}
}
ex12_3.html:
<html>
<head>
<title>A Simple Program</title>
</head>
<body>
<applet code=" SimpleHitMouse.class" width=800 height=400>
</applet>
</body>
</html>
第16题:
本题的功能是求两个交叉图形的并、减、交和异或。窗口中有4个单选按钮和一个图形面板,面板中有两个交叉的图形,选中其中一个单选按钮,图形面板中以黑色填充的方式显示运算结果。
import java.awt.*;
import java.awt.event*+;
import java.awt.geom.*;
import java.util.*;
import javax.swing.*;
public class java3
{
public static void main(String[]args)
{
JFrame. frame=new AreaTestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_
ON_CLOSE);
frame.show();
}
}
class AreaTestFrame. extends JFrame
{
public AreaTestFrame()
{
setTitle("java3");
setSize(WIDTH,HEIGHT);
areal
=new Area(new Ellipse2D.Double(100,100,
150,100));
area2
=new Area(new Rectangle2D.Double(150,150,
150,100));
Container confentPane=getContentpane();
panel=new
JPanel()
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
g2.draw(areal);
g2.draw(area2);
if(area!=null)g2.fill(area);
}
};
contentPane. add(panel,BorderLayout. CEN-
TER);
JPanel buttonPanel=new JPanel();
ButtonGroup group=new ButtonGroup();
JRadioButton addButton=new JRadioButton("
并",false);
buttonPanel.add(addButton);
group.add(addButton);
addButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
area=new Area();
area.add(areal);
area.add(area2);
panel.repaint();
}
});
JRadioButton subtractButton
=new JRadioButton("减",false);
buttonPanel.add(subtractButton);
group.add(subtractButton);
subtractButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
area=new Area();
area.add(areal);
area.subTract(area2);
panel.repaint();
}
});
JRadioButton intersectButton
=new JRadioButton("交",false);
buttonPanel.add(intersectButton);
group.add(intersectButton);
intersectButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
area=new Area():
area.add(areal);
area.intersect(area2);
panel.repaint();
}
});
JRadioButton exclusiveCIrButton
=new JRadioButton(“异或”,false);
buttonPanel.add(exelusiveOrButton);
group.add(exclusiveOrButton);
exclusiveOrButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
area=new Area();
area.add(areal);
area.exclusiveor(area2);
panel.repaint();
}
});
contentPane.add(buttonPanel,BorderLayout.
NORTH);
}
private JPanel panel;
private Area area;
private Area areal;
private Area area2;
private static final int WIDTH=400;
private static final int HEIGHT=400;
}
第17题:
import java.awt.*; import java.applet.*; pulic class DrawRect extends Applet { Public void paint(Graphics g) { g.setColor(Color.red); g.drawRoundRect(150,50,50,50,20,40); g.setColor(Color.green); g.fillRoundRect(150,140,50,50,20,20); } } 根据代码,输出结果正确的有()。
第18题:
A technician has just installed an upgraded graphics card. The computers power turns off before itfinishes booting. Which of the following is the cause of the problem? ()
第19题:
You have a computer that runs Windows XP Professional. You replace the video graphics adapter in the computer and restart the computer. You discover that the hardware acceleration features of the video graphics card fail to function. You verify that the new video graphics adapter is certified for Windows XP Professional. You need to ensure that the hardware acceleration features of the video card function. What should you do?()
第20题:
Java.awt.Font
Java.awt.Graphics.Font
Java.Graphics.Font
Java.Font
第21题:
The monitor cannot display the increased resolution that is a feature of the new graphics card.
The power supply does not provide enough wattage to power the new graphics card.
The new graphics card is incompatible with the existing processor.
The computer does not have enough RAM to support the new graphics card.
第22题:
Format the new disk device as FAT16 with a 128 KB cluster size.
Format the new disk device as FAT32 with a 4 KB cluster size.
Format the new disk device as NTFS with a 4 KB cluster size.
Format the new disk device as NTFS with a 8 KB cluster size.
第23题:
15,18
18,300
300,20
20,15
第24题:
At the command prompt, run sigverif.exe.
Install the most up-to-date driver for the video graphics adapter.
Restart the computer in Safe Mode. Copy a new version of the vga.dll file to the computer.
Restart the computer in VGA Mode. Copy a new version of the vga.dll file to the computer.