• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PromptSupport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jdesktop.swingx.prompt.PromptSupport的典型用法代码示例。如果您正苦于以下问题:Java PromptSupport类的具体用法?Java PromptSupport怎么用?Java PromptSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PromptSupport类属于org.jdesktop.swingx.prompt包,在下文中一共展示了PromptSupport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setInputPrompt

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
@Override
public void setInputPrompt(String inputPrompt) {
    this.inputPrompt = inputPrompt;

    if ((!isEditableWithParent() || !this.impl.isEnabled()) && StringUtils.isNotBlank(inputPrompt)) {
        return;
    }

    if (StringUtils.isNotBlank(inputPrompt)) {
        // Save old tooltipText value to use it later
        String toolTipText = this.impl.getToolTipText();

        PromptSupport.setPrompt(inputPrompt, impl);

        // Use old tooltipText value because it was overwritten in org.jdesktop.swingx.prompt.PromptSupport.setPrompt()
        this.impl.setToolTipText(toolTipText);
    } else {
        PromptSupport.setPrompt(null, impl);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:DesktopTextField.java


示例2: ValidationView2

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public ValidationView2() {
  super("validView", "Validation view 2", "View with validation,");
  jPanel = new JPanel(new MigLayout());
  tfName = new JTextField(20);
  PromptSupport.setPrompt("Enter name with uppercase", tfName);
  JLabel labelName = new JLabel("Name: ");
  labelName.setDisplayedMnemonic('m');
  labelName.setLabelFor(tfName);
  tfAge = new JTextField(20);
  PromptSupport.setPrompt("Enter age", tfAge);
  JLabel ageLabel = new JLabel("Age: ");
  ageLabel.setDisplayedMnemonic('a');
  ageLabel.setLabelFor(tfAge);
  jPanel.add(labelName);
  jPanel.add(tfName, "wrap");
  jPanel.add(ageLabel);
  jPanel.add(tfAge, "wrap");
}
 
开发者ID:otros-systems,项目名称:otroslogviewer,代码行数:19,代码来源:ValidationView2.java


示例3: doCreateCenterPanel

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
protected JComponent doCreateCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout(5, 0));

    FilterRule.FilterRuleType[] types = FilterRule.FilterRuleType.values();

    ruleType = new ComboBox(types);
    ruleType.setEnabled(true);
    ruleType.setSelectedIndex(0);

    panel.add(ruleType, BorderLayout.WEST);

    filterName = new JTextField(20);
    PromptSupport.setPrompt("Set the string name here", filterName);
    panel.add(filterName, BorderLayout.CENTER);

    return panel;
}
 
开发者ID:westlinkin,项目名称:AndroidLocalizationer,代码行数:18,代码来源:AddFilterRuleDialog.java


示例4: addPromptSupport

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public static void addPromptSupport(JComponent component, Property property, String promptText) {
    if (JTextComponent.class.isAssignableFrom(component.getClass())) {
        JTextComponent castedComponent = (JTextComponent) component;
        String text;
        if (File.class.isAssignableFrom(property.getType())) {
            text = promptText != null ? promptText :
                    String.format(FILE_FIELD_PROMPT, separateWords(property.getName()));
        } else {
            if (promptText == null) {
                text = property.getDescriptor().getDescription();
                if (StringUtils.isNullOrEmpty(text)) {
                    text = String.format(TEXT_FIELD_PROMPT, separateWords(property.getName()));
                }
            } else {
                text = promptText;
            }
        }
        PromptSupport.setPrompt(text, castedComponent);
        PromptSupport.setFocusBehavior(PromptSupport.FocusBehavior.HIDE_PROMPT, castedComponent);
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:22,代码来源:UIUtils.java


示例5: 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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:RapidLookComboBoxEditor.java


示例6: 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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:36,代码来源:LicenseEnteringDialog.java


示例7: setInputPrompt

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
@Override
public void setInputPrompt(String inputPrompt) {
    this.inputPrompt = inputPrompt;

    if (StringUtils.isNotBlank(inputPrompt)) {
        PromptSupport.setPrompt(inputPrompt, impl);
    } else {
        PromptSupport.setPrompt(null, impl);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:DesktopTextArea.java


示例8: refreshInputPrompt

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
protected void refreshInputPrompt() {
    if (StringUtils.isNotBlank(inputPrompt)) {
        if (isEnabledWithParent() && isEditableWithParent()) {
            // Save old tooltipText value to use it later
            String toolTipText = this.impl.getToolTipText();

            PromptSupport.setPrompt(inputPrompt, impl);

            // Use old tooltipText value because it was overwritten in org.jdesktop.swingx.prompt.PromptSupport.setPrompt()
            this.impl.setToolTipText(toolTipText);
        } else {
            PromptSupport.setPrompt(null, impl);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:DesktopTextField.java


示例9: 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);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:9,代码来源:InputField.java


示例10: EditableArea

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public EditableArea(String prompt) {
    setOpaque(false);
    setLineWrap(true);
    setWrapStyleWord(true);
    setRows(4);
    setBorder(BorderFactory.createEmptyBorder());

    updateColors();
    PromptSupport.setPrompt(prompt, this);
    PromptSupport.setFocusBehavior(PromptSupport.FocusBehavior.SHOW_PROMPT, this);
    setFont(FontService.regular(16));
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:13,代码来源:LengthRestrictedArea.java


示例11: 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());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:38,代码来源:PromptTextUITest_Base.java


示例12: testGetPreferredSize

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
@Test
public void testGetPreferredSize() {
    textComponent.setText("label text");
    PromptSupport.setPrompt("label text", textComponent);
    assertEquals(textComponent.getPreferredSize(), ui.getPromptComponent(textComponent).getPreferredSize());
    
    textComponent.setText("text");
    assertFalse(textComponent.getPreferredSize().equals(ui.getPromptComponent(textComponent).getPreferredSize()));
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:10,代码来源:PromptTextUITest_Base.java


示例13: ValidationView

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public ValidationView() {
  super("validView", "Validation view", "View with validation,");
  jPanel = new JPanel(new MigLayout());
  tf = new JTextField(20);
  PromptSupport.setPrompt("Enter name with uppercase", tf);
  JLabel jLabel = new JLabel("Name: ");
  jLabel.setDisplayedMnemonic('m');
  jLabel.setLabelFor(tf);
  jPanel.add(jLabel);
  jPanel.add(tf);
}
 
开发者ID:otros-systems,项目名称:otroslogviewer,代码行数:12,代码来源:ValidationView.java


示例14: 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));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:64,代码来源:CellTypeTextFieldDefaultImpl.java


示例15: setDefaultFilterText

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public void setDefaultFilterText(String text) {
	this.defaultFilterText = text;
	PromptSupport.setPrompt(text, this);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:5,代码来源:FilterTextField.java


示例16: 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);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:7,代码来源:LengthRestrictedArea.java


示例17: JXFormattedTextField

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
public JXFormattedTextField(String promptText, Color promptForeground, Color promptBackground) {
	PromptSupport.init(promptText, promptForeground, promptBackground, this);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:4,代码来源:JXFormattedTextField.java


示例18: getFocusBehavior

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
/**
 * @see PromptSupport#getFocusBehavior(javax.swing.text.JTextComponent)
 */
public FocusBehavior getFocusBehavior() {
	return PromptSupport.getFocusBehavior(this);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:7,代码来源:JXFormattedTextField.java


示例19: getPrompt

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
/**
 * @see PromptSupport#getPrompt(javax.swing.text.JTextComponent)
 */
public String getPrompt() {
	return PromptSupport.getPrompt(this);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:7,代码来源:JXFormattedTextField.java


示例20: getPromptForeground

import org.jdesktop.swingx.prompt.PromptSupport; //导入依赖的package包/类
/**
 * @see PromptSupport#getForeground(javax.swing.text.JTextComponent)
 */
public Color getPromptForeground() {
	return PromptSupport.getForeground(this);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:7,代码来源:JXFormattedTextField.java



注:本文中的org.jdesktop.swingx.prompt.PromptSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewUtil类代码示例发布时间:2022-05-22
下一篇:
Java GuiScreenDemo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap