From f480583d9aa91d5edc14fc0ebe1d388fbd582dc5 Mon Sep 17 00:00:00 2001 From: metaprime Date: Thu, 17 Apr 2025 21:54:28 -0700 Subject: [PATCH] Add a ScrollView to hold the list of supported sites in the About dialog (Fixes #2104) (#2114) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../com/rarchives/ripme/ui/MainWindow.java | 77 ++++++++++--------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 0ac6ba29..35357830 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -1125,56 +1125,63 @@ public final class MainWindow implements Runnable, RipStatusHandler { trayMenuMain.addActionListener(arg0 -> toggleTrayClick()); MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle()); trayMenuAbout.addActionListener(arg0 -> { - StringBuilder about = new StringBuilder(); - - about.append("

").append(mainFrame.getTitle()).append("

"); - about.append("Download albums from various websites:"); try { - List rippers = Utils.getListOfAlbumRippers(); - about.append(""); - } catch (Exception e) { - LOGGER.warn(e.getMessage()); - } - about.append("
And download videos from video sites:"); - try { - List rippers = Utils.getListOfVideoRippers(); - about.append("
    "); - for (String ripper : rippers) { - about.append("
  • "); + aboutContent.append("\nDownload videos from video sites:\n"); + for (String ripper : videoRippers) { ripper = ripper.substring(ripper.lastIndexOf('.') + 1); if (ripper.contains("Ripper")) { ripper = ripper.substring(0, ripper.indexOf("Ripper")); } - about.append(ripper); - about.append("
  • "); + aboutContent.append("- ").append(ripper).append("\n"); + } + + aboutTextArea.setText(aboutContent.toString()); + + // Ensure the scroll pane starts at the top + SwingUtilities.invokeLater(() -> scrollPane.getVerticalScrollBar().setValue(0)); + + JPanel aboutPanel = new JPanel(new BorderLayout()); + JLabel titleLabel = new JLabel("Download albums and videos from various websites", JLabel.CENTER); + titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 16)); + aboutPanel.add(titleLabel, BorderLayout.NORTH); + aboutPanel.add(scrollPane, BorderLayout.CENTER); + + JLabel footerLabel = new JLabel("Do you want to visit the project homepage on GitHub?", JLabel.CENTER); + aboutPanel.add(footerLabel, BorderLayout.SOUTH); + + int response = JOptionPane.showConfirmDialog(null, aboutPanel, mainFrame.getTitle(), + JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon)); + if (response == JOptionPane.YES_OPTION) { + try { + Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme")); + } catch (IOException e) { + LOGGER.error("Exception while opening project home page", e); + } } - about.append("
"); } catch (Exception e) { LOGGER.warn(e.getMessage()); } - - about.append("Do you want to visit the project homepage on Github?"); - about.append(""); - int response = JOptionPane.showConfirmDialog(null, about.toString(), mainFrame.getTitle(), - JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon)); - if (response == JOptionPane.YES_OPTION) { - try { - Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme")); - } catch (IOException e) { - LOGGER.error("Exception while opening project home page", e); - } - } }); MenuItem trayMenuExit = new MenuItem(Utils.getLocalizedString("tray.exit"));