本题中,通过菜单“Connect”显示-个对话框,单击“0k”按钮后,所填写的内容就会传回到主窗口并显示出来。password.setText(transfer.password); k=false; show( ); if(ok){ transfer.username=username.getText( ); transfer.password=new String(password.get Password( )); ) return ok; } private JTextField username; private JPasswordField password; private boolean ok; private JButton okButton; private J Button cancelButton; )

本题中,通过菜单“Connect”显示-个对话框,单击“0k”按钮后,所填写的内容就会传回到主窗口并显示出来。password.setText(transfer.password); k=false; show( ); if(ok){ transfer.username=username.getText( ); transfer.password=new String(password.get Password( )); ) return ok; } private JTextField username; private JPasswordField password; private boolean ok; private JButton okButton; private J Button cancelButton; )


相关考题:

在Excel中,下列的打印方法正确的是()。 A.单击“文件”菜单中的“页面设置”命令,出现“页面设置”对话框,在“页面”选项卡中单击“打印”按钮,最后单击“确定”按钮B.单击“文件”菜单中的“打印”命令,出现“打印”对话框,在该对话框中进行所需的相应设置后,单击“确定”按钮即可开始打印C.在“打印预览”窗口单击“打印”按钮,最后单击“确定”按钮D.单击“常用”工具栏中的“打印”按钮

显示和隐藏命令窗口的操作是()。 A、单击"常用"工具栏上的"命令窗口"按钮B、打开通过"窗口"菜单下的"命令窗口"选项,关闭通过单击命令窗口上的关闭按钮。C、直接按CTRL+F2显示命令窗口,CTRL+F4隐藏命令窗口D、以上方法都可以

若要在图3-19窗口(窗体名为frm001)中新增一个命令按钮,单击该命令按钮后,图像框所显示的图像就会成为此窗口的背景图像。请写出该命令按钮单击事件过程内的程序代码。

在Visual FoxPro的命令窗口中键入CREATE DATA命令以后,屏幕会出现一个创建对话框,要想完成同样的工作,还可以采取如下步骤:A)单击“文件”菜单中的“新建”按钮,然后在新建对话框中选定“数据库”单选钮,再单击“新建文件”命令按钮B)单击“文件”菜单中的“新建”按钮,然后在新建对话框中选定“数据库”单选钮,再单击“向导”命令按钮C)单击“文件”菜单中的“新建”按钮,然后在新建对话框中选定“表”单选钮,再单击“新建文件”命令按钮D)单击“文件”菜单中的“新建”按钮,然后在新建对话框中选定“表”单选钮,再单击“向导”命令按钮

在Visual FoxPro的命令窗口中键入OPEN DATA命令以后,屏幕会出现一个创建对话框,要想完成同样的工作,还可以采取如下步骤( )。A.单击“文件”菜单中的【打开】按钮,在“打开”对话框中,从“文件类型”列表框中选择“数据库”,并在显示窗口中选择要打开的数据库名,单击【确定】B.单击“编辑”菜单中的【打开】按钮,在“打开”对话框中,从“文件类型”列表框中选择“数据库”,并在显示窗口中选择要打开的数据库名,单击【确定】C.单击“文件”菜单中的【打开】按钮,在“打开”对话框中,从“文件类型”列表框中选择“项目”,并在显示窗口中选择要打开的数据库名,单击【确定】D.单击“文件”菜单中的【打开】按钮,在“打开”对话框中,从“文件类型”列表框中选择“表”,并在显示窗口中选择要打开的数据库名,单击【确定】

本题中,通过菜单“Connect”显示一个对话框,单击“ok”按钮后,所填写的内容就会传回到主窗口并显示出来。import java.awt.*import java.awt.event.*;import javax.swin9.*;public class java3 extends JFrame. implements ActionL-istener{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);connectltem=new JMenuhem("Connect");connecthem.addActionListener(this);fileMenu.add(connecthem);exithem=new JMenuhem("Exit");exithem.addActionListener(this);fileMenu.add(exithem);}public void actionPerformed(ActionEvent evt){Object source=evt.getSource();if(source= =connecthem){Connectlnfo transfer=new ConnectInfo ("your-name","pw");if(dialog= =null)dialog=new ConnectDialog(this);if(dialog.showDialog(transfer)){String uname=transfer.username;String pwd=transfer.password;Container contentPane=getContentPane();contentPane.add(new JLabel("username="+uname+",password="+pwd),"South");validate();}}else if(source= =exitltem)System.exit(0);}public static void main(String[]args){JFrame. f=new java3();f.show();}private ConnectDialog dialog=null;private JMenuhem connecthem;private JMenuhem exithem;}class Connectlnfo{public String username;public String password;public Connectlnfo(String U,String p){username=u;password=P;}}class ConnectDialog extends JDialog implements Ac-tionListener{public ConnectDialog(){super(parent,"Connect",true);Container contentPane=getContentPane();JPanel pl=new JPanel();pl.setLayout(new GridLayout(2,2));pl.add(newJLabel("User name:"));pl.add(username=new JTextField(""));pl.add(new JLabel("Password:"));pl.add(password=new JPasswordField(""));contentPane.add("Center",pl);Panel p2=new Panel();okButton=addButton(p2,"ok");cancelButton=addButton(p2。"Cancel");contentPane.add("South",p2);setSize(240,120);}JButton addButton(Container C,String name){JButton button=new JButton(name);button.addActionListener(this);C.add(button);return button;}public void actionPerformed(ActionEvent evt){object source=evt.getSource();if(source= =okButton){ok=true:setVisible(false);}else if(source= =cancelButton)setVisible(false);}public void showDialog(Connectlnfo transfer){username.setText(transfer.username);password.setText(transfer.password);ok=false;show();if(ok){transfer.username=username.getText();transfer.password=new String(password.get-Password());}return ok;}private JTextField usernameprivate JPasswordField password;private boolean ok;private JButton okButton;private JButton cancelButton;}

本题中,主窗口有一个按钮“打开对话框”和一个文本域,单击按钮“打开对话框”后会弹出一个对话框,对话框上有两个按钮“Yes"和“N0”,单击对话框上的“Yes”和“N0”按 钮后返回主窗口,并在右侧文本域中显示刚才所单击的按钮信息。import java.awt.event.*;import java.awt.*;class MyDialog implements ActionListener{static final int YES=1,N0=0;int message=-1;Button yes,no;MyDialog(Frame. f.String S,boolean b){super(f,S,b);ves=new Button("Yes");yes.addActionListener(this);no=new Button("No"); no.addActionListener(this)osetLayout(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. implements ActionLis-tener{TextArea text;Button button;MyDialog dialog;Dwindow(String s){super(s);text=new TextArea(5,22);button=new Button("打开对话框");button.addActionListener(this);setLayout(new FlowLayout());add(button);add(text);dialog=new MyDialog(this,"Dialog",true);setBounds(60,60,300,300);setVisible(true);validate();addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});}public void actionPerformed(ActionEvent e){if(e.getSource()= =button){if(dialog.getMessage()= =MyDialog.YES){text.append("\n你单击了对话框的yes按钮");}else if(dialog.getMessage()= =MyDialog.NO){text.append("\n你单击了对话框的N0按钮");}}}}public class java2{public static void main(String args[]){new Dwindow("java2");}}

在Visual FoxPro的命令窗口中键入CREATE DATA命令以后,屏幕会出现一个创建对话框,要想完成同样的工作,还可以采用如下步骤_______。A.选择“文件”菜单中的“新建”命令,然后在新建对话框中单击“数据库”单选按钮,再单击“新建文件”命令按钮B.选择“文件”菜单中的“新建”命令,然后在新建对话框中单击“数据库”单选按钮,再单击“向导”命令按钮C.选择“文件”菜单中的“新建”命令,然后在新建对话框中单击“表”单选按钮,再单击“新建文件”命令按钮D.选择“文件”菜单中的“新建”命令,然后在新建对话框中单击“表”单选按钮,再单击“向导”命令按钮

如果要显示公式,可选择()菜单中的选项命令,显示对话框后,单击"视图"标签,选择"窗口选项"框中的公式,按下"确定"按钮即可。 A.插入B.工具C.格式D.数据