diff options
author | Walker Selby <git@walkerselby.com> | 2023-12-17 14:04:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 15:04:44 +0100 |
commit | 75bcfde81d1494eaa41463e58e5767aa6d09b5a4 (patch) | |
tree | 3e38a03682776074571fa9b386449b66b79b6e7f /src/main/java | |
parent | 74b2f87726265bdf9fc78194be7836e8ff54fd79 (diff) | |
download | skyhanni-75bcfde81d1494eaa41463e58e5767aa6d09b5a4.tar.gz skyhanni-75bcfde81d1494eaa41463e58e5767aa6d09b5a4.tar.bz2 skyhanni-75bcfde81d1494eaa41463e58e5767aa6d09b5a4.zip |
Refactor Duplicate Code (#669)
Refactor Duplicate Code #669
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/SkyHanniInstallerFrame.java | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/main/java/SkyHanniInstallerFrame.java b/src/main/java/SkyHanniInstallerFrame.java index a1c0e3e50..dee06da43 100644 --- a/src/main/java/SkyHanniInstallerFrame.java +++ b/src/main/java/SkyHanniInstallerFrame.java @@ -213,14 +213,7 @@ public class SkyHanniInstallerFrame extends JFrame implements ActionListener, Mo descriptionText = new JTextArea(); descriptionText.setName("TextArea"); - descriptionText.setBounds(x + margin, y + margin, w - margin * 2, h - margin); - descriptionText.setEditable(false); - descriptionText.setHighlighter(null); - descriptionText.setEnabled(true); - descriptionText.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); - descriptionText.setLineWrap(true); - descriptionText.setOpaque(false); - descriptionText.setPreferredSize(new Dimension(w - margin * 2, h - margin)); + setStandardFormatting(descriptionText); descriptionText.setText( "This installer will copy SkyHanni into your forge mods folder for you, and replace any old versions that already exist. " + "Close this if you prefer to do this yourself!"); @@ -234,6 +227,17 @@ public class SkyHanniInstallerFrame extends JFrame implements ActionListener, Mo return descriptionText; } + private void setStandardFormatting(JTextArea descriptionText) { + descriptionText.setBounds(x + margin, y + margin, w - margin * 2, h - margin); + descriptionText.setEditable(false); + descriptionText.setHighlighter(null); + descriptionText.setEnabled(true); + descriptionText.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); + descriptionText.setLineWrap(true); + descriptionText.setOpaque(false); + descriptionText.setPreferredSize(new Dimension(w - margin * 2, h - margin)); + } + private JTextArea getForgeTextArea() { if (forgeDescriptionText == null) { try { @@ -242,14 +246,7 @@ public class SkyHanniInstallerFrame extends JFrame implements ActionListener, Mo forgeDescriptionText = new JTextArea(); forgeDescriptionText.setName("TextAreaForge"); - forgeDescriptionText.setBounds(x + margin, y + margin, w - margin * 2, h - margin); - forgeDescriptionText.setEditable(false); - forgeDescriptionText.setHighlighter(null); - forgeDescriptionText.setEnabled(true); - forgeDescriptionText.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); - forgeDescriptionText.setLineWrap(true); - forgeDescriptionText.setOpaque(false); - forgeDescriptionText.setPreferredSize(new Dimension(w - margin * 2, h - margin)); + setStandardFormatting(forgeDescriptionText); forgeDescriptionText.setText( "However, you still need to install Forge client in order to be able to run this mod. Click here to visit the download page for Forge 1.8.9!"); forgeDescriptionText.setForeground(Color.BLUE.darker()); |