Created
July 21, 2018 13:00
-
-
Save privatejk2002/a355623bca9ef55d66f7ea9db512a5de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package t007; | |
import java.awt.BorderLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JPanel; | |
import javax.swing.JTextArea; | |
import javax.swing.JTextField; | |
public class EJTool extends JFrame implements ActionListener { | |
private static final long serialVersionUID = 1L; | |
/** テキスト */ | |
private JTextField text1 = null; | |
private JTextField text2 = null; | |
/** ラベル */ | |
private JLabel label1 = null; | |
private JLabel label2 = null; | |
private JTextArea textArea1 = null; | |
private JButton button1 = null; | |
private JButton button2 = null; | |
private JButton button3 = null; | |
private JButton button4 = null; | |
/** | |
* 開始メソッド | |
* | |
* @param args パラメータ | |
*/ | |
public static void main(String[] args) { | |
EJTool frame = new EJTool(); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setBounds(10, 10, 600, 300); | |
frame.setTitle("日本語変換ツール"); | |
frame.setVisible(true); | |
} | |
/** | |
* コンストラクタ | |
*/ | |
public EJTool() { | |
JPanel p = new JPanel(); | |
p.setLayout(null); | |
label1 = new JLabel("日本語変換"); | |
label1.setBounds(1, 10, 70, 30); | |
text1 = new JTextField(""); | |
text1.setBounds(80, 10, 400, 30); | |
button1 = new JButton("参照"); | |
button1.setBounds(500, 10, 80, 30); | |
button1.addActionListener(this); | |
label2 = new JLabel("定義"); | |
label2.setBounds(1, 50, 70, 30); | |
text2 = new JTextField(""); | |
text2.setBounds(80, 50, 400, 30); | |
button2 = new JButton("参照"); | |
button2.setBounds(500, 50, 80, 30); | |
button2.addActionListener(this); | |
button3 = new JButton("実行"); | |
button3.setBounds(80, 90, 80, 30); | |
button3.addActionListener(this); | |
button4 = new JButton("閉じる"); | |
button4.setBounds(400, 90, 80, 30); | |
button4.addActionListener(this); | |
textArea1 = new JTextArea(); | |
textArea1.setBounds(80, 130, 400, 90); | |
textArea1.setEditable(false); | |
p.add(label1); | |
p.add(text1); | |
p.add(label2); | |
p.add(text2); | |
p.add(button1); | |
p.add(button2); | |
p.add(button3); | |
p.add(button4); | |
p.add(textArea1); | |
getContentPane().add(p, BorderLayout.CENTER); | |
} | |
/** | |
* イベント | |
* | |
* @param e イベント | |
*/ | |
public void actionPerformed(ActionEvent e) { | |
if(e.getSource() == button4) { | |
System.exit(0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment