diff --git a/form/src/org/netbeans/modules/form/Bundle.properties b/form/src/org/netbeans/modules/form/Bundle.properties --- a/form/src/org/netbeans/modules/form/Bundle.properties +++ b/form/src/org/netbeans/modules/form/Bundle.properties @@ -94,6 +94,7 @@ HINT_ASSISTANT_SHOWN=If selected, the assistant is shown in the designer. PROP_GENERATE_FQN=Generate Full Classnames HINT_GENERATE_FQN=If selected then fully qualified names of classes are generated. +HINT_GRID_SIZE=The grid size of the form. # form toolbar CTL_SelectionButtonHint=Selection Mode @@ -757,6 +758,7 @@ Selection_Border_Color=Selection &Border Color: Guiding_Line_Color=Guiding Line &Color: Generate_FQN=Generate Fully &Qualified Names of Classes +Grid_Size=Grid Size: MSG_Paiting_Exception=The following exception has been thrown during painting of the form. \ Use the Inspector window to fix or remove the problematic component. diff --git a/form/src/org/netbeans/modules/form/FormEditorCustomizer.java b/form/src/org/netbeans/modules/form/FormEditorCustomizer.java --- a/form/src/org/netbeans/modules/form/FormEditorCustomizer.java +++ b/form/src/org/netbeans/modules/form/FormEditorCustomizer.java @@ -58,7 +58,9 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; +import javax.swing.JSpinner; import javax.swing.LayoutStyle; +import javax.swing.SpinnerNumberModel; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -84,6 +86,7 @@ private JComboBox cbComponentNames = new JComboBox (); private JComboBox cbListenerStyle = new JComboBox (); private JComboBox cbAutoI18n = new JComboBox(); + private JSpinner spGridSize = new JSpinner(new SpinnerNumberModel(10, 2, 100, 1)); private PropertyPanel guideLineColEditor = new PropertyPanel(); private PropertyPanel selectionBorderColEditor = new PropertyPanel(); @@ -124,6 +127,7 @@ JLabel guideLineColLabel = new JLabel(); JLabel listenerStyleLabel = new JLabel(); JLabel autoI18nLabel = new JLabel(); + JLabel gridSizeLabel = new JLabel(); loc(variableModifierLabel, "Variable_Modifier"); // NOI18N loc(layoutStyleLabel, "Layout_Style"); // NOI18N loc(componentNamesLabel,"Component_Names"); // NOI18N @@ -131,6 +135,7 @@ loc(autoI18nLabel, "Auto_I18n"); // NOI18N loc(selectionBorderColLabel, "Selection_Border_Color"); // NOI18N loc(guideLineColLabel, "Guiding_Line_Color"); // NOI18N + loc(gridSizeLabel, "Grid_Size"); // NOI18N generateComponetsLabel.setToolTipText(loc("Generate_Components_Hint")); // NOI18N variableModifierLabel.setToolTipText(loc("HINT_VARIABLES_MODIFIER")); // NOI18N @@ -140,6 +145,7 @@ autoI18nLabel.setToolTipText(loc("HINT_AUTO_RESOURCE_GLOBAL")); // NOI18N guideLineColLabel.setToolTipText(loc("HINT_GUIDING_LINE_COLOR")); // NOI18N selectionBorderColLabel.setToolTipText(loc("HINT_SELECTION_BORDER_COLOR")); // NOI18N + gridSizeLabel.setToolTipText(loc("HINT_GRID_SIZE")); // NOI18N cbFold.setToolTipText(loc("HINT_FOLD_GENERATED_CODE")); // NOI18N cbAssistant.setToolTipText(loc("HINT_ASSISTANT_SHOWN")); // NOI18N cbFQN.setToolTipText(loc("HINT_GENERATE_FQN")); // NOI18N @@ -153,6 +159,7 @@ autoI18nLabel.setLabelFor(cbAutoI18n); guideLineColLabel.setLabelFor(guideLineColEditor); selectionBorderColLabel.setLabelFor(selectionBorderColEditor); + gridSizeLabel.setLabelFor(spGridSize); GroupLayout layout = new GroupLayout(this); setLayout(layout); @@ -167,7 +174,8 @@ .addComponent(listenerStyleLabel) .addComponent(autoI18nLabel) .addComponent(guideLineColLabel) - .addComponent(selectionBorderColLabel)) + .addComponent(selectionBorderColLabel) + .addComponent(gridSizeLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(rbGenerateLocals) @@ -181,7 +189,8 @@ .addComponent(cbListenerStyle, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cbAutoI18n, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(guideLineColEditor, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(selectionBorderColEditor, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(selectionBorderColEditor, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spGridSize, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, 40)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( @@ -225,6 +234,10 @@ .addComponent(selectionBorderColLabel, GroupLayout.Alignment.CENTER) .addComponent(selectionBorderColEditor, GroupLayout.Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(gridSizeLabel, GroupLayout.Alignment.CENTER) + .addComponent(spGridSize, GroupLayout.Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addContainerGap() ); setBorder(new TitledBorder(loc("Code_Generation"))); // NOI18N @@ -239,6 +252,7 @@ rbGenerateFields.addActionListener (this); rbGenerateLocals.addActionListener (this); cbAutoI18n.addActionListener(this); + spGridSize.addChangeListener(this); } private static String loc (String key) { @@ -296,6 +310,7 @@ cbLayoutStyle.setSelectedIndex(options.getLayoutCodeTarget()); cbComponentNames.setSelectedIndex(options.getAutoSetComponentName()); cbAutoI18n.setSelectedIndex(options.getI18nAutoMode()); + spGridSize.setValue(options.getGridX()); listen = true; changed = false; } @@ -311,6 +326,8 @@ options.setAutoSetComponentName(cbComponentNames.getSelectedIndex()); options.setI18nAutoMode(cbAutoI18n.getSelectedIndex()); options.setVariablesLocal (rbGenerateLocals.isSelected ()); + options.setGridX((Integer) spGridSize.getValue()); + options.setGridY((Integer) spGridSize.getValue()); switch (cbModifier.getSelectedIndex ()) { case 0: options.setVariablesModifier (Modifier.PUBLIC); break; diff --git a/form/src/org/netbeans/modules/form/FormLoaderSettings.java b/form/src/org/netbeans/modules/form/FormLoaderSettings.java --- a/form/src/org/netbeans/modules/form/FormLoaderSettings.java +++ b/form/src/org/netbeans/modules/form/FormLoaderSettings.java @@ -74,10 +74,8 @@ /** Property name of the formDesignerBorderColor property */ public static final String PROP_FORMDESIGNER_BORDER_COLOR = "formDesignerBorderColor"; // NOI18N - /** Property name of the gridX property */ - public static final String PROP_GRID_X = "gridX"; // NOI18N - /** Property name of the gridY property */ - public static final String PROP_GRID_Y = "gridY"; // NOI18N + /** Property name of the gridSize property */ + public static final String PROP_GRID_SIZE = "gridSize"; // NOI18N /** Property name of the applyGridToPosition property */ public static final String PROP_APPLY_GRID_TO_POSITION = "applyGridToPosition"; // NOI18N /** Property name of the applyGridToSize property */ @@ -290,7 +288,7 @@ * @return size of horizontal grid. */ public int getGridX() { - return getPreferences().getInt(PROP_GRID_X, 10); + return getPreferences().getInt(PROP_GRID_SIZE, 10); } /** @@ -300,7 +298,7 @@ */ public void setGridX(int value) { if (value < MIN_GRID_X) value = MIN_GRID_X; - getPreferences().putInt(PROP_GRID_X, value); + getPreferences().putInt(PROP_GRID_SIZE, value); } /** @@ -309,7 +307,7 @@ * @return size of vertical grid. */ public int getGridY() { - return getPreferences().getInt(PROP_GRID_Y, 10); + return getPreferences().getInt(PROP_GRID_SIZE, 10); } /** @@ -319,7 +317,7 @@ */ public void setGridY(int value) { if (value < MIN_GRID_Y) value = MIN_GRID_Y; - getPreferences().putInt(PROP_GRID_Y, value); + getPreferences().putInt(PROP_GRID_SIZE, value); } /**