[�ۑ�1]

���������A�v���P�[�V�����̍l�@�B
[�\�[�X]
import java.awt.*;
import java.awt.event.*;

public class GUIaa extends Frame {
    Button    b0 = new Button("judge!");
    Label     x0 = new Label("Type a number and press...");
    TextField t0 = new TextField();

    public GUIaa() {
        setLayout(null);
        add(t0); t0.setBounds(10, 40, 90, 30);
        add(b0); b0.setBounds(110, 40, 100, 30);
        add(x0); x0.setBounds(10, 80, 180, 30);
        b0.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    int i = (new Integer(t0.getText())).intValue();
                    t0.setText("");
                    int hanteihensuu=0;
                    for (int count=2; count < i;++count){
                        if(i%count == 0)
                            hanteihensuu = 1;
                    }
                    if(hanteihensuu == 0) {
                        x0.setText(i + " is Prime");
                    } else {
                        x0.setText(i + " is not Prime");
                    }
                }
            });
    }
    public static void main(String[] args) {
        Frame win = new GUIaa();
        win.setSize(200, 150); win.setVisible(true);
        win.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent evt) {
                    System.exit(0);
                }
            });
    }
}
[�l�@]
C����ƈႢjava�ł͉��z�}�V���ŃX�y�V�t�B�P�[�V�����𓝈ꂵ�Ă��� ���B
���̂��߁A�񋟂���O���t�B�b�N���C�u�������e�ՂɁi�����Łj��ɓ���Ƃ� �낪java�̗ǂ��Ƃ���ł��傤�B
���s�̓��؂�
���߁�CPU��OS�����z�}�V�������s
�Ƃ����v���Z�X�ł��B
�v���O�����̓����\�����AGUI�ɂ���Ɗi�i�ɕ��G�ɂȂ�ƌ����킯�ł��Ȃ��A �������ƊO�ςɕ����ăv���O��������Ηǂ��B

[��ȋ@�\]
button
�w�肵���͈͓��Ń}�E�X���N���b�N����ƁA"�{�^����������"�܂��B

TextField
��������͂���t�B�[���h���‚���A�͈͂Ȃǂ��w��ł��܂��B
(String "���͂��ꂽ����",int "�T�C�Y��")

ActionEvent
����̃A�N�V����������Ɛ��������B

[�ۑ�2]

��O����
"catch(Exception ex) {example}"�Ə������ŁA��O��p�̏���������B
����́A�����ɂ�swich���Ɠ����ł��邪�A���߂����O��z�肵�����̂ł� �邽�߁A�g�����肪�ǂ��B
"System.exit(0);"�ȂǂŁA�����I�����邩�A�ē��͂�v�����邱�Ƃ��]�܂� ���B