Guest User

Untitled

a guest
Jul 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. package t007;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6.  
  7. import javax.swing.JButton;
  8. import javax.swing.JFrame;
  9. import javax.swing.JLabel;
  10. import javax.swing.JPanel;
  11. import javax.swing.JTextArea;
  12. import javax.swing.JTextField;
  13.  
  14. public class EJTool extends JFrame implements ActionListener {
  15.  
  16. private static final long serialVersionUID = 1L;
  17.  
  18. /** テキスト */
  19. private JTextField text1 = null;
  20.  
  21. private JTextField text2 = null;
  22.  
  23. /** ラベル */
  24. private JLabel label1 = null;
  25.  
  26. private JLabel label2 = null;
  27.  
  28. private JTextArea textArea1 = null;
  29.  
  30. private JButton button1 = null;
  31.  
  32. private JButton button2 = null;
  33.  
  34. private JButton button3 = null;
  35.  
  36. private JButton button4 = null;
  37.  
  38. /**
  39. * 開始メソッド
  40. *
  41. * @param args パラメータ
  42. */
  43. public static void main(String[] args) {
  44. EJTool frame = new EJTool();
  45.  
  46. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  47. frame.setBounds(10, 10, 600, 300);
  48. frame.setTitle("日本語変換ツール");
  49. frame.setVisible(true);
  50. }
  51.  
  52. /**
  53. * コンストラクタ
  54. */
  55. public EJTool() {
  56. JPanel p = new JPanel();
  57. p.setLayout(null);
  58.  
  59. label1 = new JLabel("日本語変換");
  60. label1.setBounds(1, 10, 70, 30);
  61.  
  62. text1 = new JTextField("");
  63. text1.setBounds(80, 10, 400, 30);
  64.  
  65. button1 = new JButton("参照");
  66. button1.setBounds(500, 10, 80, 30);
  67. button1.addActionListener(this);
  68.  
  69. label2 = new JLabel("定義");
  70. label2.setBounds(1, 50, 70, 30);
  71.  
  72. text2 = new JTextField("");
  73. text2.setBounds(80, 50, 400, 30);
  74.  
  75. button2 = new JButton("参照");
  76. button2.setBounds(500, 50, 80, 30);
  77. button2.addActionListener(this);
  78.  
  79. button3 = new JButton("実行");
  80. button3.setBounds(80, 90, 80, 30);
  81. button3.addActionListener(this);
  82.  
  83. button4 = new JButton("閉じる");
  84. button4.setBounds(400, 90, 80, 30);
  85. button4.addActionListener(this);
  86.  
  87. textArea1 = new JTextArea();
  88. textArea1.setBounds(80, 130, 400, 90);
  89. textArea1.setEditable(false);
  90.  
  91. p.add(label1);
  92. p.add(text1);
  93. p.add(label2);
  94. p.add(text2);
  95. p.add(button1);
  96. p.add(button2);
  97. p.add(button3);
  98. p.add(button4);
  99. p.add(textArea1);
  100.  
  101. getContentPane().add(p, BorderLayout.CENTER);
  102. }
  103.  
  104. /**
  105. * イベント
  106. *
  107. * @param e イベント
  108. */
  109. public void actionPerformed(ActionEvent e) {
  110.  
  111. if(e.getSource() == button4) {
  112.  
  113. System.exit(0);
  114. }
  115.  
  116. }
  117. }
Add Comment
Please, Sign In to add comment