javax.swing.JTextField#setMargin ( )源码实例Demo

下面列出了javax.swing.JTextField#setMargin ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ios-image-util   文件: SplitterFrame.java
/**
 * 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;
}
 
源代码2 项目: Robot-Overlord-App   文件: ViewElementFilename.java
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);
}
 
源代码3 项目: raccoon4   文件: ManualDownloadBuilder.java
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"));
}
 
源代码4 项目: dragonwell8_jdk   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码5 项目: TencentKona-8   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码6 项目: jdk8u60   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码7 项目: openjdk-jdk8u   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码9 项目: openjdk-jdk9   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码10 项目: jdk8u-jdk   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码11 项目: hottub   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码12 项目: openjdk-8-source   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码13 项目: openjdk-8   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码14 项目: jdk8u_jdk   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码15 项目: jdk8u-jdk   文件: XTextFieldPeer.java
@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"));
    }
}
 
源代码16 项目: raccoon4   文件: MimicLogic.java
@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;
}
 
源代码17 项目: raccoon4   文件: ProxyLogic.java
@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;
}
 
源代码18 项目: chipster   文件: ToolsInternalFrame.java
/**
 * 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;
}
 
源代码19 项目: raccoon4   文件: PlayStoreViewBuilder.java
@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;
}
 
源代码20 项目: raccoon4   文件: GrantBuilder.java
@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;
}