diff --git a/game-core/src/main/java/games/strategy/triplea/ui/NotesPanel.java b/game-core/src/main/java/games/strategy/triplea/ui/NotesPanel.java deleted file mode 100644 index c4477946d24..00000000000 --- a/game-core/src/main/java/games/strategy/triplea/ui/NotesPanel.java +++ /dev/null @@ -1,26 +0,0 @@ -package games.strategy.triplea.ui; - -import java.awt.Color; -import javax.swing.JEditorPane; -import javax.swing.JScrollPane; -import org.triplea.util.LocalizeHtml; - -/** Wrapper class to display game related notes in a swing component. */ -public class NotesPanel extends JScrollPane { - private static final long serialVersionUID = 2746643868463714526L; - - public NotesPanel(final String trimmedNotes) { - super( - createNotesPane( - LocalizeHtml.localizeImgLinksInHtml( - trimmedNotes, UiContext.getResourceLoader().getMapLocation()))); - } - - private static JEditorPane createNotesPane(final String html) { - final JEditorPane gameNotesPane = new JEditorPane("text/html", html); - gameNotesPane.setEditable(false); - gameNotesPane.setForeground(Color.BLACK); - gameNotesPane.setCaretPosition(0); - return gameNotesPane; - } -} diff --git a/game-core/src/main/java/games/strategy/triplea/ui/TripleAFrame.java b/game-core/src/main/java/games/strategy/triplea/ui/TripleAFrame.java index 60f9cb28056..75fc50da589 100644 --- a/game-core/src/main/java/games/strategy/triplea/ui/TripleAFrame.java +++ b/game-core/src/main/java/games/strategy/triplea/ui/TripleAFrame.java @@ -190,7 +190,6 @@ public final class TripleAFrame extends JFrame implements QuitHandler { private final StatPanel statsPanel; private final EconomyPanel economyPanel; private ObjectivePanel objectivePanel; - private final NotesPanel notesPanel; @Getter private final TerritoryDetailPanel territoryDetails; private final JPanel historyComponent = new JPanel(); private final JPanel gameSouthPanel; @@ -597,8 +596,6 @@ public void focusGained(final FocusEvent e) { } else { addTab(objectivePanel.getName(), objectivePanel, KeyCode.O); } - notesPanel = new NotesPanel(data.getProperties().get("notes", "").trim()); - addTab("Notes", notesPanel, KeyCode.N); territoryDetails = new TerritoryDetailPanel(mapPanel, data, uiContext, this); addTab("Territory", territoryDetails, KeyCode.T); editPanel = new EditPanel(data, mapPanel, this); @@ -2070,7 +2067,6 @@ private void showHistory() { if (objectivePanel != null && !objectivePanel.isEmpty()) { addTab(objectivePanel.getName(), objectivePanel, KeyCode.O); } - addTab("Notes", notesPanel, KeyCode.N); addTab("Territory", territoryDetails, KeyCode.T); if (mapPanel.getEditMode()) { tabsPanel.add("Edit", editPanel); @@ -2259,7 +2255,6 @@ private void showGame() { if (objectivePanel != null && !objectivePanel.isEmpty()) { addTab(objectivePanel.getName(), objectivePanel, KeyCode.O); } - addTab("Notes", notesPanel, KeyCode.N); addTab("Territory", territoryDetails, KeyCode.T); if (mapPanel.getEditMode()) { tabsPanel.add("Edit", editPanel); diff --git a/game-core/src/main/java/games/strategy/triplea/ui/menubar/help/GameNotesMenu.java b/game-core/src/main/java/games/strategy/triplea/ui/menubar/help/GameNotesMenu.java index 3f10cc05098..981fb120b7c 100644 --- a/game-core/src/main/java/games/strategy/triplea/ui/menubar/help/GameNotesMenu.java +++ b/game-core/src/main/java/games/strategy/triplea/ui/menubar/help/GameNotesMenu.java @@ -1,11 +1,16 @@ package games.strategy.triplea.ui.menubar.help; -import games.strategy.triplea.ui.NotesPanel; +import games.strategy.triplea.ui.UiContext; +import java.awt.Color; import javax.swing.Action; +import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JEditorPane; import javax.swing.SwingUtilities; import lombok.experimental.UtilityClass; import org.triplea.swing.SwingAction; +import org.triplea.swing.SwingComponents; +import org.triplea.util.LocalizeHtml; @UtilityClass class GameNotesMenu { @@ -18,7 +23,7 @@ Action buildMenu(final String gameNotes) { SwingUtilities.invokeLater( () -> { final JDialog dialog = - InformationDialog.createDialog(new NotesPanel(gameNotes), gameNotesTitle); + InformationDialog.createDialog(notesPanel(gameNotes), gameNotesTitle); if (dialog.getWidth() < 400) { dialog.setSize(400, dialog.getHeight()); } @@ -34,4 +39,16 @@ Action buildMenu(final String gameNotes) { dialog.setVisible(true); })); } + + private static JComponent notesPanel(final String gameNotes) { + final String localizedHtml = + LocalizeHtml.localizeImgLinksInHtml( + gameNotes.trim(), UiContext.getResourceLoader().getMapLocation()); + + final JEditorPane gameNotesPane = new JEditorPane("text/html", localizedHtml); + gameNotesPane.setEditable(false); + gameNotesPane.setForeground(Color.BLACK); + gameNotesPane.setCaretPosition(0); + return SwingComponents.newJScrollPane(gameNotesPane); + } }