Created
May 13, 2012 15:02
-
-
Save brokendish/2688840 to your computer and use it in GitHub Desktop.
AddNodeDisplay
This file contains hidden or 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 brokendish; | |
import java.awt.BorderLayout; | |
import java.awt.Container; | |
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.JOptionPane; | |
import javax.swing.JPanel; | |
import javax.swing.JTextField; | |
public class AddNodeDisplay extends JFrame implements ActionListener{ | |
JButton button1, button2; | |
JTextField text1, text2; | |
JLabel label; | |
public void addDisp(){ | |
setTitle("aaaaaaaaa"); | |
setBounds(100, 100, 300, 250); | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
JPanel p = new JPanel(); | |
text1 = new JTextField("データ1", 20); | |
text2 = new JTextField("データ2", 20); | |
JButton button = new JButton("取得"); | |
button.addActionListener(this); | |
label = new JLabel(); | |
p.add(text1); | |
p.add(text2); | |
p.add(button); | |
Container contentPane = getContentPane(); | |
contentPane.add(p, BorderLayout.CENTER); | |
contentPane.add(label, BorderLayout.SOUTH); | |
setVisible(true); | |
} | |
public void actionPerformed(ActionEvent e){ | |
System.out.println("text1= " + text1.getText()); | |
System.out.println("text2= " + text2.getText()); | |
label.setText(text1.getText() + text2.getText()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment