题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-17 02:26:10

[填空题]本题中,主窗口有一个按钮“打开对话框”和一个文本域,单击按钮“打开对话框”后会弹出一个对话框,对话框上有两个按钮“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 Dwind

更多"本题中,主窗口有一个按钮“打开对话框”和一个文本域,单击按钮“打开对话"的相关试题:

[简答题]本题中,主窗口有一个按钮“显示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
[简答题]本题中,主窗口有一个按钮“显示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){    ;
[多项选择]本题中,主窗口有一个按钮、一个文本域和一个复选按钮,初始时窗口的大小是不能调整的,选中复选按钮后,窗口大小就可以进行调整,如果撤销复选按钮的选择,则窗口的大小又不能调整,单击按钮可以关闭程序。
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.addhemListener(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(ActionEvent e)
dispose( );


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


[填空题]本题中,通过菜单“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");
connectltem. 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(
[单项选择]下列程序的功能是调用字体对话框来设置文本框字体,单击按钮弹出对话框后,按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. FindNext
B. FindRecord
C. GoToRecord
D. Requery
[简答题]本题中,主窗口中有两个下拉菜单,一个控制绘制图形的颜色,另一个控制绘制的图形,在画板中单击鼠标,则以单击的位置为左上角、以选定的颜色绘制选定的图形。
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(0);

);
Panel p=new Panel(new GridLayout(1,0));
for(int i=0;i<figureNames.length;i++)
chFigure.addItem(figureNames[i]);
for(int i=0;i<colorNames.length;i++)
chColor.addItem(colorNames[i]);

p.add(chColor);
p.add(chFigure);
add(p,BorderLayout.NORTH);
addMouseListener(this);
setSize(300,300);
show( );

public void update(Graphics g)
g.getColor
[填空题]在窗体上添加一个文本框控件Info,画一个命令按钮,当单击命令按钮显示“保存文件”对话框,设置该对话框可用于保存文本文件(默认)和可执行文件(.exe),然后在文本控件中显示保存的文件名。   Private Sub Command1_Click( )     CommonDialog1.Filter=【 】     CommonDialog1.FilterIndex=【 】     CommonDialog1.ShowSave     Info.Text=【 】   End Sub
[填空题]单击表单中的命令按钮,要求弹出一个“您好!”的消息对话框,应该在命令按钮的 Click事件中编写代码:______(“您好!”)
[简答题](4)编写简单的命令程序,显示对话框,对话框内容为“你好!”,对话框上只有一个“确定”按钮。将该程序保存在“exl.prg”中。
[简答题]本题中定义了一个树型的通信录,窗口左侧是一个树,右侧是一个文本域,单击树的结点,则在右侧文本域中显示相关信息,如果单击的是树结点,则显示对应名字的电话信息。
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
class Mytree2 extends JFrame
JTree tree=null;JTextArea text=new JTextArea(20,20);
Mytree2( )
Container con=getContentPane( );
DefaultMutableTreeNode root=new DefauhMutableTreeNode("同学通信录");
DefaultMutableTreeNode t1=new DefauhMutableTreeNode("大学同学");
DefaultMutableTreeNode t2=new DefaultMutableTreeNode("研究生同学");
DefaultMutableTreeNode t1_1=new DefauhMutableTreeNode("陈艳");
DefaultMutableTreeNode t1_2=new DefauhMutableTreeNode("李小永");
DefaultMutableTreeNode t2_1=new DefauhMutableTreeNode("王小小");
DefaultMutableTreeNode t2_2=new DefauhMutableTreeNode("董小");
setTitle("java2");
root.add(t1);root.add(t2);
t1.add(t1_1);t1.add(t1_2);t2.add(t2_1);t2.add(t2_2);
tree=new ITree(root);
JScrollPane sc
[填空题]在[滤镜]对话框中按住______键,可以将[取消]按钮变成[复位]按钮,单击此按钮,可以将所有参数值恢复到默认值。
[填空题]在用通用对话框的ShowOpen显示“打开”文件对话框时,指定其中的文件类型为文本文件的格式为 【6】
[填空题]启动窗体在“工程属性”对话框中指定,为了打开该对话框,应执行 【7】 菜单中的 【8】 命令。

我来回答:

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

订单号:

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