package com.snail.gui;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.text.Document;
public class JTextField extends javax.swing.JTextField implements FocusListener{
public JTextField() {
this.addFocusListener(this);
}
public JTextField(String text) {
super(text);
this.addFocusListener(this);
}
public JTextField(int columns) {
super(columns);
this.addFocusListener(this);
}
public JTextField(String text, int columns) {
super(text, columns);
this.addFocusListener(this);
}
public JTextField(Document doc, String text, int columns) {
super(doc, text, columns);
this.addFocusListener(this);
}
public void focusGained(FocusEvent e) {
this.selectAll();
}
public void focusLost(FocusEvent e) {
}
}
:g/javax.swing.JTextField /s//com.fuj(伏せ字).JTextField /g
・・・ import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.border.TitledBorder; public class TextBoxExam extends JFrame { private static final long serialVersionUID = 1L; private JPanel jPanel = null; private JTextField jTextField1 = null; private JTextField jTextField2 = null; private JLabel jLabel = null; ・・・
・・・ import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; //import javax.swing.JTextField; // ここだけ換える import com.snail.gui.JTextField; // ここだけ換える import javax.swing.SwingUtilities; import javax.swing.border.TitledBorder; public class TextBoxExam extends JFrame { private static final long serialVersionUID = 1L; private JPanel jPanel = null; private JTextField jTextField1 = null; // ここは換えなくて良い private JTextField jTextField2 = null; // ここは換えなくて良い private JLabel jLabel = null; ・・・