题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-07 18:28:57

[简答题]本题中,主窗口有一个按钮“显示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){    ;

更多"本题中,主窗口有一个按钮“显示Dial09”,单击该按钮后显示一个对话"的相关试题:

[简答题]本题中,主窗口有一个按钮“显示Dialog”,单击该按钮后显示一个对话框,对话框的标题是“Dialog”,其上有一个文字标签“欢迎学习Java.”,此时仍允许对原来窗口进行操作,当关闭新生成的对话框时退出程序。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class java2 extends Frame implements ActionListener
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);
dlg=new Dialog(this,"Dialog",______);
dlg.setSize(100,50);
dlg.addWindowListener(new WindowAdapter( )
public void windowClosing(WindowEvent e)
______;

);
dlg.add("Center",new Label("欢迎学习Java."));
setVisible(true);

public
[简答题]本题中,主窗口有一个按钮“打开对话框”和一个文本域,单击按钮“打开对话框”后会弹出一个对话框,对话框上有两个按钮“Yes”和“No”,单击对话框上的“Yes”和“No”按钮后返回主窗口,并在右侧文本域中显示刚才所单击的按钮信息。
import java.awt.event.*;
import java.awt.*;
class MyDialog______implements ActionListener
static final int YES=1,NO=0;
int message=-1;Button yes,no;
MyDialog(Frame f,String s,boolean b)
super(f,s,b);
yes=new Button("Yes");yes.addActionListener(this);
no=new Button("No");no.addActionListener(this);
setLayout(new FlowLayout( ));
add(yes);add(no);
setBounds(60,60,100,100);
addWindowListener(new WindowAdapter( )
public void windowClosing(WindowEvent e)
message=-1;setVisible(false);
);

public void actionPerformed(ActionEvent e)
if(e.getSource( )==yes)
message=YES;
setVisible(false);

else if(e.getSource( )==no)
message=NO;
setVisible(false);


public int getMessage( )
return message;


class Dwindow extends Frame implem
[判断题]对话框不关闭不能进行应用程序主窗口操作的对话框是模式对话框
A. 正确
B. 错误
[简答题]本题是一个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(
[简答题]本题中,通过菜单“Connect”显示一个对话框,单击“ok”按钮后,所填写的内容就会传回到主窗口并显示出来。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class java3 extends JFrame implements ActionListener
public java3( )
setTitle("java3");
setSize(300,300);
addWindowListener(new WindowAdapter( )
public void windowClosing(WindowEvent e)
System.exit(0);

);
JMenuBar mbar=new JMenuBar( );
setJMenuBar(bar);
JMenu fileMenu=new JMenu("File");
mbar.add(fileMenu);
connectItem=new JMenuItem("Connect");
connectItem.addActionListener(this);
fileMenu.add(connectItem);
exitItem=new JMenuItem("Exit");
exitItem.addActionListener(this);
fileMenu.add(exitItem);

public void actionPerformed(ActionEvent evt)
Object source=evt.getSource( );
if(source==connectItem)
ConnectInfo transfer=new ConnectInfo("yourname","pw");
if(dialog==null)
dialog=new ConnectDialog(this);
if(dial
[填空题]本题中,主窗口有一个按钮、一个文本域和一个复选按钮,初始时窗口的大小是不能调整的,选中复选按钮后,窗口大小就可以进行调整,如果撤销复选按钮的选择,则窗口的大小又不能调整,单击按钮可以关闭程序。
import java. awt. * ;
import java. awt. event. * ;
class MyFrame extends Frame______
Checkbox box;
TextArea text;
Button button;
MyFrame(String s)
super(s);
box=new Checkbox ("设置窗口是否可调整大小");
text=new TextArea(12,12);
button=new Button("关闭窗口");
button, addActionListener(this);
box. addItemListener(this);
setBounds(100,100,200,300);
setVisible(true);
add(text, BorderLayout. CENTER);
add(box, BorderLayout. SOUTH);
add(button, BorderLayout. NORTH);
validate( );

public void itemStateChanged(ItemEvent e)
if(box. getState( )=true)
setResizable(true);

else
setResizable(false);


public void actionPerformed(AetionEvent e)
dispose( );


class java2
public static void main(String args[])
new MyFrame("java2");


[填空题]所谓_____,是指当该种类型的对话框打开时,主程序窗口被禁止,只有关闭该对话框,才能处理主窗口。
[简答题](4)编写简单的命令程序,显示对话框,对话框内容为“你好!”,对话框上只有一个“确定”按钮。将该程序保存在“exl.prg”中。
[填空题]执行inputbox函数后,会产生一个对话框,对话框上通常有两个按钮,它们是______按钮和取消按钮。
[简答题]本题中,主窗口中有两个下拉菜单,一个控制绘制图形的颜色,另一个控制绘制的图形,在画板中单击鼠标,则以单击的位置为左上角、以选定的颜色绘制选定的图形。   import java.awt.*;   import java.awt.event.*;   class java3 extends Frame {   String[]figureNames={"圆形","椭圆形","正方形","长方形");   String[]colorNames={"红色","绿色","蓝色","黄色"};   Color[]colorValues={Color.red,Color.green,   Color.blue,Color.yellow);   Choice chFigure=new Choice( );   Choice chColor=new Choice( );   int curX,curY;   java3( ){   super("java3");   addWindowListener(new WindowAdapter( ){   public void windowClosing(WindowEvent e){   System.exit(O);   }   });   Panel P=new Panel(new GridLayout(1,O));   for(int i=0;i  ehFigure.addhem(figureNames[i]);   }   for(int i=0;i  chColor.addhem(eolorNames[i]);   }   P.add(chColor);   P.add(chFigure);   add(p,BorderLayout.NORTH);   addMouseListener(this);   setSize(300,300);   show( );   }   public
[单项选择]下列程序的功能是调用字体对话框来设置文本框字体,单击按钮弹出对话框后,按Cancel 键退出对话框,则( )。   Private Sub Command1_Click( )   CommonDialogl.CancelError=True   CommonDialogl.Flags=cdlCFEffects Or cdlDFBotb   CommonDialogl.Action=4   CommonDialogl.ShowFont   Text1.Font.Name=CommonDialogl.FontName   Text1.Font.Size=CommonDialogl.FontSize   Text1.Font.Bold=CommonDialog1.FontBold   Text1.Font.Italic=CommonDialog1.FontItalic   Text1.Font.Underline=CommonDialog1.FontUnderline   Text1.FontStrikethru=CommonDialog1.FontStrikethru   Text1.ForeColor=CommonDialog1.Color  End Sub
A. Text1的字体不发生变化
B. Text1的字体发生变化
C. Text1的字体和颜色发生变化
D. 程序出错!
[单项选择]在窗体上画一个名称为CommonDialogl的通用对话框,一个名称为Commandl的命令按钮。然后编写如下事件过程: Private Command1_Click( ) CommonDialogl.FileName=" " CommonDialogl.Filter="All file|*.*|(*.Doc)|*.Doc|(*.Txt)|*.Txt" CommonDialoql.Filterlndex=2 CommonDialogl.DialoqTitle="VBTest" CommonDialoql.Action=1 End Sub 对于这个程序,似下叙述中错误的是
A. 该对话框被设置为“打开”对话框
B. 在该对话框中指定的默认文件名为空
C. 该对话框的标题为VBTest
D. 在该对话框中指定的默认文件类型为文本文件(*.Tx

我来回答:

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

订单号:

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