KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/mandarintools/pyconv/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/mandarintools/pyconv/pyConvertGUI.java
import java.lang.*;
import java.awt.*;
import java.awt.event.*;

class pyConvertGUI extends Panel {
    TextArea sourcetext, targettext;
    Choice sourcetype, targettype;
    Button convert, clear;
    pyConvert pyconverter;

    public pyConvertGUI() {
	sourcetext = new TextArea(12, 80);
	targettext = new TextArea(12, 80);
	sourcetype = new Choice();
	targettype = new Choice();
	convert = new Button("Convert!");
	clear = new Button("Clear Text");

	sourcetype.add("Hanyu Pinyin");
	sourcetype.add("Wade Giles");
	sourcetype.add("Yale");
	sourcetype.add("GuoinII");
	sourcetype.add("BoPoMoFo");
	sourcetype.add("Gwoyeu Romatzyh");
	sourcetype.add("French");

	targettype.add("Hanyu Pinyin");
	targettype.add("Wade Giles");
	targettype.add("Yale");
	targettype.add("GuoinII");
	targettype.add("BoPoMoFo");
	targettype.add("Gwoyeu Romatzyh");
	targettype.add("French");


	ActionListener convertlistener = new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
		int srcchoice = sourcetype.getSelectedIndex();
		int trgtchoice = targettype.getSelectedIndex();
		targettext.setText(pyconverter.pyConvertLine(srcchoice, trgtchoice, sourcetext.getText()));
		
	    }
	};
	convert.addActionListener(convertlistener);

	ActionListener clearlistener = new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
		targettext.setText("");
		sourcetext.setText("");
	    }
	};
	clear.addActionListener(clearlistener);

	this.setLayout(new BorderLayout(4, 10));

	Panel srcpanel = new Panel();
	srcpanel.setLayout(new BorderLayout());
	srcpanel.add(sourcetext, BorderLayout.NORTH);
	srcpanel.add(sourcetype, BorderLayout.EAST);
	srcpanel.add(new Label("Source Romanization:  "), BorderLayout.WEST);

	Panel targetpanel = new Panel();
	targetpanel.setLayout(new BorderLayout());
	targetpanel.add(targettext, BorderLayout.NORTH);
	targetpanel.add(targettype, BorderLayout.EAST);
	targetpanel.add(new Label("Target Romanization:  "), BorderLayout.WEST);

	Panel buttonpanel = new Panel();
	buttonpanel.setLayout(new BorderLayout());
	buttonpanel.add(clear, BorderLayout.WEST);
	buttonpanel.add(convert, BorderLayout.EAST);

	this.add(srcpanel, BorderLayout.NORTH);
	this.add(targetpanel, BorderLayout.CENTER);
	this.add(buttonpanel, BorderLayout.SOUTH);

	pyconverter = new pyConvert();
    }


    public static void main(String argc[]) {
	Frame pyFrame = new Frame();
	pyConvertGUI pyGUI = new pyConvertGUI();


	pyFrame.addWindowListener(new WindowAdapter() {
	    public void windowClosing(WindowEvent e) { System.exit(0); }
	});
	pyFrame.add(pyGUI, "North");
	pyFrame.pack();
	pyFrame.show();
	
    }


};

Anon7 - 2021