When you open a file or run a program in a computer, a window appears on the desktop of your computer. The () of the window indicates which program you are currently working in arid its color will become blue if a window is active. When you click on The () , the window disappears and appears as a button on the taskbar. Clicking on a button in () will invoke a specific command.
When you click on The () , the window disappears and appears as a button on the taskbar.
A:maximize button B:restore button C:close button D:minimize button
在Swing中,JButton的直接父类是 ( )
A:java.awt.Button B:java.awt.Container C:javax.swing.Button D:javax.swing.Abstract Button
下面ButtonFrame类创建了一个容器,包含有3个按键。
import javax.swing.*;
public class ButtonFrame extends JFrame
{
JButton Button1= new JButton("Button1");
JButton Button2= new JButton("Button2");
JButton Button3= new JButton("Button3");
public ButtonFrame( )
{
super("ButtonFrame");
setSize (100,150);
setDefaultCloseOperation(JFrame. EXIT ON CLOSE);
JPanel pane = new JPanel( );
pane.add(Buttonl);
pane. add(Button2);
pane. add (Button3);
【12】 ;
}
public static void main(String args[])
{
ButtonFrame bf= new ButtonFrame( );
bf. show(};
}
}
请在程序代码中的画线处添上正确的语句,使程序完整。
setContentPane(pane)
阅读下面代码:
import java.awt.*;
public class Exam11_1
{
private Frame f;
private Button b1,b2,b3,b4;
public static void main(String args[]
{
Exam11_1 that = new Exam11 1 ( );
that.go( );
}
public void go( )
{
______;
f.setLayout(new FlowLayout( )) ;;
b1 = new Button ("Button 1");
b2 = new Button ("Button 2");
b3 = new Button ("Button 3");
b4 = new Button ("Button 4");
f.add (b1);
f.add (b2);
f.add (b3);
f.add (b4);
f.pack ( );
f.setVisible (true);
}
}
请在程序中画线处填写正确的语句 【13】 ,以便编译运行程序后得到正确的结果。
f=new Frame("GUI example")
下列程序使用FlowLayout布局管理器管理3个Button构件在Frame中的位置。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
import java.awt.*;
public class ex2
{
private Frame frm;
private Button btn1;
private Button btn2;
private Button btn3;
public static void main(String[] args)
{
ex2 t=new ex2( );
t.method( );
}
public void method( )
{
frm=new Frame("ex2")
______
Btn1=new Button("Button1");
btn2=new Button("Button2");
btn3=new Button("Button3");
frm.add(btn1);
frm.add(btn2);
______
frm.pack( );
frm.setVisible(true);
}
}
以下叙述中正确的是( )。
A:Private Sub Form_Mouse Down(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
If Button=2 Then PopupMenu Bs,2
End Sub B:Private Sub Form_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs
End Sub C:Private Sub FOrm_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs,0
End Sub D:Private Sub Form_MouseDown(Button As Integer,Shin As Integer,-
X As Single,Y As Single)
If(Button=vbLeftButton)Or(Button=vbRightButton)Then PopupMenu Bs
End Sub
以下叙述中正确的是( )。
A:Private Sub Form_Mouse Down(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
If Button=2 Then PopupMenu Bs,2
End Sub B:Private Sub Form_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs
End Sub C:Private Sub FOrm_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs,0
End Sub D:Private Sub Form_MouseDown(Button As Integer,Shin As Integer,-
X As Single,Y As Single)
If(Button=vbLeftButton)Or(Button=vbRightButton)Then PopupMenu Bs
End Sub
以下叙述中正确的是( )。
A:Private Sub Form_Mouse Down(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
If Button=2 Then PopupMenu Bs,2
End Sub B:Private Sub Form_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs
End Sub C:Private Sub FOrm_MouseDown(Button As Integer,Shift As Integer,-
X As Single,Y As Single)
PopupMenu Bs,0
End Sub D:Private Sub Form_MouseDown(Button As Integer,Shin As Integer,-
X As Single,Y As Single)
If(Button=vbLeftButton)Or(Button=vbRightButton)Then PopupMenu Bs
End Sub