Skip to content

Commit 69378f7

Browse files
lawson89lawson89
authored andcommitted
convert to Sierra menus - cleanup
1 parent 54f5a18 commit 69378f7

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

sierra-previewer/src/main/java/org/httprpc/sierra/previewer/MainFrame.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ public class MainFrame extends JFrame {
5454

5555
// --- File Handling State ---
5656
private final JFileChooser fileChooser;
57-
private Path currentFilePath = null; // Stores the path of the currently loaded file
58-
57+
private Path currentFilePath = null;
5958
// --- UI Components (Injected by Sierra) ---
60-
@Outlet
61-
private JMenuBar menuBar;
59+
// Stores the path of the currently loaded file
6260

63-
@Outlet
64-
private JMenu fileMenu;
61+
@Outlet
62+
private JMenuBar menuBar;
6563

6664
@Outlet
6765
private JMenuItem openItem;
@@ -74,10 +72,7 @@ public class MainFrame extends JFrame {
7472

7573
@Outlet
7674
private JMenuItem exitItem;
77-
78-
@Outlet
79-
private JMenu aboutMenu;
80-
75+
8176
@Outlet
8277
private JMenuItem aboutItem;
8378

@@ -176,7 +171,6 @@ public void changedUpdate(DocumentEvent e) {
176171
* Creates and sets the application's menu bar.
177172
*/
178173
private void setupMenuBar() {
179-
menuBar = new JMenuBar();
180174

181175
// Open
182176
openItem.addActionListener(e -> {
@@ -196,9 +190,6 @@ private void setupMenuBar() {
196190
exitItem.addActionListener(e -> {
197191
System.exit(0); // Exit the application
198192
});
199-
fileMenu.add(exitItem);
200-
201-
menuBar.add(fileMenu);
202193

203194
// --- About Menu ---
204195
aboutItem.addActionListener(e -> {
@@ -212,7 +203,6 @@ private void setupMenuBar() {
212203
JOptionPane.INFORMATION_MESSAGE
213204
);
214205
});
215-
menuBar.add(aboutMenu);
216206

217207
this.setJMenuBar(menuBar);
218208
}

sierra-previewer/src/main/resources/org/httprpc/sierra/previewer/MainFrame.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
33
<column-panel>
44
<menu-bar name="menuBar">
5-
<menu name="fileMenu" text="File">
5+
<menu text="File">
66
<menu-item name="openItem" text="Open..."/>
77
<menu name="recentMenu" text="Recent"/>
88
<popup-menu-separator/>
99
<menu-item name="saveItem" text="Save"/>
1010
<popup-menu-separator/>
1111
<menu-item name="exitItem" text="Exit"/>
1212
</menu>
13-
<menu name="aboutMenu" text="About">
13+
<menu text="About">
1414
<menu-item name="aboutItem" text="About Previewer"/>
1515
</menu>
1616
</menu-bar>
1717

1818

1919
<row-panel weight="1">
2020

21-
<column-panel weight="1">
22-
23-
<scroll-pane name="editorScrollPane" weight="1"/>
24-
21+
<column-panel weight="1">
22+
<scroll-pane name="editorScrollPane" weight="1"/>
2523
</column-panel>
2624

2725

@@ -34,6 +32,7 @@
3432
</column-panel>
3533

3634
</row-panel>
35+
3736
<label name="filePathLabel" text="" padding="4, 6, 4, 6"/>
3837
<label name="statusBar" text="Ready." padding="2, 5, 2, 5"/>
3938
</column-panel>

0 commit comments

Comments
 (0)