Java Code Examples for javax.swing.text.DefaultFormatterFactory#setDefaultFormatter()
The following examples show how to use
javax.swing.text.DefaultFormatterFactory#setDefaultFormatter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdvancedSecurityPanel.java From netbeans with Apache License 2.0 | 5 votes |
public AdvancedSecurityPanel(Binding binding, ConfigVersion cfgVersion) { this.binding = binding; this.cfgVersion = cfgVersion; freshnessff = new DefaultFormatterFactory(); NumberFormat freshnessFormat = NumberFormat.getIntegerInstance(); freshnessFormat.setGroupingUsed(false); NumberFormatter freshnessFormatter = new NumberFormatter(freshnessFormat); freshnessFormat.setMaximumIntegerDigits(8); freshnessFormatter.setCommitsOnValidEdit(true); freshnessFormatter.setMinimum(0); freshnessFormatter.setMaximum(99999999); freshnessff.setDefaultFormatter(freshnessFormatter); skewff = new DefaultFormatterFactory(); NumberFormat skewFormat = NumberFormat.getIntegerInstance(); skewFormat.setGroupingUsed(false); NumberFormatter skewFormatter = new NumberFormatter(skewFormat); skewFormat.setMaximumIntegerDigits(8); skewFormatter.setCommitsOnValidEdit(true); skewFormatter.setMinimum(0); skewFormatter.setMaximum(99999999); skewff.setDefaultFormatter(skewFormatter); initComponents(); sync(); }
Example 2
Source File: AdvancedRMPanel.java From netbeans with Apache License 2.0 | 5 votes |
public AdvancedRMPanel(Binding binding, ConfigVersion cfgVersion) { super(); this.binding = binding; this.cfgVersion = cfgVersion; milisecondsff = new DefaultFormatterFactory(); NumberFormat millisecondsFormat = NumberFormat.getIntegerInstance(); millisecondsFormat.setGroupingUsed(false); NumberFormatter millisecondsFormatter = new NumberFormatter(millisecondsFormat); millisecondsFormat.setMaximumIntegerDigits(8); millisecondsFormatter.setCommitsOnValidEdit(true); millisecondsFormatter.setMinimum(0); millisecondsFormatter.setMaximum(99999999); milisecondsff.setDefaultFormatter(millisecondsFormatter); maxBufff = new DefaultFormatterFactory(); NumberFormat maxBufFormat = NumberFormat.getIntegerInstance(); maxBufFormat.setGroupingUsed(false); NumberFormatter maxBufFormatter = new NumberFormatter(maxBufFormat); maxBufFormat.setMaximumIntegerDigits(8); maxBufFormatter.setCommitsOnValidEdit(true); maxBufFormatter.setMinimum(0); maxBufFormatter.setMaximum(99999999); maxBufff.setDefaultFormatter(maxBufFormatter); initComponents(); inSync = true; for (RMDeliveryAssurance assurance : RMDeliveryAssurance.values()) { deliveryAssuranceCombo.addItem(assurance); } inSync = false; sync(); refresh(); }
Example 3
Source File: STSConfigServicePanel.java From netbeans with Apache License 2.0 | 5 votes |
/** * Creates new form STSConfigServicePanel */ public STSConfigServicePanel( Project p, Binding binding, ConfigVersion cfgVersion) { this.project = p; this.binding = binding; this.cfgVersion = cfgVersion; lifeTimeDff = new DefaultFormatterFactory(); NumberFormat lifetimeFormat = NumberFormat.getIntegerInstance(); lifetimeFormat.setGroupingUsed(false); lifetimeFormat.setParseIntegerOnly(true); lifetimeFormat.setMaximumFractionDigits(0); NumberFormatter lifetimeFormatter = new NumberFormatter(lifetimeFormat); lifetimeFormatter.setCommitsOnValidEdit(true); lifetimeFormatter.setMinimum(0); lifeTimeDff.setDefaultFormatter(lifetimeFormatter); initComponents(); inSync = true; ServiceProvidersTablePanel.ServiceProvidersTableModel tablemodel = new ServiceProvidersTablePanel.ServiceProvidersTableModel(); this.remove(serviceProvidersPanel); STSConfiguration stsConfig = ProprietarySecurityPolicyModelHelper.getSTSConfiguration(binding); if (stsConfig == null) { stsConfig = ProprietarySecurityPolicyModelHelper.createSTSConfiguration(binding); } serviceProvidersPanel = new ServiceProvidersTablePanel(tablemodel, stsConfig, cfgVersion); ((ServiceProvidersTablePanel)serviceProvidersPanel).populateModel(); inSync = false; sync(); }
Example 4
Source File: CallbackPanel.java From netbeans with Apache License 2.0 | 4 votes |
public CallbackPanel(SectionView view, Node node, Binding binding, JaxWsModel jaxWsModel, WSDLModel serviceModel) { super(view); this.view = view; this.node = node; this.binding = binding; this.jaxwsmodel = jaxWsModel; this.serviceModel = serviceModel; cfgVersion = PolicyModelHelper.getConfigVersion(binding); FileObject fo = node.getLookup().lookup(FileObject.class); if (fo == null) { JAXWSLightSupport support = node.getLookup().lookup(JAXWSLightSupport.class); if (support != null) { fo = support.getWsdlFolder(false); } } if (fo != null) { project = FileOwnerQuery.getOwner(fo); } else { throw new IllegalArgumentException("Cannot find corresponding project: " + node); } this.wsitProvider = project.getLookup().lookup(WsitProvider.class); if (wsitProvider != null) { jsr109 = wsitProvider.isJsr109Project(); } tstampff = new DefaultFormatterFactory(); NumberFormat timestampFormat = NumberFormat.getIntegerInstance(); timestampFormat.setGroupingUsed(false); timestampFormat.setParseIntegerOnly(true); timestampFormat.setMaximumIntegerDigits(8); timestampFormat.setMaximumFractionDigits(0); NumberFormatter timestampFormatter = new NumberFormatter(timestampFormat); timestampFormatter.setCommitsOnValidEdit(true); timestampFormatter.setMinimum(0); timestampFormatter.setMaximum(99999999); tstampff.setDefaultFormatter(timestampFormatter); initComponents(); /* issue 232988: the background color issues with dark metal L&F samlHandlerField.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); samlHandlerLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); iterationLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); iterationField.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); devDefaultsChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); cbTimestampLbl.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); cbTimestampField.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); */ cbTimestampField.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT); inSync = true; credTypeCombo.removeAllItems(); credTypeCombo.addItem(ComboConstants.STATIC); credTypeCombo.addItem(ComboConstants.DYNAMIC); inSync = false; addImmediateModifier(samlHandlerField); addImmediateModifier(credTypeCombo); addImmediateModifier(devDefaultsChBox); addImmediateModifier(cbTimestampField); addImmediateModifier(iterationField); sync(); }
Example 5
Source File: TomcatSettingsEditor.java From SmartTomcat with Apache License 2.0 | 4 votes |
@NotNull @Override protected JComponent createEditor() { ComboboxWithBrowseButton tomcatField = runnerSetting.getTomcatField(); TextFieldWithBrowseButton docBaseField = runnerSetting.getDocBaseField(); JTextField contextPathField = runnerSetting.getContextPathField(); JFormattedTextField portField = runnerSetting.getPortField(); JFormattedTextField adminPort = runnerSetting.getAdminPort(); JXButton configrationButton = runnerSetting.getConfigrationButton(); configrationButton.addActionListener(e -> ShowSettingsUtil.getInstance().showSettingsDialog(project, TomcatSettingConfigurable.class)); VirtualFile baseDir = VirtualFileManager.getInstance().getFileSystem("file").findFileByPath(project.getBasePath()); FileChooserDescriptor chooserDescriptor = new IgnoreOutputFileChooserDescriptor(project).withRoots(baseDir); docBaseField.addBrowseFolderListener("webapp", "Choose Web Folder", project, chooserDescriptor); docBaseField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent documentEvent) { if (!documentEvent.getType().equals(DocumentEvent.EventType.REMOVE)) { String text = docBaseField.getText(); if (text != null && !text.trim().equals("")) { VirtualFile fileByIoFile = LocalFileSystem.getInstance().findFileByIoFile(new File(text)); Module module = ModuleUtilCore.findModuleForFile(fileByIoFile, project); String contextPath = module == null ? "/" : "/" + module.getName(); contextPathField.setText(contextPath); } } } }); portField.setValue(8080); adminPort.setValue(8005); DefaultFormatterFactory tf = new DefaultFormatterFactory(); NumberFormat format = NumberFormat.getInstance(); format.setGroupingUsed(false); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(65535); tf.setDefaultFormatter(formatter); portField.setFormatterFactory(tf); adminPort.setFormatterFactory(tf); return runnerSetting.getMainPanel(); }