本文整理匯總了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;
}