|
1 | 1 | package com.georgev22.cosmicjars; |
2 | 2 |
|
| 3 | +import com.georgev22.cosmicjars.gui.ConfigPopup; |
3 | 4 | import com.georgev22.cosmicjars.gui.HistoryTextField; |
4 | 5 | import com.georgev22.cosmicjars.gui.SmartScroller; |
5 | 6 | import com.georgev22.cosmicjars.helpers.MinecraftServer; |
6 | 7 | import com.georgev22.cosmicjars.utilities.ConsoleOutputHandler; |
| 8 | +import com.georgev22.cosmicjars.utilities.Utils; |
7 | 9 | import org.jetbrains.annotations.Contract; |
8 | 10 | import org.jetbrains.annotations.NotNull; |
9 | 11 | import org.jfree.chart.*; |
@@ -41,6 +43,46 @@ public CosmicJarsFrame() { |
41 | 43 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
42 | 44 | setSize(1400, 600); |
43 | 45 |
|
| 46 | + JMenuBar menuBar = new JMenuBar(); |
| 47 | + JMenu fileMenu = new JMenu("File"); |
| 48 | + JMenu helpMenu = new JMenu("Help"); |
| 49 | + |
| 50 | + JMenuItem exitItem = new JMenuItem("Exit"); |
| 51 | + exitItem.addActionListener(e -> System.exit(0)); |
| 52 | + fileMenu.add(exitItem); |
| 53 | + JMenuItem configItem = new JMenuItem("Config"); |
| 54 | + configItem.addActionListener(e -> ConfigPopup.showConfigPopup()); |
| 55 | + fileMenu.add(configItem); |
| 56 | + |
| 57 | + JMenuItem aboutItem = new JMenuItem("About"); |
| 58 | + |
| 59 | + aboutItem.addActionListener(e -> { |
| 60 | + String version = Utils.getManifestValue("Version"); |
| 61 | + String branch = Utils.getManifestValue("Git-Branch"); |
| 62 | + String commit = Utils.getManifestValue("Git-Hash"); |
| 63 | + String repoUrl = Utils.getManifestValue("Git-Repo"); |
| 64 | + |
| 65 | + String aboutMessage = String.format( |
| 66 | + """ |
| 67 | + CosmicJars %s |
| 68 | + Developed by GeorgeV22 |
| 69 | + |
| 70 | + Branch: %s |
| 71 | + Commit: %s |
| 72 | + GitHub: %s |
| 73 | + |
| 74 | + Special thanks to JetBrains for their amazing tools!""", |
| 75 | + version, branch, commit, repoUrl |
| 76 | + ); |
| 77 | + |
| 78 | + JOptionPane.showMessageDialog(this, aboutMessage, "About", JOptionPane.INFORMATION_MESSAGE); |
| 79 | + }); |
| 80 | + helpMenu.add(aboutItem); |
| 81 | + |
| 82 | + menuBar.add(fileMenu); |
| 83 | + menuBar.add(helpMenu); |
| 84 | + setJMenuBar(menuBar); |
| 85 | + |
44 | 86 | JPanel mainPanel = new JPanel(new BorderLayout()); |
45 | 87 |
|
46 | 88 | JPanel consolePanel = new JPanel(new BorderLayout()); |
|
0 commit comments