下面列出了javax.swing.JTextField#setMargin ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Initialize text field to size box.
*
* @param tooltipText tooltip text
* @param focusListener
* @param documentListener
* @return
*/
private JTextField createSizeText(String tooltipText, FocusListener focusListener, DocumentListener documentListener) {
JTextField textField = new JTextField("", 5);
Insets insets = new Insets(2, 2, 2, 4);
textField.setToolTipText(tooltipText);
textField.setHorizontalAlignment(JTextField.RIGHT);
textField.setMargin(insets);
textField.addFocusListener(focusListener);
textField.getDocument().addDocumentListener(documentListener);
return textField;
}
public ViewElementFilename(RobotOverlord ro,StringEntity e) {
super(ro);
this.e=e;
//this.setBorder(BorderFactory.createLineBorder(Color.RED));
field = new JTextField(15);
field.setEditable(false);
field.setText(e.get());
field.setMargin(new Insets(1,0,1,0));
//pathAndFileName.setBorder(BorderFactory.createLoweredBevelBorder());
JLabel label=new JLabel(e.getName(),JLabel.LEADING);
label.setLabelFor(field);
JButton choose = new JButton("...");
choose.addActionListener(this);
choose.setMargin(new Insets(0, 5, 0, 5));
choose.addFocusListener(this);
panel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx=0;
gbc.gridy=0;
gbc.fill = GridBagConstraints.HORIZONTAL;
//gbc.gridheight = GridBagConstraints.REMAINDER;
gbc.insets.right=5;
panel.add(label,gbc);
gbc.weightx=1;
gbc.insets.left=0;
gbc.insets.right=0;
panel.add(field,gbc);
gbc.weightx=0;
panel.add(choose,gbc);
}
public ManualDownloadBuilder() {
ActionLocalizer al = Messages.getLocalizer();
packId = new JTextField(25);
packId.setMargin(new Insets(2, 2, 2, 2));
versionCode = new JSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE,
1));
versionCode.setEditor(new JSpinner.NumberEditor(versionCode, "#"));
offerType = new JSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
paid = new JRadioButton(al.localize("paid_app"));
free = new JRadioButton(al.localize("free_app"));
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
jtf = (JTextField) c;
JTextField editor = jtf;
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
Font f = editor.getFont();
if ((f == null) || (f instanceof UIResource)) {
editor.setFont(uidefaults.getFont(prefix + ".font"));
}
Color bg = editor.getBackground();
if ((bg == null) || (bg instanceof UIResource)) {
editor.setBackground(uidefaults.getColor(prefix + ".background"));
}
Color fg = editor.getForeground();
if ((fg == null) || (fg instanceof UIResource)) {
editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
}
Color color = editor.getCaretColor();
if ((color == null) || (color instanceof UIResource)) {
editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
}
Color s = editor.getSelectionColor();
if ((s == null) || (s instanceof UIResource)) {
editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
}
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
}
Color dfg = editor.getDisabledTextColor();
if ((dfg == null) || (dfg instanceof UIResource)) {
editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
}
Border b = editor.getBorder();
if ((b == null) || (b instanceof UIResource)) {
editor.setBorder(uidefaults.getBorder(prefix + ".border"));
}
Insets margin = editor.getMargin();
if (margin == null || margin instanceof UIResource) {
editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
}
}
@Override
protected JPanel assemble() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
gsfId = new JTextField(20);
gsfId.setMargin(new Insets(2, 2, 2, 2));
userAgent = new JTextField(20);
userAgent.setMargin(new Insets(2, 2, 2, 2));
HyperTextPane about = new HyperTextPane(
Messages.getString("ExistingLogic.about")).withWidth(500)
.withTransparency();
gsfId.addActionListener(this);
userAgent.addActionListener(this);
gsfId.addCaretListener(this);
userAgent.addCaretListener(this);
GridBagConstraints gbc = new GridBagConstraints();
JPanel container = new JPanel();
container.setLayout(new GridBagLayout());
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets.left = 5;
gbc.insets.bottom = 3;
container.add(new JLabel(Messages.getString("ExistingLogic.gsfid")), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
container.add(gsfId, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
container.add(new JLabel(Messages.getString("ExistingLogic.useragent")),
gbc);
gbc.gridx = 1;
gbc.gridy = 1;
container.add(userAgent, gbc);
panel.add(about);
panel.add(Box.createVerticalStrut(20));
panel.add(container);
panel.add(Box.createVerticalStrut(20));
return panel;
}
@Override
protected JPanel assemble() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
username = new JTextField(20);
username.setMargin(new Insets(2, 2, 2, 2));
password = new JPasswordField(20);
password.setMargin(new Insets(2, 2, 2, 2));
server = new JTextField(20);
server.setMargin(new Insets(2, 2, 2, 2));
port = new JSpinner(new SpinnerNumberModel(3218, 1, 65535, 1));
port.setEditor(new JSpinner.NumberEditor(port, "#"));
HyperTextPane about = new HyperTextPane(
Messages.getString("ProxyLogic.about")).withWidth(500)
.withTransparency();
username.addActionListener(this);
password.addActionListener(this);
username.addCaretListener(this);
password.addCaretListener(this);
server.addCaretListener(this);
GridBagConstraints gbc = new GridBagConstraints();
JPanel container = new JPanel();
container.setLayout(new GridBagLayout());
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets.left = 5;
gbc.insets.bottom = 3;
container.add(new JLabel(Messages.getString("ProxyLogic.server")), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
container.add(server, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets.left = 5;
gbc.insets.bottom = 3;
container.add(new JLabel(Messages.getString("ProxyLogic.port")), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
container.add(port, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets.left = 5;
gbc.insets.bottom = 3;
container.add(new JLabel(Messages.getString("ProxyLogic.username")), gbc);
gbc.gridx = 1;
gbc.gridy = 2;
container.add(username, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
container.add(new JLabel(Messages.getString("ProxyLogic.password")), gbc);
gbc.gridx = 1;
gbc.gridy = 3;
container.add(password, gbc);
panel.add(about);
panel.add(Box.createVerticalStrut(20));
panel.add(container);
panel.add(Box.createVerticalStrut(20));
return panel;
}
/**
* Creates panel for delimeter selection.
* This panel is used on the first step
*
* @return JPanel delimeter selection panel
*/
private JPanel createDelimSelectorPanel() {
JXTaskPane delimPanel = createTaskPane();
delimPanel.setLayout(new GridBagLayout());
delimRadioButtons = new ArrayList<JRadioButton>();
Map<String, JRadioButton>delimRadioButtonsByDelims = new HashMap<String, JRadioButton>();
ButtonGroup delimGroup = new ButtonGroup();
String[] selectorLabels = new String[Delimiter.values().length];
String[] delimiters = new String[Delimiter.values().length];
for(int i = 0; i < Delimiter.values().length; i++){
selectorLabels[i] = Delimiter.values()[i].getName();
delimiters[i] = Delimiter.values()[i].toString();
}
for (int i = 0; i < selectorLabels.length; i++) {
JRadioButton selector = new JRadioButton(selectorLabels[i]);
selector.setActionCommand(delimiters[i]);
selector.addActionListener(this);
selector.setOpaque(false);
delimGroup.add(selector);
delimRadioButtons.add(selector);
delimRadioButtonsByDelims.put(delimiters[i], selector);
}
customDelimRadioButton = new JRadioButton("Other:");
customDelimRadioButton.addActionListener(this);
customDelimRadioButton.setOpaque(false);
delimGroup.add(customDelimRadioButton);
delimRadioButtons.add(customDelimRadioButton);
delimRadioButtons.get(0).setSelected(true);
customDelimField = new JTextField(3);
customDelimField.addCaretListener(this);
//customDelimField.setPreferredSize(new Dimension(25, 20));
customDelimField.setMargin(new Insets(2, 2, 2, 2));
useCustomDelimButton = new JButton("Use");
useCustomDelimButton.addActionListener(this);
useCustomDelimButton.setEnabled(false);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0; c.gridy = 0;
c.gridwidth = 2;
c.anchor = GridBagConstraints.WEST;
c.weightx = 1.0;
c.fill = GridBagConstraints.HORIZONTAL;
for (int i = 0; i < delimRadioButtons.size()-1; i++) {
delimPanel.add(delimRadioButtons.get(i), c);
c.gridy++;
}
c.gridx = 0;
c.gridwidth = 1;
c.weightx = 0.0;
c.fill = GridBagConstraints.NONE;
delimPanel.add(customDelimRadioButton, c);
c.gridx = 1;
delimPanel.add(customDelimField, c);
c.gridx++;
delimPanel.add(useCustomDelimButton, c);
delimPanel.setTitle("Column Delimiter");
return delimPanel;
}
@Override
protected JPanel assemble() {
blankloader = new ImageIcon(new BufferedImage(43, 11,
BufferedImage.TYPE_INT_ARGB));
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
GridBagConstraints gbc = new GridBagConstraints();
sidebar = new JPanel();
sidebar.setLayout(new CardLayout());
sidebar.add(
new OverviewBuilder().withBorder(BorderFactory.createEtchedBorder())
.build(globals), WELCOME);
sidebar.setPreferredSize(new Dimension(450, 700));
serp = new JPanel();
serp.setLayout(new CardLayout());
serp.add(new JPanel(), WELCOME);
serp.setPreferredSize(new Dimension(550, 700));
query = new JTextField(20);
query.setMargin(new Insets(2, 2, 2, 2));
search = new JButton(Messages.getLocalizer().localize("search"));
query.addActionListener(this);
search.addActionListener(this);
query.requestFocusInWindow();
JPanel container = new JPanel();
container.setLayout(new GridBagLayout());
busy = new JLabel(blankloader);
busy.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(0, 30, 0, 30);
container.add(busy, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.CENTER;
gbc.weightx = 1;
gbc.insets = new Insets(0, 0, 0, 5);
container.add(query, gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.EAST;
gbc.weightx = 0;
gbc.insets = new Insets(0, 0, 0, 0);
container.add(search, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5, 10, 10, 0);
container.add(new JSeparator(Separator.HORIZONTAL), gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 3;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(10, 10, 0, 0);
container.add(serp, gbc);
panel.add(container);
panel.add(sidebar, BorderLayout.WEST);
globals.get(PlayManager.class).addPlayListener(this);
globals.get(BridgeManager.class).addBridgeListener(this);
globals.get(DatabaseManager.class).get(VariableDao.class)
.addDataSetListener(new DatasetListenerProxy(this));
globals.get(DatabaseManager.class).get(PlayProfileDao.class)
.subscribe(new DatasetListenerProxy(this));
Focus.on(query);
return panel;
}
@Override
protected JPanel assemble() {
String tmp = Messages.getString(Traits.rev("tuoba.esnecil"));
tmp = MessageFormat.format(tmp, Bookmarks.ORDER, globals.get(Traits.class)
.getChallenge().toUpperCase());
HyperTextPane about = new HyperTextPane(tmp).withTransparency().withWidth(
300);
input = new JTextField(20);
input.setMargin(new Insets(2, 2, 2, 2));
input.addCaretListener(this);
input.addActionListener(this);
go = new JButton(Messages.getString(Traits.rev("ylppa.esnecil")));
go.addActionListener(this);
go.setEnabled(false);
JPanel content = new JPanel();
content.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.NORTHWEST;
content.add(about, gbc);
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.insets.top = 15;
gbc.weightx = 0;
gbc.weighty = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
content.add(new JLabel(Messages.getString(Traits.rev("yek.esnecil"))), gbc);
gbc.gridx = 1;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets.left = 5;
content.add(input, gbc);
panel = new DialogBuilder(new AdapterBuilder(content))
.withTitle(Messages.getString(Traits.rev("eltit.esnecil")))
.withSubTitle(Messages.getString(Traits.rev("eltitbus.esnecil")))
.withButtons(new ButtonBarBuilder().add(go)).build(globals);
return panel;
}