本文整理汇总了Java中org.jdesktop.swingx.prompt.PromptSupport.setForeground方法的典型用法代码示例。如果您正苦于以下问题:Java PromptSupport.setForeground方法的具体用法?Java PromptSupport.setForeground怎么用?Java PromptSupport.setForeground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.prompt.PromptSupport
的用法示例。
在下文中一共展示了PromptSupport.setForeground方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEnable
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
public void setEnable(boolean val) {
this.editor.setEnabled(val);
if (val) {
PromptSupport.setForeground(Color.LIGHT_GRAY, textField);
PromptSupport.setPrompt(PROMPT, textField);
PromptSupport.setFontStyle(Font.ITALIC, textField);
PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT, textField);
} else {
PromptSupport.setPrompt("", textField);
}
}
示例2: LicenseEnteringDialog
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
public LicenseEnteringDialog(Window owner, String key, Object... arguments) {
super(owner, key, ModalityType.APPLICATION_MODAL, arguments);
this.textArea = new JTextArea();
this.statusLabel = new JLabel();
this.startDateLabel = new JLabel();
this.expirationDateLabel = new JLabel();
this.registeredToLabel = new JLabel();
this.productLabel = new JLabel();
this.editionLabel = new JLabel();
this.parseError = true;
if(arguments.length > 0) {
this.productName = String.valueOf(arguments[0]);
}
this.mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = 1;
c.gridx = 0;
c.gridy = 0;
this.detailsPanel = this.makeDetailsPanel();
this.mainPanel.add(this.detailsPanel, c);
this.textPane = this.makeTextPane("");
c.gridy = 1;
c.insets = new Insets(10, 0, 0, 0);
this.mainPanel.add(this.textPane, c);
this.installButton = this.makeInstallButton();
PromptSupport.setForeground(Color.GRAY, this.textArea);
PromptSupport.setPrompt(I18N.getGUILabel("license.paste_here", new Object[0]), this.textArea);
PromptSupport.setFontStyle(Integer.valueOf(2), this.textArea);
PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT, this.textArea);
this.textArea.setText(this.getLicenseKeyFromClipboard());
this.setValuesForDetailsPanel();
this.layoutDefault(this.mainPanel, this.makeButtonPanel());
this.setResizable(false);
}
示例3: updateColors
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
public void updateColors() {
Color currentColor = ColorService.forCurrentTheme(myColors.text);
Color currentBackgroundColor = ColorService.forCurrentTheme(myColors.background);
setCaretColor(currentColor);
super.setForeground(currentColor);
super.setBackground(currentBackgroundColor);
PromptSupport.setForeground(ColorService.forCurrentTheme(myColors.placeholder), this);
}
示例4: testGetLabelComponent
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
@Test
public void testGetLabelComponent() {
PromptSupport.setPrompt("test", textComponent);
PromptSupport.setForeground(Color.BLACK, textComponent);
PromptSupport.setBackground(Color.RED, textComponent);
textComponent.setBorder(BorderFactory.createBevelBorder(1));
textComponent.setEnabled(false);
textComponent.setEditable(false);
textComponent.setOpaque(false);
textComponent.setBounds(new Rectangle(1,1));
textComponent.setBackground(Color.BLACK);
textComponent.setFont(textComponent.getFont().deriveFont(Font.ITALIC, 20));
textComponent.setSelectedTextColor(Color.BLACK);
textComponent.setSelectionColor(Color.BLACK);
textComponent.setMargin(new Insets(1,1,1,1));
JTextComponent lbl = ui.getPromptComponent(textComponent);
assertEquals(PromptSupport.getPrompt(textComponent), lbl.getText());
assertEquals(PromptSupport.getForeground(textComponent), lbl.getForeground());
assertEquals(PromptSupport.getBackground(textComponent), lbl.getBackground());
assertEquals(textComponent.getBorder().getBorderInsets(textComponent),
lbl.getBorder().getBorderInsets(lbl));
assertEquals(textComponent.isEnabled(), lbl.isEnabled());
assertEquals(textComponent.isEditable(), lbl.isEditable());
assertEquals(textComponent.isOpaque(), lbl.isOpaque());
assertEquals(textComponent.getBounds(), lbl.getBounds());
assertEquals(textComponent.getFont(), lbl.getFont());
assertEquals(textComponent.getSelectedTextColor(), lbl.getSelectedTextColor());
assertEquals(textComponent.getSelectionColor(), lbl.getSelectionColor());
assertEquals(textComponent.getMargin(), lbl.getMargin());
PromptSupport.setFontStyle(Font.BOLD, textComponent);
lbl = ui.getPromptComponent(textComponent);
assertEquals(textComponent.getFont().deriveFont(Font.BOLD), lbl.getFont());
}
示例5: CellTypeTextFieldDefaultImpl
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
/**
* Creates a {@link JFormattedTextField} for the specified cell. If a formatter is given, will
* apply it to the field. Does not validate the model, so make sure this call works!
*
* @param model
* @param rowIndex
* @param columnIndex
* @param cellClass
* @param formatter
* the formatter or <code>null</code> if none is required
* @param hideUnavailableContentAssist
* @return
*/
public CellTypeTextFieldDefaultImpl(final TablePanelModel model, final int rowIndex, final int columnIndex,
final Class<? extends CellType> cellClass, AbstractFormatter formatter, boolean hideUnavailableContentAssist) {
super();
final JFormattedTextField field = CellTypeImplHelper.createFormattedTextField(model, rowIndex, columnIndex);
setLayout(new BorderLayout());
add(field, BorderLayout.CENTER);
// otherwise 'null' would be restored
Object value = model.getValueAt(rowIndex, columnIndex);
String text = value != null ? String.valueOf(value) : "";
// specical handling when formatter is given
if (formatter != null) {
field.setFormatterFactory(new DefaultFormatterFactory(formatter));
}
field.setText(text);
// set syntax assist if available
String syntaxHelp = model.getSyntaxHelpAt(rowIndex, columnIndex);
if (syntaxHelp != null && !"".equals(syntaxHelp.trim())) {
PromptSupport.setForeground(Color.LIGHT_GRAY, field);
PromptSupport.setPrompt(syntaxHelp, field);
PromptSupport.setFontStyle(Font.ITALIC, field);
PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT, field);
}
// see if content assist is possible for this field, if so add it
ImageIcon icon = SwingTools.createIcon("16/"
+ I18N.getMessageOrNull(I18N.getGUIBundle(), "gui.action.content_assist.icon"));
JButton contentAssistButton = new JButton();
contentAssistButton.setIcon(icon);
if (field.isEnabled() && model.isContentAssistPossibleForCell(rowIndex, columnIndex)) {
contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),
"gui.action.content_assist_enabled.tip"));
CellTypeImplHelper.addContentAssist(model, rowIndex, columnIndex, field, contentAssistButton, cellClass);
} else {
contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),
"gui.action.content_assist_disabled.tip"));
contentAssistButton.setEnabled(false);
}
if (contentAssistButton.isEnabled() || (!contentAssistButton.isEnabled() && !hideUnavailableContentAssist)) {
add(contentAssistButton, BorderLayout.EAST);
}
// set size so panels don't grow larger when they get the chance
setPreferredSize(new Dimension(300, 20));
setMinimumSize(new Dimension(100, 15));
setMaximumSize(new Dimension(1600, 30));
}
示例6: updateColors
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
public void updateColors() {
Color currentColor = ColorService.forCurrentTheme(myColors.text);
setCaretColor(currentColor);
super.setForeground(currentColor);
PromptSupport.setForeground(ColorService.forCurrentTheme(myColors.placeholder), this);
}
示例7: setPromptForeground
import org.jdesktop.swingx.prompt.PromptSupport; //导入方法依赖的package包/类
/**
* @see PromptSupport#setForeground(Color, javax.swing.text.JTextComponent)
*/
public void setPromptForeground(Color promptTextColor) {
PromptSupport.setForeground(promptTextColor, this);
}