
se.wfh.libs.common.gui.AbstractWTextField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gui Show documentation
Show all versions of gui Show documentation
Some helper classes i needed for several projects (GUI / Swing parts)
package se.wfh.libs.common.gui;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JTextField;
public abstract class AbstractWTextField extends
AbstractWValidatingComponent implements FocusListener {
private static final long serialVersionUID = 1L;
public AbstractWTextField() {
this(null, 20);
}
public AbstractWTextField(final E defval) {
this(defval, 20);
}
public AbstractWTextField(final E defval, final int columns) {
super(defval, new JTextField(defval == null ? "" : defval.toString(),
columns));
getComponent().addFocusListener(this);
}
@Override
public void focusGained(final FocusEvent event) {
// not needed
event.getID(); // for PMD
}
@Override
public void focusLost(final FocusEvent event) {
valueChanged(getValue());
}
public boolean isEditable() {
return getComponent().isEditable();
}
public void setEditable(final boolean editable) {
getComponent().setEditable(editable);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy