package com.vci.client.auth2.component;
|
|
import java.awt.GridBagConstraints;
|
import java.awt.GridBagLayout;
|
import java.awt.Insets;
|
|
import javax.swing.JButton;
|
import javax.swing.JComponent;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JTextField;
|
|
public class RefTextField extends JComponent {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = -7889775417017928634L;
|
private JLabel lable = new JLabel();
|
private JTextField text = new JTextField(15);
|
private JButton refButton;
|
private JPanel parent;
|
|
public RefTextField(int x) {
|
this.text.setColumns(x);
|
if (parent != null)
|
doFillIntoGrid(parent);
|
}
|
|
public RefTextField() {
|
if (parent != null)
|
doFillIntoGrid(parent);
|
}
|
|
private void doFillIntoGrid(JPanel parent) {
|
parent.setLayout(new GridBagLayout());
|
GridBagConstraints g_mpnl = new GridBagConstraints();
|
g_mpnl.insets = new Insets(5, 5, 5, 5);
|
g_mpnl.anchor = GridBagConstraints.EAST;
|
g_mpnl.gridx = 0;
|
g_mpnl.gridy = 0;
|
parent.add(lable, g_mpnl);
|
g_mpnl.gridx = 1;
|
parent.add(text, g_mpnl);
|
g_mpnl.gridx = 2;
|
if (refButton != null) {
|
parent.add(refButton, g_mpnl);
|
}
|
}
|
|
public void setLable(String lable) {
|
this.lable.setText(lable);
|
}
|
|
public JButton getRefButton() {
|
return refButton;
|
}
|
|
public void setRefButton(JButton refButton) {
|
this.refButton = refButton;
|
}
|
|
public JPanel getParent() {
|
return parent;
|
}
|
|
public void setParent(JPanel parent) {
|
this.parent = parent;
|
}
|
|
public void updateUI() {
|
if (parent != null)
|
doFillIntoGrid(parent);
|
}
|
|
public JLabel getLable() {
|
return lable;
|
}
|
|
public void setLable(JLabel lable) {
|
this.lable = lable;
|
}
|
|
public JTextField getText() {
|
return text;
|
}
|
|
public void setText(String text) {
|
this.text.setText(text);
|
}
|
|
}
|