Skip to content

Commit 3ae4d59

Browse files
committed
set default button in the Rename dialog (fixes processing#5400)
1 parent 7078199 commit 3ae4d59

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

java/src/processing/mode/java/pdex/Rename.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,20 @@ public void componentHidden(ComponentEvent e) {
140140
}
141141
}
142142
});
143+
rootPane.setDefaultButton(renameButton);
143144

144145
//JPanel panelBottom = new JPanel();
145146
//panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.X_AXIS));
146-
Box panelBottom = Box.createHorizontalBox();
147+
Box buttonBox = Box.createHorizontalBox();
147148
//Toolkit.setBorder(panelBottom, 5, 5, 5, 5);
148149

149-
panelBottom.add(Box.createHorizontalGlue());
150-
panelBottom.add(showUsageButton);
150+
buttonBox.add(Box.createHorizontalGlue());
151+
buttonBox.add(showUsageButton);
151152
if (!Platform.isMacOS()) {
152-
panelBottom.add(Box.createHorizontalStrut(GAP));
153+
buttonBox.add(Box.createHorizontalStrut(GAP));
153154
}
154-
panelBottom.add(renameButton);
155-
panelBottom.add(Box.createHorizontalGlue());
155+
buttonBox.add(renameButton);
156+
buttonBox.add(Box.createHorizontalGlue());
156157

157158
Dimension showDim = showUsageButton.getPreferredSize();
158159
Dimension renameDim = renameButton.getPreferredSize();
@@ -161,7 +162,7 @@ public void componentHidden(ComponentEvent e) {
161162
showUsageButton.setPreferredSize(buttonDim);
162163
renameButton.setPreferredSize(buttonDim);
163164

164-
windowBox.add(panelBottom);
165+
windowBox.add(buttonBox);
165166

166167
//window.add(panelBottom);
167168
}
@@ -184,7 +185,7 @@ void handleRename() {
184185
// Thread: worker
185186
void handleRename(PreprocessedSketch ps, int tabIndex, int startTabOffset, int stopTabOffset) {
186187
if (ps.hasSyntaxErrors) {
187-
editor.statusMessage("Can't perform action until syntax errors are fixed",
188+
editor.statusMessage("Cannot rename until syntax errors are fixed",
188189
EditorStatus.WARNING);
189190
return;
190191
}

0 commit comments

Comments
 (0)