prevent automatically scrolling to the bottom when mod details exceed window size

This commit is contained in:
Downforce Agent 2024-07-13 22:01:02 -05:00
parent f2786ee08a
commit 32a4e45638
3 changed files with 7 additions and 2 deletions

View File

@ -30,11 +30,12 @@
<color color="-1"/>
</border>
<children>
<scrollpane id="6e7e5">
<scrollpane id="6e7e5" binding="descriptionScroller">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<autoscrolls value="false"/>
<foreground color="-1"/>
<opaque value="false"/>
</properties>

View File

@ -20,6 +20,7 @@ import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.text.DefaultCaret;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -71,6 +72,7 @@ public class MissPiggy implements ActionListener {
private JButton importButton;
private JButton deployButton;
private JTextPane descriptionField;
private JScrollPane descriptionScroller;
//private int selectedItem;
@ -175,6 +177,8 @@ public class MissPiggy implements ActionListener {
importButton.setFont(Main.fExo2.deriveFont(Font.BOLD).deriveFont(12f));
deployButton.setFont(Main.fExo2.deriveFont(Font.BOLD).deriveFont(12f));
((DefaultCaret)descriptionField.getCaret()).setUpdatePolicy(DefaultCaret.NEVER_UPDATE); // prevent automatically scrolling to the bottom when mod details exceed window size
frame.setSize(800, 600); // 1280 800
frame.setMinimumSize(new Dimension(640,480));
frame.setTitle("Firestar Mod Manager");