本文整理汇总了Java中java.beans.PropertyEditor.getCustomEditor方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyEditor.getCustomEditor方法的具体用法?Java PropertyEditor.getCustomEditor怎么用?Java PropertyEditor.getCustomEditor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyEditor
的用法示例。
在下文中一共展示了PropertyEditor.getCustomEditor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fontButtonActionPerformed
import java.beans.PropertyEditor; //导入方法依赖的package包/类
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
pe.setValue(termOptions.getFont());
DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());
String defaultFontString = FontChooser_defaultFont_label();
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFontString, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
termOptions.setFont(f);
applyTermOptions();
} else if (dd.getValue() == defaultFontString) {
Font controlFont = UIManager.getFont("controlFont"); //NOI18N
int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize)); //NOI18N
}
}
}
示例2: btnSelectFontActionPerformed
import java.beans.PropertyEditor; //导入方法依赖的package包/类
private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
pe.setValue(outputOptions.getFont());
DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
NbBundle.getMessage(Controller.class,
"LBL_Font_Chooser_Title")); //NOI18N
String defaultFont = NbBundle.getMessage(Controller.class,
"BTN_Defaul_Font"); //NOI18N
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFont, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
outputOptions.setFont(f);
} else if (dd.getValue() == defaultFont) {
outputOptions.setFont(null);
}
updateFontField();
}
}
示例3: show
import java.beans.PropertyEditor; //导入方法依赖的package包/类
public static Font show(Font initialFont) {
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe == null) {
throw new RuntimeException("Could not find font editor component.");
}
pe.setValue(initialFont);
DialogDescriptor dd = new DialogDescriptor(
pe.getCustomEditor(),
"Choose Font");
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font)pe.getValue();
return f;
}
return initialFont;
}