ࡱ > ] _ \ [ bjbj 4 ΐ ΐ 6 6 y y y y y $ f $ % 2 y y y d d d y y d d d d 2ݐ d 0 d W N W d W y d $ d d W 6 ? : @ import java.awt.*;
import javax.swing.*;
/*
*/
public class login extends JApplet
{
public void init()
{
Container c=getContentPane();
c.setLayout(new GridLayout(3,2));
setSize(300,300);
JLabel l1=new JLabel("Username");
JLabel l2=new JLabel("Password");
JTextField t1=new JTextField(10);
JTextField t2=new JTextField(10);
JButton b1=new JButton("login");
JButton b2=new JButton("cancel");
c.add(l1);
c.add(t1);
c.add(l2);
c.add(t2);
c.add(b1);
c.add(b2);
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JRadioButtonDemo extends JFrame implements ActionListener
{
JTextField tf;
public JRadioButtonDemo(String str)
{
super(str);
// Get content pane
Container contentPane = this.getContentPane();
contentPane.setLayout(new FlowLayout());
// Add radio buttons to content pane
JRadioButton b1 = new JRadioButton("Red");
b1.addActionListener(this);
contentPane.add(b1);
JRadioButton b2 = new JRadioButton("Green");
b2.addActionListener(this);
contentPane.add(b2);
JRadioButton b3 = new JRadioButton("Blue");
b3.addActionListener(this);
contentPane.add(b3);
// Define a button group
ButtonGroup bg = new ButtonGroup();
bg.add(b1);
bg.add(b2);
bg.add(b3);
// Create a text field and add it
// to the content pane
tf = new JTextField(5);
contentPane.add(tf);
setSize(400,400);
setVisible(true);
MyWindowAdapter adapter = new MyWindowAdapter(this);
// register it to receive those events
addWindowListener(adapter);
}
public void actionPerformed(ActionEvent ae)
{
tf.setText(ae.getActionCommand());
}
public static void main(String args[])
{
JRadioButtonDemo jbd = new JRadioButtonDemo("Changing Color");
}
}
class MyWindowAdapter extends WindowAdapter {
JRadioButtonDemo jrd1;
public MyWindowAdapter(JRadioButtonDemo jrd) {
this.jrd1 = jrd;
}
public void windowClosing(WindowEvent we) {
jrd1.setVisible(false);
System.exit(0);
}
}
jv h Uh $j h\s h9
UmH nH tH @u hV h9
) * U _ b c 5 W y d gd9
"
;
Q
R
S
$ M d gd d gd9
M r , X t
#
;
P
b
t
# d gd # % H J K r t 5 J N | d gd 2 1h:pV . A!"#$% v D d
j
F A ? P i c t u r e 1 b Sd8H5 D g n Sd8H5PNG
IHDR c sRGB pHYs + IDATx^s\}ۿ@?dŤ$}H;0TzIĀR,K4 <"Vi Bm~H;XZHne={weپj=
{뜻=EP(8@ (O Yi +@l0@ B!8@` HH|uu5DN7r^TCCCg