题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-07 03:42:48

[简答题]本题的功能是通过鼠标确定两个点,然后画两点间的直线。窗口中有一个按钮“Draw line”,单击该按钮后,它就处于按下状态,然后用鼠标在窗口中单击一下,在单击的地方就会出现一个坐标圆点,用鼠标在另外一个地方单击一下又会出现另外一个圆点,并且此时在两个坐标圆点间画出一条直线,且“Draw line”处于可用状态,再单击这个按钮就可以画另外一条直线。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class EventQueuePanel extends JPanel implements ActionListener
EventQueuePanel( )
JButton button=new JButton("Draw line");
add(button);
button.addActionListener(this);

public void actionPerformed(AclionEvent evt)
Graphics g=getGraphics( );
______p=getClick( );
g.drawOval(p.x-2,p.y-2,4,4);
Point q=getClick( );
g.drawOval(q.x-2,q.y-2,4,4);
g.drawLine(p.x,p.y,q.x,q.y);
g.dispose( );

public Point getClick( )
EventQueue eq=Toolkit.getDefaultToolkit( ).getSystemEventQueue( );
while(true)
try
AWTEvent evt=eq.getNextEvent( );
if(evt.getID( )==MouseEvent.MOUSE PRESSED)
MouseEvent mevt=(MouseEvent)evt;
Point p=______( );
Poi

更多"本题的功能是通过鼠标确定两个点,然后画两点间的直线。窗口中有一个按钮“"的相关试题:

[填空题]本题的功能是通过鼠标确定两个点,然后画两点间的直线。窗口中有一个按钮“Draw line”,单击该按钮后,它就处于按下状态,然后用鼠标在窗口中单击一下,在单击的地方就会出现一个坐标圆点,用鼠标在另外一个地方单击一下又会出现另外一个圆点,并且此时在两个坐标圆点间画出一条直线,且“Draw line”处于可用状态,再单击这个按钮就可以画另外一条直线。
import java. awt. * ;
import java. awt. event. * ;
import javax. swing. * ;
class EventQueuePanel extends JPanel implements ActionListener
EventQueuePanel( )
JButton button=new JButton("Draw line");
add(button);
button. addActionListener(this);

public void actionPerformed(ActionEvent evt)
( Graphics g=getGraphics( );
______p= getClick( );
g. drawOval(p. x-2, p. y-2, 4, 4);
Point q=getClick( );
g. drawOval(q. x-2, q. y-2, 4, 4);
g. drawLine(p, x, p. y, q. x, q. y);
g. dispose( )

public Point getClick( )
EventQueue eq=Toolkit. getDefaultToolkit( ). getSystemEventQueue( );
while (true)
try
AWTEvent evt=eq. getNextEvent( );
if (evt. getlD( )==MouseEvent. MOUSEPRESSED)
MouseEvent mevt=(MouseEve
[简答题]本题程序是一个Applet应用程序,功能是更改显示的图片。页面中有一个按钮“改变图形”,单击该按钮,面板中显示的图片改变;继续单击,图片继续改变。请将下述程序补充完整(注意:不得改动程序的结构,不得增行或删行)。
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class advance extends Applet implements ActionListener

int n = 0;
Image im1,im2,showim;
Button bn = new Button("改变图形");
public void init( )

add (bn);
______;
im1 = getImage(getCodeBase( ),"advance_1.jpg");
im2 = getImage(getCodeBase( ),"advance_2.jpg");
bn.addActionListener ( this );
showim = im2;

public void actionPerformed(ActionEvent e)

______;
if (e.getActionCommand ( )== "改变" )

if(n%2 == 0)

showim = im1;
n++;

else

showim = im2;
n++;

______;


public void paint (Graphics g)

g.drawImage (showim,0,0,this);

[简答题]本题是一个Applet,页面上有一个按钮“请单击”,单击该按钮后弹出一个对话框,对话框上有三个按钮“橙色”、“蓝色”和“红色”,单击其中任意一个按钮,则可以将对话框的背景色设置为按钮名称所对应的颜色。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class java2 extends JApplet

private JFrame frame;
______( )

frame=new JFrame( );
frame.setTitle("java2");
frame.setSize(300,200);
frame.getContentPane( ).add(new ButtonPanel( ));
JButton PopButton=new JButton("请单击");
getContentPane( ).add(PopButton);
PopButton.addActionListener(new ActionListener( )

public void actionPerformed(ActionEvent evt)

if(frame.isVisible( ))frame.setVisible(false);
else______;

);


class ButtonPanel extends JPanel

private class ColorAction implements ActionListener

private Color backgroundColor;
public void actionPerformed(ActionEvent actionevent)

setBackground(backgrOundColor);
repaint( );

public ColorAction(
[简答题]本题中,主窗口有一个按钮“显示Dial09”,单击该按钮后显示一个对话框,对话框的标题是“Dial09”,其上有一个文字标签“欢迎学习Java.”,此时仍允许对原来窗口进行操作,当关闭新生成的对话框时退出程序。   import java.awt.*;   import java.awt.event.*;   import javax.swing.*;   public class java2 extends Frame implements ActionLis-   tener{   public static void main(String args[]){   java2 f=new java2("java2");   Panel pan=new Panel( );   f.init( );   }   public java2(String str){   super(str);   }   public void init( ){   addWindowListener(new WindowAdapter( ){   public void windowClosing(WindowEvent e){   System.exit(0);   }   });   setSize(200,200);   setLayout(new FlowLayout( ));   but=new Button("显示Dialog");   add(but);   but.addActionListener(this);   dig=new Dialog(this,"Dialog", );   dig.setSize(100,50);   dig.addWindowListener(new WindowAdapter( ){   public void windowClosing(WindowEvent e){    ;
[判断题]丈量两点间的距离必须在两点间的直线上进行。( )
[单项选择] I am not sure that I can draw an exact line between wit and humor (perhaps the distinction is so subtle that only those persons can decide who have long white beards), but even an ignorant person may express an opinion in this matter. I am quite positive that humor is the more comfortable and livable quality, for humorous persons, if their gift is genuine and not a mere shine upon the surface, are always agreeable companions. They have pleasant mouths turned up at the corners, to which the great Master of Marionettes has fixed the strings and he holds them in his nimblest fingers to twitch them at the slightest jest. But the mouth of a merely witty man is hard and sour. Nor is the flash from a witty man always comforting, but a humorous man radiates a general pleasure. I admire wit, but I have no real liking for it; it has been too often employed against me, whereas humor is always an ally. It never points an impertinent finger into my defects. A wit’’s tongue, however, i
A. of no particular importance
B. solely a matter of opinion
C. subtle
D. exact and important
[判断题]根据两点的Y坐标,可以判别两点间的前后位置。
[填空题]Rather than (draw)()a line between science and art, industrial designers of today combine both areas in their work.
[判断题]已知坐标方位角为60°,两点间距离为100.000m,则两点间纵坐标增量是86.600m,横坐标增量是50.000m。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码