Skip to content

Commit 897b138

Browse files
committed
Fix "show container name" checkbox
1 parent 3f774b5 commit 897b138

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/main/java/club/bytecode/the/jda/gui/MainViewerGUI.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -236,23 +236,7 @@ private void initializeMenubar() {
236236
settingsMenu.add(mntmFontSettings);
237237

238238
settingsMenu.add(new JSeparator());
239-
240-
mnShowContainer.setSelected(Settings.SHOW_CONTAINER_NAME.getBool());
241-
mnShowContainer.addItemListener(e -> {
242-
JTabbedPane tabs = fileViewerPane.tabs;
243-
Component[] components = tabs.getComponents();
244-
for (int i = 0; i < components.length; i++) {
245-
Component c = components[i];
246-
if (c instanceof Viewer) {
247-
((Viewer) c).updateName();
248-
int idx = tabs.indexOfComponent(c);
249-
tabs.setTabComponentAt(idx, new TabbedPane(c.getName(), tabs));
250-
fileViewerPane.tabs.setTitleAt(idx, c.getName());
251-
}
252-
}
253-
Settings.SHOW_CONTAINER_NAME.set(mnShowContainer.isSelected());
254-
});
255-
viewMenu.add(mnShowContainer);
239+
256240
mntmSetOptionalLibrary.addActionListener(e -> setOptionalLibrary());
257241
settingsMenu.add(mntmSetOptionalLibrary);
258242

@@ -281,6 +265,23 @@ private void initializeMenubar() {
281265
for (int i = 0; i < NUM_PANEL_GROUPS; i++)
282266
viewMenu.add(generatePane(i));
283267

268+
mnShowContainer.setSelected(Settings.SHOW_CONTAINER_NAME.getBool());
269+
mnShowContainer.addActionListener(e -> {
270+
Settings.SHOW_CONTAINER_NAME.set(mnShowContainer.isSelected());
271+
JTabbedPane tabs = fileViewerPane.tabs;
272+
Component[] components = tabs.getComponents();
273+
for (int i = 0; i < components.length; i++) {
274+
Component c = components[i];
275+
if (c instanceof Viewer) {
276+
((Viewer) c).updateName();
277+
int idx = tabs.indexOfComponent(c);
278+
tabs.setTabComponentAt(idx, new TabbedPane(c.getName(), tabs));
279+
fileViewerPane.tabs.setTitleAt(idx, c.getName());
280+
}
281+
}
282+
});
283+
viewMenu.add(mnShowContainer);
284+
284285
// ===========================================================================================
285286
// Windows menu
286287
// ===========================================================================================

0 commit comments

Comments
 (0)