【初心者】Java質問・相談スレッド61【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0489>>484(その1)
05/02/07 03:26:05import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class KeyTest extends JFrame implements ActionListener, MouseListener, KeyListener
{
Container cp;
JTextField mainField, stateField;
JButton writeButton, clearButton;
boolean mouseIn;
public KeyTest()
{
mouseIn = false;
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(10,10,400,100);
cp = getContentPane();
cp.setLayout(new FlowLayout());
mainField = new JTextField("",10);
mainField.addKeyListener(this);
mainField.addMouseListener(this);
stateField = new JTextField("Out",10);
writeButton = new JButton("書く");
clearButton = new JButton("消す");
writeButton.addActionListener(this);
clearButton.addActionListener(this);
cp.add(mainField);
cp.add(stateField);
cp.add(writeButton);
cp.add(clearButton);
this.setVisible(true);
}
■ このスレッドは過去ログ倉庫に格納されています