Skip to content

Commit

Permalink
Adding JScrollPane to TKPartPicker
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyThermal committed Oct 25, 2019
1 parent 9017b51 commit 86e33bc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/com/gamemode/tkviewer/gui/TKPartPickerGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class TKPartPickerGUI extends JFrame implements ActionListener {
JComboBox partPicker;
ImageIcon viewerIcon;

JScrollPane partScroller;
JPanel partPanel;

Integer tickValue = 0;
Expand Down Expand Up @@ -135,11 +136,15 @@ public void initPanel() {

// Add Part Panel
partPanel = new JPanel(new FlowLayout());
partPanel.setBorder(BorderFactory.createLineBorder(Color.gray));
partPanel.setPreferredSize(new Dimension(800, 600));

partScroller = new JScrollPane(partPanel);
updatePartPanel("Bodies", 0);

// Add content to the panel
contentPanel.add(viewerPanel);
contentPanel.add(partPanel);
contentPanel.add(partScroller);

// Add the content panel to the parent JFrame (this)
this.add(contentPanel);
Expand Down Expand Up @@ -190,6 +195,7 @@ public void mouseExited(MouseEvent e) {}
}

public void syncParts(String partKey) {
PartInfo partInfo = this.characterPartInfo.get(partKey);
if (partKey.equals("Helmets")) {
this.characterPartInfo.get("Hair").setShouldRender(false);
} else if (partKey.equals("Hair")) {
Expand All @@ -204,7 +210,7 @@ public void syncParts(String partKey) {
this.characterPartInfo.get("Spears").setShouldRender(false);
this.characterPartInfo.get("Swords").setShouldRender(false);
} else if (partKey.equals("Fans")) {
if (this.characterPartInfo.get("Bodies").getShouldRender()) {
if (partInfo.getShouldRender()) {
this.characterPartInfo.get("Bodies").setAnimationIndex(6);
this.characterPartInfo.get("Coats").setAnimationIndex(6);
} else {
Expand All @@ -218,7 +224,7 @@ public void syncParts(String partKey) {
this.characterPartInfo.get("Bows").setShouldRender(false);
this.characterPartInfo.get("Spears").setShouldRender(false);
} else if (partKey.equals("Spears")) {
if (this.characterPartInfo.get("Bodies").getShouldRender()) {
if (partInfo.getShouldRender()) {
this.characterPartInfo.get("Bodies").setAnimationIndex(6);
this.characterPartInfo.get("Coats").setAnimationIndex(6);
} else {
Expand All @@ -231,7 +237,7 @@ public void syncParts(String partKey) {
this.characterPartInfo.get("Spears").setShouldRender(false);
this.characterPartInfo.get("Swords").setShouldRender(false);
} else if (partKey.equals("Swords")) {
if (this.characterPartInfo.get("Bodies").getShouldRender()) {
if (partInfo.getShouldRender()) {
this.characterPartInfo.get("Bodies").setAnimationIndex(6);
this.characterPartInfo.get("Coats").setAnimationIndex(6);
} else {
Expand Down

0 comments on commit 86e33bc

Please sign in to comment.