下面列出了javax.swing.JTextField#setBackground ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void setup() {
this.setLayout(new MigLayout("ins 5,center"));
this.setBackground(Color.BLACK);
usernameField = new JTextField();
usernameField.setDocument(new LengthRestrictedDocument(12));
usernameField.setBackground(new Color(101, 101, 101));
usernameField.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
xpDisplay = new JLabel();
rsnLabel = new JLabel("RSN:");
rsnLabel.setForeground(Color.white);
rsnLabel.setFont(new Font(rsnLabel.getFont().getFontName(), Font.BOLD, rsnLabel.getFont().getSize()));
levelsDisplayPanel = new LevelsPanel();
levelsDisplayPanel.setRolloverListener(this);
levelInfoPanel = new LevelInfoPanel();
searchButton = new JButton();
searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/searchiconsquare3.png")));
//searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/bwsearch2.png")));
searchButton.setBorderPainted(false);
searchButton.setFocusPainted(false);
searchButton.setContentAreaFilled(false);
add(rsnLabel, "cell 0 0, gap 0, align left");
add(usernameField, "width 60%, cell 1 0,align left, ");
add(searchButton, "cell 2 0,align right ");
add(levelsDisplayPanel, "width 100%, height 20%, cell 0 1, center,spanx");
add(levelInfoPanel, "width 100%, height 15%, cell 0 2, center, spanx");
}
public SingleEntryDialog(Component parent, String entryLabel,
String buttonLabel, ActionListener buttonListener)
{
super();
entry = new JTextField(entryLabel);
entry.setForeground(Color.WHITE);
entry.setBackground(Color.DARK_GRAY);
entry.setBorder(new LineBorder(Color.GRAY));
entry.setCaretColor(Color.WHITE);
entry.setFont(new Font("Tahoma", Font.PLAIN, 22));
entry.addFocusListener(new TextFieldFocusListener(entry));
contentPanel.add(entry, "cell 0 1, grow, gapx 2 2");
JButton btnConfirm = new ModernButton(buttonLabel);
btnConfirm.setFont(new Font("Tahoma", Font.PLAIN, 18));
btnConfirm.addActionListener(buttonListener);
contentPanel.add(btnConfirm, "cell 0 3, alignx center");
JLabel spacer = new JLabel(" ");
contentPanel.add(spacer, "cell 0 4");
finalize(parent);
btnConfirm.requestFocus();
}
private void updateControls(JTextField tf, JButton addButton, int state) {
if (textBkColor == null) {
textBkColor = tf.getBackground();
}
switch (state) {
default:
tf.setBackground(Color.pink);
addButton.setEnabled(false);
break;
case -1:
tf.setBackground(textBkColor);
addButton.setEnabled(false);
break;
case 0:
tf.setBackground(textBkColor);
addButton.setEnabled(true);
break;
}
}
private Component[] createColorField(String text, Color defaultColor) {
JLabel colorLabel = new JLabel(text);
final JTextField colorField = new JTextField();
colorField.setEditable(false);
colorField.setPreferredSize(txtDim);
colorField.setMinimumSize(txtDim);
colorField.setText(String.valueOf(defaultColor.getRGB()));
colorField.setBackground(defaultColor);
JButton colorButton = new JButton();
colorButton.setPreferredSize(buttonDim);
colorButton.setMinimumSize(buttonDim);
colorButton.setMaximumSize(buttonDim);
colorButton.setIcon(ImageUtil.getImageIcon("copy_settings"));
colorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Color color = ExtendedColorChooser.showDialog(SwingUtilities.getWindowAncestor(SelectDisplaySettingsWizardPanel.this),
I18NSupport.getString("color.dialog.title"), null);
if (color != null) {
colorField.setText(String.valueOf(color.getRGB()));
colorField.setBackground(color);
}
}
});
return new Component[] {colorLabel, colorField, colorButton};
}
/**
* Method to enable/disable a Swing JTextField object
*
* @param textField Swing JTextField object
* @param enabled Flag to indicate whether to enable or disable the object
*/
public static void setEnabled(JTextField textField, boolean enabled) {
if (enabled) {
textField.setEnabled(true);
textField.setBackground(Color.WHITE);
} else {
textField.setEnabled(false);
textField.setBackground(UIManager.getColor("Panel.background"));
}
}
@Override
public void focusLost(FocusEvent e) {
JTextField jTextField = (JTextField) e.getSource();
try {
parse(jTextField.getText());
jTextField.setBackground(Color.WHITE);
} catch (ParseException ex) {
ColorSettings.config(jTextField, ColorEntry.GLOBAL_ENTRY_INVALID);
}
jTextField.setCaretPosition(jTextField.getText().length());
}
protected long loadMaskField(JTextField maskField) {
String text = maskField.getText();
long value = 0;
boolean correct = false;
try {
if (text.matches("\\d+")) {
value = Long.parseLong(text);
correct = true;
} else if (text.matches("0[xX][0-9a-f]+")) {
value = Long.parseLong(text.substring(2), 16);
correct = true;
} else if (text.matches("0[bB][01]+")) {
value = Long.parseLong(text.substring(2), 2);
correct = true;
}
} catch (NumberFormatException e) {
value = 0;
correct = false;
}
if (correct) {
maskField.setBackground(Color.WHITE);
} else {
maskField.setBackground(Color.RED);
}
return value;
}
public JComponent getMarkerComponent(final String name, final int measurementIndex, final int markerPairIndex, final int index) {
Dimension dim = new Dimension(MARKER_NAME_WIDTH,HEIGHT);
JTextField markerButton = new JTextField(name);
markerButton.setEditable(false);
markerButton.setHorizontalAlignment(SwingConstants.CENTER);
// Indicate marker does not exist in model's marker set with red color (though the measurement may still be invalid
// if this marker is not found in the marker data passed to the model scaler)
boolean markerInModel = measurementSetModel.getMarkerExistsInModel(name);
boolean markerInMeasurementTrial = measurementSetModel.getMarkerExistsInMeasurementTrial(name);
if(!markerInModel || !markerInMeasurementTrial) {
markerButton.setBackground(invalidColor);
if(!markerInModel && !markerInMeasurementTrial) markerButton.setToolTipText("Marker not in model or measurement marker data!");
else if(!markerInModel) markerButton.setToolTipText("Marker not in model!");
else markerButton.setToolTipText("Marker not in measurement marker data!");
} else {
markerButton.setBackground(Color.white);
markerButton.setToolTipText(null);
}
markerButton.setMinimumSize(dim);
markerButton.setMaximumSize(dim);
markerButton.setPreferredSize(dim);
markerButton.setBorder(markerInnerBorder);
markerButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
JPopupMenu popup = new JPopupMenu();
for(int i=0; i<markerNames.size(); i++) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(new ChangeMarkerPairMarkerAction(markerNames.get(i), measurementIndex, markerPairIndex, index));
if(markerNames.get(i).equals(name)) item.setSelected(true);
popup.add(item);
}
popup.setLayout(new GridLayout(25,markerNames.size()/25+1));
popup.show(evt.getComponent(),evt.getX(),evt.getY());
}
});
return markerButton;
}
/**
* Create a single-line entry box with the specified name, label, default
* value, and background color. To control the width of the box, call
* setTextWidth() first.
*
* @param name
* The name used to identify the entry (when accessing the
* entry).
* @param label
* The label to attach to the entry.
* @param defaultValue
* Default value to appear in the entry box.
* @param background
* The background color.
* @param foreground
* The foreground color.
*/
public void addLine(String name, String label, String defaultValue, Color background, Color foreground) {
JLabel lbl = new JLabel(label + ": ");
lbl.setBackground(_background);
JTextField entryBox = new JTextField(defaultValue, _width);
entryBox.setBackground(background);
entryBox.setForeground(foreground);
_addPair(name, lbl, entryBox, entryBox);
// Add the listener last so that there is no notification
// of the first value.
entryBox.addActionListener(new QueryActionListener(name));
// Add a listener for loss of focus. When the entry gains
// and then loses focus, listeners are notified of an update,
// but only if the value has changed since the last notification.
// FIXME: Unfortunately, Java calls this listener some random
// time after the window has been closed. It is not even a
// a queued event when the window is closed. Thus, we have
// a subtle bug where if you enter a value in a line, do not
// hit return, and then click on the X to close the window,
// the value is restored to the original, and then sometime
// later, the focus is lost and the entered value becomes
// the value of the parameter. I don't know of any workaround.
entryBox.addFocusListener(new QueryFocusListener(name));
}
private JTextField getStatusBar() {
JTextField statusBar = new JTextField();
statusBar.setEditable(false);
statusBar.setBackground(null);
statusBar.setBorder(null);
return statusBar;
}
/**
* action handler for edit fields within panel
* this handler also temporarily changes the color of the edit field to
* visibly indicate the update action.
*/
public void actionPerformed(ActionEvent e)
{
// find out which field sends the event
JTextField edit = (JTextField) e.getSource();
// update the corresponding process var
dataSource.put(edit.getName(), edit.getText(), PvChangeEvent.PV_MANUAL_MOD);
// indicate change by changing field's background color
edit.setBackground(changedColor);
Toolkit.getDefaultToolkit().beep();
}
public RecipeStepPanel(String title, ChangeListener changelistener) {
this.changeListener = changelistener;
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(300, 0));
// header
Box headerBox = Box.createHorizontalBox();
// add borders
Border margin = BorderFactory.createEmptyBorder(10, 10, 10, 10);
MatteBorder lineBorder = new MatteBorder(0, 0, 2, 0, Color.DARK_GRAY);
CompoundBorder border = new CompoundBorder(lineBorder, margin);
headerBox.setBorder(border);
JTextField contentTextField = new JTextField();
contentTextField.setBorder(null);
contentTextField.setBackground(new Color(0, 0, 0, 0));
contentTextField.setText(title);
headerBox.add(contentTextField);
this.add(headerBox, BorderLayout.NORTH);
// body
operationsLine = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = GridBagConstraints.REMAINDER;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
JPanel dummyPanel = new JPanel();
operationsLine.add(dummyPanel, gbc);
this.addContraints = new GridBagConstraints();
this.addContraints.gridwidth = GridBagConstraints.REMAINDER;
this.addContraints.weightx = 1;
this.addContraints.fill = GridBagConstraints.HORIZONTAL;
JScrollPane scrollPane = new JScrollPane(operationsLine);
scrollPane.setBorder(new MatteBorder(0, 2, 0, 0, Color.DARK_GRAY));
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
this.add(scrollPane, BorderLayout.CENTER);
}
public geGuidePanel() {
setLayout(new MigLayout("ins 5, center"));
setBackground(Color.black);
Border loweredbevel = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
Font f = new Font(new JLabel().getFont().getFontName(), Font.BOLD, new JLabel().getFont().getSize() + 2);
ImageIcon searchicon = new ImageIcon(getClass().getClassLoader().getResource("resources/searchicon20.png"));
itemInputField = new JTextField();
itemLabel = new JLabel("ITEM:");
searchButton = new JButton();
priceLabel = new JLabel("PRICE:");
priceLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
priceLabel.setForeground(Color.white);
lowAlchLabel = new JLabel("Low Alchemy:");
lowAlchLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
lowAlchLabel.setForeground(Color.white);
highAlchLabel = new JLabel("High Alchemy:");
highAlchLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
highAlchLabel.setForeground(Color.white);
updateLabel = new JLabel("Last updated:");
updateLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
updateLabel.setForeground(Color.white);
itemInputField.setBorder(loweredbevel);
itemInputField.setBackground(new Color(101, 101, 101));
itemLabel.setForeground(Color.white);
itemLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/searchiconsquare3.png")));
searchButton.setBorderPainted(false);
searchButton.setFocusPainted(false);
searchButton.setContentAreaFilled(false);
add(itemLabel, "cell 0 0, gap 0, align left");
add(searchButton, "cell 2 0,align right ");
add(itemInputField, "width 60%, cell 1 0,align left,");
add(priceLabel, "newline, spanx");
add(lowAlchLabel, "newline, spanx");
add(highAlchLabel, "newline, spanx");
add(updateLabel, "newline, spanx");
searchButton.addActionListener(new ItemSearchListener());
itemInputField.addActionListener(new ItemSearchListener());
isValidItem = false;
setupAnimation();
}
@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"));
}
}
private JPanel createLoggingPanel()
{
final JPanel pnl = new JPanel();
pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("GeneralPreferencesPanel.logging")));
pnl.setLayout(new GridBagLayout());
final GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets(2, 4, 2, 4);
gbc.anchor = GridBagConstraints.NORTHWEST;
ApplicationFiles appFiles = new ApplicationFiles();
String execLogFile = appFiles.getExecutionLogFile().getPath();
String configFile = ApplicationArguments.getInstance().getLoggingConfigFileName();
configFile = null == configFile ? s_stringMgr.getString("GeneralPreferencesPanel.unspecified") :configFile;
gbc.gridx = 0;
gbc.gridy = 0;
JTextField execLogFileField = new JTextField(s_stringMgr.getString("GeneralPreferencesPanel.execlogfileNew", execLogFile));
execLogFileField.setEditable(false);
execLogFileField.setBackground(pnl.getBackground());
execLogFileField.setBorder(null);
pnl.add(execLogFileField, gbc);
++gbc.gridy;
JTextField configFileField = new JTextField(s_stringMgr.getString("GeneralPreferencesPanel.configfileNew", configFile));
configFileField.setEditable(false);
configFileField.setBackground(pnl.getBackground());
configFileField.setBorder(null);
pnl.add(configFileField, gbc);
gbc.weightx = 1.0;
gbc.gridy = 0;
++gbc.gridx;
pnl.add(new JPanel(), gbc);
++gbc.gridy;
pnl.add(new JPanel(), gbc);
return pnl;
}
private JPanel createPathsPanel()
{
final JPanel pnl = new JPanel();
// i18n[GeneralPreferencesPanel.paths=SQuirreL paths]
pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("GeneralPreferencesPanel.paths")));
pnl.setLayout(new GridBagLayout());
final GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets(2, 4, 2, 4);
gbc.anchor = GridBagConstraints.NORTHWEST;
ApplicationFiles appFiles = new ApplicationFiles();
String userDir = appFiles.getUserSettingsDirectory().getPath();
String homeDir = appFiles.getSquirrelHomeDir().getPath();
gbc.gridx = 0;
gbc.gridy = 0;
// i18n[GeneralPreferencesPanel.squirrelHomePath=Home directory: -home {0}]
JTextField homePathField = new JTextField(s_stringMgr.getString("GeneralPreferencesPanel.squirrelHomePath", homeDir));
homePathField.setEditable(false);
homePathField.setBackground(pnl.getBackground());
homePathField.setBorder(null);
pnl.add(homePathField, gbc);
++gbc.gridy;
// i18n[GeneralPreferencesPanel.squirrelUserPath=User directory: -userdir {0}]
JTextField userPathField = new JTextField(s_stringMgr.getString("GeneralPreferencesPanel.squirrelUserPath", userDir));
userPathField.setEditable(false);
userPathField.setBackground(pnl.getBackground());
userPathField.setBorder(null);
pnl.add(userPathField, gbc);
gbc.weightx = 1.0;
gbc.gridy = 0;
++gbc.gridx;
pnl.add(new JPanel(), gbc);
++gbc.gridy;
pnl.add(new JPanel(), gbc);
return pnl;
}
@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"));
}
}
private void setup() {
UIManager.put("Tree.rendererFillBackground", false);
Border loweredbevel = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
DefaultListModel<String> curChans = new DefaultListModel<>();
messagewindow = new JTextArea();
messagewindow.setLineWrap(true);
inputfield = new JTextField();
userlist = new JTextArea();
chanlist = new JList(curChans);
chanscroll = new JScrollPane(chanlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
messagescroll = new JScrollPane(messagewindow, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
userscroll = new JScrollPane(userlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
chanscroll.setBorder(loweredbevel);
messagescroll.setBorder(loweredbevel);
userscroll.setBorder(loweredbevel);
inputfield.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, new Color(51, 51, 51), new Color(51, 51, 51)));
inputfield.setBackground(new Color(71, 71, 71));
messagewindow.setBackground(new Color(71, 71, 71));
userlist.setBackground(new Color(71, 71, 71));
chanlist.setBackground(new Color(71, 71, 71));
chanlist.setForeground(Color.white);
messagewindow.setForeground(Color.white);
messagewindow.setFont(ircFont);
inputfield.setForeground(Color.white);
messagewindow.setText("");
messagewindow.setEditable(false);
inputfield.setCaretColor(Color.black);
chanlist.setForeground(Color.white);
add(chanscroll, "cell 0 0, growx, growy, height 100%,width 15%, align left, spany, ");
add(messagescroll, "growy, cell 1 0, width 68%, height 80%, align center, align left");
add(userscroll, "grow y, cell 2 0, width 17%, height 80%, align left");
add(inputfield, "growx, cell 1 1, spanx, width 68%,height 20,align left");
// messagescroll.setViewportView((messagewindow2));
}
@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 focusGained(FocusEvent e) {
JTextField jTextField = (JTextField) e.getSource();
jTextField.setBackground(Color.WHITE);
}