MCPcopy Create free account
hub / github.com/benfry/processing4 / FindReplace

Method FindReplace

app/src/processing/app/ui/FindReplace.java:68–238  ·  view source on GitHub ↗
(Editor editor)

Source from the content-addressed store, hash-verified

66
67
68 public FindReplace(Editor editor) {
69 super(Language.text("find"));
70 this.editor = editor;
71
72 Container pain = getContentPane();
73
74 JLabel findLabel = new JLabel(Language.text("find.find"));
75 JLabel replaceLabel = new JLabel(Language.text("find.replace_with"));
76 findField = new JTextField();
77 replaceField = new JTextField();
78
79 if (findString != null) findField.setText(findString);
80 if (replaceString != null) replaceField.setText(replaceString);
81
82 ignoreCaseBox = new JCheckBox(Language.text("find.ignore_case"));
83 ignoreCaseBox.addActionListener(e -> ignoreCase = ignoreCaseBox.isSelected());
84 ignoreCaseBox.setSelected(ignoreCase);
85
86 allTabsBox = new JCheckBox(Language.text("find.all_tabs"));
87 allTabsBox.addActionListener(e -> allTabs = allTabsBox.isSelected());
88 allTabsBox.setSelected(allTabs);
89 allTabsBox.setEnabled(true);
90
91 wrapAroundBox = new JCheckBox(Language.text("find.wrap_around"));
92 wrapAroundBox.addActionListener(e -> wrapAround = wrapAroundBox.isSelected());
93 wrapAroundBox.setSelected(wrapAround);
94
95 GroupLayout layout = new GroupLayout(pain);
96 pain.setLayout(layout);
97 layout.setAutoCreateGaps(true);
98 layout.setAutoCreateContainerGaps(true);
99
100 // To hold the buttons in the specified order depending on the OS
101 Group buttonsHorizontalGroup = layout.createSequentialGroup();
102
103 replaceAllButton = new JButton(Language.text("find.btn.replace_all"));
104 replaceButton = new JButton(Language.text("find.btn.replace"));
105 replaceAndFindButton = new JButton(Language.text("find.btn.replace_and_find"));
106 previousButton = new JButton(Language.text("find.btn.previous"));
107 findButton = new JButton(Language.text("find.btn.find"));
108
109 // ordering is different on mac versus pc
110 if (Platform.isMacOS()) {
111 buttonsHorizontalGroup.addComponent(replaceAllButton)
112 .addComponent(replaceButton)
113 .addComponent(replaceAndFindButton)
114 .addComponent(previousButton)
115 .addComponent(findButton);
116
117 } else {
118 buttonsHorizontalGroup.addComponent(findButton)
119 .addComponent(previousButton)
120 .addComponent(replaceAndFindButton)
121 .addComponent(replaceButton)
122 .addComponent(replaceAllButton);
123 }
124 setFound(false);
125

Callers

nothing calls this directly

Calls 15

textMethod · 0.95
isMacOSMethod · 0.95
setFoundMethod · 0.95
getScreenSizeMethod · 0.95
replaceMethod · 0.95
replaceAllMethod · 0.95
replaceAndFindNextMethod · 0.95
applyActionMethod · 0.95
handleCloseMethod · 0.95
setIconMethod · 0.95
setSelectedMethod · 0.80

Tested by

no test coverage detected