Skip to content

Commit 13321e3

Browse files
fulvioievacmaglie
authored andcommitted
Change layout in Find/Replace dialog to render correctly on Linux
see #2070
1 parent 064fc45 commit 13321e3

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

app/src/processing/app/FindReplace.java

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,35 @@ public FindReplace(Editor editor) {
7777
setResizable(false);
7878
this.editor = editor;
7979

80+
81+
FlowLayout searchLayout = new FlowLayout(FlowLayout.RIGHT,5,0);
8082
Container pain = getContentPane();
81-
pain.setLayout(null);
83+
pain.setLayout(searchLayout);
8284

8385
JLabel findLabel = new JLabel(_("Find:"));
8486
JLabel replaceLabel = new JLabel(_("Replace with:"));
8587
Dimension labelDimension = replaceLabel.getPreferredSize();
88+
89+
JPanel find = new JPanel();
8690

87-
pain.add(findLabel);
88-
pain.add(replaceLabel);
91+
find.add(findLabel);
92+
93+
find.add(findField = new JTextField(20));
94+
95+
pain.add(find);
96+
97+
JPanel replace = new JPanel();
98+
99+
replace.add(replaceLabel);
89100

90-
pain.add(findField = new JTextField(20));
91-
pain.add(replaceField = new JTextField(20));
101+
replace.add(replaceField = new JTextField(20));
102+
103+
pain.add(replace);
104+
92105
int fieldHeight = findField.getPreferredSize().height;
93106

107+
JPanel checkbox = new JPanel();
108+
94109
// Fill the findString with selected text if no previous value
95110
if(editor.getSelectedText()!=null && editor.getSelectedText().length()>0)
96111
findString = editor.getSelectedText();
@@ -107,7 +122,7 @@ public void actionPerformed(ActionEvent e) {
107122
}
108123
});
109124
ignoreCaseBox.setSelected(ignoreCase);
110-
pain.add(ignoreCaseBox);
125+
checkbox.add(ignoreCaseBox);
111126

112127
wrapAroundBox = new JCheckBox(_("Wrap Around"));
113128
wrapAroundBox.addActionListener(new ActionListener() {
@@ -116,7 +131,7 @@ public void actionPerformed(ActionEvent e) {
116131
}
117132
});
118133
wrapAroundBox.setSelected(wrapAround);
119-
pain.add(wrapAroundBox);
134+
checkbox.add(wrapAroundBox);
120135

121136
searchAllFilesBox = new JCheckBox(_("Search all Sketch Tabs"));
122137
searchAllFilesBox.addActionListener(new ActionListener() {
@@ -125,11 +140,13 @@ public void actionPerformed(ActionEvent e) {
125140
}
126141
});
127142
searchAllFilesBox.setSelected(searchAllFiles);
128-
pain.add(searchAllFilesBox);
143+
checkbox.add(searchAllFilesBox);
129144

145+
pain.add(checkbox);
146+
130147
JPanel buttons = new JPanel();
131148

132-
buttons.setLayout(new FlowLayout(FlowLayout.CENTER,BUTTONGAP,0));
149+
buttons.setLayout(new FlowLayout(FlowLayout.CENTER,BUTTONGAP,0));
133150

134151
// ordering is different on mac versus pc
135152
if (Base.isMacOS()) {
@@ -211,7 +228,7 @@ public void focusLost(FocusEvent e) {
211228
buttons.setBounds(EDGE-BUTTONGAP, ypos,
212229
buttonsDimension.width, buttonsDimension.height);
213230

214-
ypos += buttonsDimension.height + EDGE;
231+
ypos += buttonsDimension.height;
215232

216233
// Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
217234

0 commit comments

Comments
 (0)