Java Code Examples for javax.swing.text.NumberFormatter#setCommitsOnValidEdit()
The following examples show how to use
javax.swing.text.NumberFormatter#setCommitsOnValidEdit() .
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: ComponentsFactory.java From MercuryTrade with MIT License | 6 votes |
public JFormattedTextField getIntegerTextField(Integer min, Integer max, Integer value) { NumberFormat format = NumberFormat.getInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(min); formatter.setMaximum(max); formatter.setAllowsInvalid(true); formatter.setCommitsOnValidEdit(false); JFormattedTextField field = new JFormattedTextField(formatter); field.setValue(value); field.setFont(REGULAR_FONT.deriveFont(scale * 18)); field.setFocusLostBehavior(JFormattedTextField.PERSIST); field.setForeground(AppThemeColor.TEXT_DEFAULT); field.setCaretColor(AppThemeColor.TEXT_DEFAULT); field.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(AppThemeColor.BORDER, 1), BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT, 3) )); field.setBackground(AppThemeColor.HEADER); return field; }
Example 2
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 3
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 4
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 5
Source File: ClassDialogue.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("rawtypes") public static JFormattedTextField createNumberField(Class<?> type, Object minValue, Object maxValue) { NumberFormat format = NumberFormat.getInstance(); format.setGroupingUsed(false); format.setMaximumFractionDigits(10); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(type); formatter.setMinimum((Comparable) minValue); formatter.setMaximum((Comparable) maxValue); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); formatter.setOverwriteMode(true); JFormattedTextField jftf = new JFormattedTextField(formatter); return jftf; }
Example 6
Source File: MuleRemoteDebuggerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private void createUIComponents() { NumberFormat format = NumberFormat.getInstance(); format.setGroupingUsed(false); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMaximum(65535); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); portTextField = new JFormattedTextField(formatter); jvmPortTextField = new JFormattedTextField(formatter); appsMap = new JBTable(new ModulesTableModel()); }
Example 7
Source File: TileQuantityPanel.java From Carcassonne with Eclipse Public License 2.0 | 5 votes |
private void createTextField(int initialQuantity) { NumberFormatter formatter = new NumberFormatter(NumberFormat.getIntegerInstance()); formatter.setMinimum(0); formatter.setMaximum(99); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); textField = new JFormattedTextField(formatter); setQuantity(initialQuantity); add(textField, BorderLayout.SOUTH); }
Example 8
Source File: GrammarvizGuesserPane.java From grammarviz2_src with GNU General Public License v2.0 | 5 votes |
/** * Provides a convenient integer formatter. * * @return a formatter instance. */ private static NumberFormatter integerNumberFormatter() { NumberFormat format = NumberFormat.getInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(Integer.MAX_VALUE); // If you want the value to be committed on each keystroke instead of focus lost formatter.setCommitsOnValidEdit(true); return formatter; }
Example 9
Source File: IntegerField.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Instantiates a new integer field. * * @param min the min * @param max the max * @param initialValue the initial value */ public IntegerField(int min, int max, int initialValue) { super(); NumberFormatter formatter = new NumberFormatter(numberFormat); formatter.setMinimum(min); formatter.setMaximum(max); formatter.setCommitsOnValidEdit(true); setFormatter(formatter); setValue(initialValue); }
Example 10
Source File: MessageSamplerGui.java From BotServiceStressToolkit with MIT License | 4 votes |
private void init() { // WARNING: called from ctor so must not be overridden // (i.e. must be private or final) // Standard setup setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); // Add the standard title JPanel mainPanel = new JPanel(); add(mainPanel, BorderLayout.CENTER); numOfResponsesExpectedLabel = new javax.swing.JLabel(NUMBER_OF_RESPONSES_EXPECTED_LABEL); messageTextTextArea.setColumns(20); messageTextTextArea.setRows(5); messageTextAreaScrollPane.setViewportView(messageTextTextArea); NumberFormat format = new DecimalFormat("#0"); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(MAX_RESPONSES_ALLOWED); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); numOfResponsesExpectedTextField = new javax.swing.JFormattedTextField(formatter); numOfResponsesExpectedLabel.setText(NUMBER_OF_RESPONSES_EXPECTED_LABEL); messageTextLabel.setText(MESSAGE_TEXT_LABEL); messageTextFormatLabel.setText(MESSAGE_TEXT_FORMAT_LABEL); localeLabel.setText(LOCALE_LABEL); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(messageTextLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(messageTextFormatLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(localeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(numOfResponsesExpectedLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(localeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(messageTextFormatTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(messageTextAreaScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 469, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(messageTextAreaScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addGap(30, 30, 30).addComponent(messageTextLabel))) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(messageTextFormatLabel).addComponent(messageTextFormatTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(localeLabel).addComponent(localeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(numOfResponsesExpectedLabel).addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(540, Short.MAX_VALUE))); }
Example 11
Source File: ConversationUpdateSamplerGui.java From BotServiceStressToolkit with MIT License | 4 votes |
private void init() { // WARNING: called from ctor so must not be overridden // (i.e. must be private or final) // Standard setup setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); // Add the standard title JPanel mainPanel = new JPanel(); add(mainPanel, BorderLayout.CENTER); numOfResponsesExpectedLabel = new javax.swing.JLabel(); membersAddedLabel = new javax.swing.JLabel(); NumberFormat format = new DecimalFormat("#0"); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(MAX_RESPONSES_ALLOWED); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); numOfResponsesExpectedTextField = new javax.swing.JFormattedTextField(formatter); membersAddedTextField = new javax.swing.JTextField(); numOfResponsesExpectedLabel.setText(NUMBER_OF_RESPONSES_EXPECTED_LABEL); membersAddedLabel.setText(MEMBERS_ADDED_LABEL); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup().addComponent(numOfResponsesExpectedLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup().addComponent(membersAddedLabel) .addGap(42, 42, 42).addComponent(membersAddedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(32, 32, 32) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(numOfResponsesExpectedLabel).addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(membersAddedLabel).addComponent(membersAddedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))); }
Example 12
Source File: EventSamplerGui.java From BotServiceStressToolkit with MIT License | 4 votes |
private void init() { // Standard setup setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); // Add the standard title JPanel mainPanel = new JPanel(); add(mainPanel, BorderLayout.CENTER); numOfResponsesExpectedLabel = new javax.swing.JLabel(NUMBER_OF_RESPONSES_EXPECTED_LABEL); channeldataTextArea.setColumns(20); channeldataTextArea.setRows(5); channeldataAreaScrollPane.setViewportView(channeldataTextArea); NumberFormat format = new DecimalFormat("#0"); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(MAX_RESPONSES_ALLOWED); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); numOfResponsesExpectedTextField = new javax.swing.JFormattedTextField(formatter); numOfResponsesExpectedLabel.setText(NUMBER_OF_RESPONSES_EXPECTED_LABEL); channeldataLabel.setText(CHANNELDATA_LABEL); eventNameLabel.setText(EVENT_NAME_LABEL); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(channeldataLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(eventNameLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(numOfResponsesExpectedLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(eventNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(channeldataAreaScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 469, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(channeldataAreaScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addGap(30, 30, 30).addComponent(channeldataLabel))) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(eventNameLabel).addComponent(eventNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(numOfResponsesExpectedLabel).addComponent(numOfResponsesExpectedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(540, Short.MAX_VALUE))); }
Example 13
Source File: ConversionPanel.java From marathonv5 with Apache License 2.0 | 4 votes |
ConversionPanel(Converter myController, String myTitle, Unit[] myUnits, ConverterRangeModel myModel) { if (MULTICOLORED) { setOpaque(true); setBackground(new Color(0, 255, 255)); } setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(myTitle), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Save arguments in instance variables. controller = myController; units = myUnits; title = myTitle; sliderModel = myModel; // Create the text field format, and then the text field. numberFormat = NumberFormat.getNumberInstance(); numberFormat.setMaximumFractionDigits(2); NumberFormatter formatter = new NumberFormatter(numberFormat); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true);// seems to be a no-op -- // aha -- it changes the value property but doesn't cause the result to // be parsed (that happens on focus loss/return, I think). // textField = new JFormattedTextField(formatter); textField.setColumns(10); textField.setValue(new Double(sliderModel.getDoubleValue())); textField.addPropertyChangeListener(this); // Add the combo box. unitChooser = new JComboBox(); for (int i = 0; i < units.length; i++) { // Populate it. unitChooser.addItem(units[i].description); } unitChooser.setSelectedIndex(0); sliderModel.setMultiplier(units[0].multiplier); unitChooser.addActionListener(this); // Add the slider. slider = new JSlider(sliderModel); sliderModel.addChangeListener(this); // Make the text field/slider group a fixed size // to make stacked ConversionPanels nicely aligned. JPanel unitGroup = new JPanel() { public Dimension getMinimumSize() { return getPreferredSize(); } public Dimension getPreferredSize() { return new Dimension(150, super.getPreferredSize().height); } public Dimension getMaximumSize() { return getPreferredSize(); } }; unitGroup.setLayout(new BoxLayout(unitGroup, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { unitGroup.setOpaque(true); unitGroup.setBackground(new Color(0, 0, 255)); } unitGroup.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); unitGroup.add(textField); unitGroup.add(slider); // Create a subpanel so the combo box isn't too tall // and is sufficiently wide. JPanel chooserPanel = new JPanel(); chooserPanel.setLayout(new BoxLayout(chooserPanel, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { chooserPanel.setOpaque(true); chooserPanel.setBackground(new Color(255, 0, 255)); } chooserPanel.add(unitChooser); chooserPanel.add(Box.createHorizontalStrut(100)); // Put everything together. setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(unitGroup); add(chooserPanel); unitGroup.setAlignmentY(TOP_ALIGNMENT); chooserPanel.setAlignmentY(TOP_ALIGNMENT); }
Example 14
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 15
Source File: DomBotEditor.java From DominionSim with MIT License | 4 votes |
private JPanel getBoardPanel() { final JPanel thePanel = new JPanel(); thePanel.setLayout( new GridBagLayout() ); // thePanel.setBorder( new TitledBorder( "" )); final GridBagConstraints theCons = DomGui.getGridBagConstraints( 2 ); //board cards thePanel.add(new JLabel("Board"),theCons); myBoardField = new JTextField(myChosenStrategy.getBoardString(), TEXT_FIELD_WIDTH); theCons.gridx++; thePanel.add(myBoardField,theCons); //bane card theCons.gridx=0; theCons.gridy++; theCons.fill=GridBagConstraints.NONE; thePanel.add(new JLabel("Bane Card"),theCons); myBaneField = new JTextField(myChosenStrategy.getBaneCardAsString(), 20); theCons.gridx++; thePanel.add(myBaneField,theCons); //Mountain Pass bid theCons.gridx=0; theCons.gridy++; theCons.fill=GridBagConstraints.NONE; thePanel.add(new JLabel("Mountain Pass bid"),theCons); NumberFormat format = NumberFormat.getInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMinimum(0); formatter.setMaximum(Integer.MAX_VALUE); // formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(false); myMountainPassBidField = new JFormattedTextField(formatter); myMountainPassBidField.setColumns(10); myMountainPassBidField.setValue(myChosenStrategy.getMountainPassBid(0)); theCons.gridx++; thePanel.add(myMountainPassBidField,theCons); //Obelisk card theCons.gridx=0; theCons.gridy++; theCons.fill=GridBagConstraints.NONE; thePanel.add(new JLabel("Obelisk choice"),theCons); myObeliskChoice = new JTextField(myChosenStrategy.getObeliskChoice(), 20); theCons.gridx++; thePanel.add(myObeliskChoice,theCons); //Shelters theCons.gridx=0; theCons.gridy++; theCons.fill=GridBagConstraints.NONE; myShelters = new JCheckBox("Shelters", myChosenStrategy.getShelters()); thePanel.add(myShelters,theCons); //info button JButton theInfoBTN = new JButton("Info"); theInfoBTN.setMnemonic('I'); theInfoBTN.addActionListener(this); theInfoBTN.setActionCommand("BoardInfo"); theCons.gridy++; theCons.fill=GridBagConstraints.NONE; theCons.anchor=GridBagConstraints.EAST; thePanel.add(theInfoBTN,theCons); return thePanel; }