Terminal Bean �͏]���^�̃G�~�����[�^�[ GUI ����A�u�O���[���E�X�N���[���v�G�~�����[�^�[�ƌĂ��ꍇ������܂��B Terminal Bean �́AHost Access Beans �ɂ��R���p�C���Ǝ��s��K�v�Ƃ��܂��B �C���|�[�g����p�b�P�[�W�ɂ��ďڂ����́A�wHost Access Beans �A�v���b�g�̍쐬�x���Q�Ƃ��Ă��������B
���̃T���v���E�v���O�����Ŏg�p����Ă���e�X�e�[�g�����g�܂��̓X�e�[�g�����g�̃O���[�v���ȉ��ɐ������܂��B
import com.ibm.eNetwork.beans.HOD.*; // Get the Host Access Beans import com.ibm.eNetwork.ECL.ECLSession; // Get the ECLSession constants import com.ibm.eNetwork.HOD.common.*; // Get the Environment class import java.applet.*; // Applet �N���X�̎擾 import java.awt.*; // Get Frame and Color classes import java.util.*; // Get the Properties class
public class TermTest extends Applet {
Terminal myTerm;
KeyPad myPad;
public void init() {
super.init();
setLayout(new BorderLayout());
Environment env = new Environment(this);
try {
Properties p = new Properties();
// Add some Terminal bean properties
�z�X�g����L���� Telnet �T�[�o�[�ɐݒ肵�āA�z�X�g�ڑ����J�n���邱�Ƃ��ł��܂��B ���̃X�e�[�g�����g�ŁA"myHost" �����g�p�� Telnet �T�[�o�[�̖��O�Œu�������܂��B
p.put(Session.HOST, "myHost");
p.put(Session.SESSION_TYPE, ECLSession.SESSION_TYPE_3270_STR);
p.put(Session.CODE_PAGE, ECLSession.SESSION_CODE_PAGE_DEFAULT);
p.put(Screen.SCREEN_3D, "false");
// Add some KeyPad bean properties
p.put(KeyPad.SHAPE, KeyPad.S2X11);
myTerm = new Terminal(p); // Build a Terminal bean
myPad = new KeyPad(p); // Build a KeyPad bean
myPad.addSendKeyListener(myTerm);
myTerm.addPropertyChangeListener(myPad);
add("Center", myTerm);
add("South", myPad);
System.out.println("Starting communications to myhost...");
myTerm.startCommunication();
validate();
} catch (Exception e) {
e.printStackTrace();
}
}
}
�v���O�����S�� (�ҏW�҃R�����g�͏���) �͈ȉ��̂悤�ɂȂ�܂��B
import com.ibm.eNetwork.beans.HOD.*; // Get the Host Access Beans
import com.ibm.eNetwork.ECL.ECLSession; // Get the ECLSession constants
import com.ibm.eNetwork.HOD.common.*; // Get the Environment class
import java.applet.*; // Get Applet class
import java.awt.*; // Get the Color and Frame classes
import java.util.*; // Get Properties
public class TermTest extends Applet {
Terminal myTerm;
KeyPad myPad;
public void init() {
super.init(); // �X�[�p�[�N���X�� init �̌Ăяo��
setLayout(new BorderLayout());
// Set up HOD Environment with applet instance
Environment env = new Environment(this);
// These constructors also accept a properties object that
// contains all the configuration data for each bean.
// Customization can also be done at runtime through each
// bean's customizer class.
try {
Properties p = new Properties();
// Instead of "myHost" you would put the name of your telnet server
p.put(Session.HOST, "myHost");
p.put(Session.SESSION_TYPE, ECLSession.SESSION_TYPE_3270_STR);
p.put(Session.CODE_PAGE, ECLSession.SESSION_CODE_PAGE_DEFAULT);
p.put(Screen.SCREEN_3D, "false");
// Add some KeyPad bean properties
p.put(KeyPad.SHAPE, KeyPad.S2X11);
myTerm = new Terminal(p); // Build a Terminal bean
myPad = new KeyPad(p); // Build a KeyPad bean
// Add the Terminal bean as a SendKeyEvent listener on the KeyPad bean.
// This means that any SendKeyEvents generated by the KeyPad bean will
// be sent to the Terminal bean's SendKey method for processing. A
// SendKeyEvent is generated by the keypad whenever the user clicks on
// a KeyPad button.
myPad.addSendKeyListener(myTerm);
// Add KeyPad as PropertyChangeListener on Terminal. This notifies the
// KeyPad bean of changes to Terminal properties. KeyPad will change
// the buttons displayed based on the Terminal session type and codepage.
myTerm.addPropertyChangeListener(myPad);
add("Center", myTerm);
add("South", myPad);
System.out.println("Starting communications to myhost...");
myTerm.startCommunication();
validate();
} catch (Exception e) {
e.printStackTrace();
}
} // init ���\�b�h�̏I��
} // TermTest �N���X�̏I��
�ŏI�I�ɁA�쐬�����A�v���b�g�����s���邽�߂̒P���� HTML �t�@�C���͈ȉ��̂悤�ɂȂ�܂��B
<HTML> <HEAD> <TITLE>First Host Access Beans Applet</TITLE> </HEAD> <BODY> <APPLET CODE="TermTest.class" WIDTH=600 HEIGHT=700> </APPLET> </BODY> </HTML>
TermTest �����s����ɂ́ATermTest.java �Ƃ������O�̃t�@�C���ɃT���v���E�v���O������ۑ����āA���̃t�@�C�����R���p�C�����܂��B CLASSPATH ���ϐ����������ݒ肳��Ă��邱�Ƃ��m�F���Ă������� (�wHost Access Beans �A�v���b�g�̍쐬�x���Q��)�B TermTest �A�v���b�g�͎��̃R�}���h�Ŏ��s�ł��܂��B
appletviewer TermTest.html