From 13321e3c1b32ee9027086b3f9fa650bfcbe43e0e Mon Sep 17 00:00:00 2001 From: Fulvio Ieva Date: Thu, 17 Jul 2014 13:41:48 +0200 Subject: [PATCH] Change layout in Find/Replace dialog to render correctly on Linux see #2070 --- app/src/processing/app/FindReplace.java | 37 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/FindReplace.java b/app/src/processing/app/FindReplace.java index bf0147fd0..137018b90 100644 --- a/app/src/processing/app/FindReplace.java +++ b/app/src/processing/app/FindReplace.java @@ -77,20 +77,35 @@ public class FindReplace extends JFrame implements ActionListener { setResizable(false); this.editor = editor; + + FlowLayout searchLayout = new FlowLayout(FlowLayout.RIGHT,5,0); Container pain = getContentPane(); - pain.setLayout(null); + pain.setLayout(searchLayout); JLabel findLabel = new JLabel(_("Find:")); JLabel replaceLabel = new JLabel(_("Replace with:")); Dimension labelDimension = replaceLabel.getPreferredSize(); + + JPanel find = new JPanel(); - pain.add(findLabel); - pain.add(replaceLabel); + find.add(findLabel); + + find.add(findField = new JTextField(20)); + + pain.add(find); + + JPanel replace = new JPanel(); + + replace.add(replaceLabel); - pain.add(findField = new JTextField(20)); - pain.add(replaceField = new JTextField(20)); + replace.add(replaceField = new JTextField(20)); + + pain.add(replace); + int fieldHeight = findField.getPreferredSize().height; + JPanel checkbox = new JPanel(); + // Fill the findString with selected text if no previous value if(editor.getSelectedText()!=null && editor.getSelectedText().length()>0) findString = editor.getSelectedText(); @@ -107,7 +122,7 @@ public class FindReplace extends JFrame implements ActionListener { } }); ignoreCaseBox.setSelected(ignoreCase); - pain.add(ignoreCaseBox); + checkbox.add(ignoreCaseBox); wrapAroundBox = new JCheckBox(_("Wrap Around")); wrapAroundBox.addActionListener(new ActionListener() { @@ -116,7 +131,7 @@ public class FindReplace extends JFrame implements ActionListener { } }); wrapAroundBox.setSelected(wrapAround); - pain.add(wrapAroundBox); + checkbox.add(wrapAroundBox); searchAllFilesBox = new JCheckBox(_("Search all Sketch Tabs")); searchAllFilesBox.addActionListener(new ActionListener() { @@ -125,11 +140,13 @@ public class FindReplace extends JFrame implements ActionListener { } }); searchAllFilesBox.setSelected(searchAllFiles); - pain.add(searchAllFilesBox); + checkbox.add(searchAllFilesBox); + pain.add(checkbox); + JPanel buttons = new JPanel(); - buttons.setLayout(new FlowLayout(FlowLayout.CENTER,BUTTONGAP,0)); + buttons.setLayout(new FlowLayout(FlowLayout.CENTER,BUTTONGAP,0)); // ordering is different on mac versus pc if (Base.isMacOS()) { @@ -211,7 +228,7 @@ public class FindReplace extends JFrame implements ActionListener { buttons.setBounds(EDGE-BUTTONGAP, ypos, buttonsDimension.width, buttonsDimension.height); - ypos += buttonsDimension.height + EDGE; + ypos += buttonsDimension.height; // Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();