Skip to content

Commit dbe7d46

Browse files
Changed ListOfFlashcardsDataPanel.java to have a FlowLayout instead.
1 parent c4e820b commit dbe7d46

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/frameworks_and_drivers/components/ListOfFlashcardsDataPanel.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,22 @@ public ListOfFlashcardsDataPanel(DBGateway dbGateway, List<FlashcardDsRequestMod
7474
}
7575
}
7676
//flashcardPanels customization
77-
flashcardPanels.setLayout(new FlowLayout());
78-
flashcardPanels.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
79-
flashcardPanels.setPreferredSize(new Dimension(1000,10000));
77+
int size = flashcardData.size();
78+
int rows;
79+
if (size % 3 == 0){
80+
rows = flashcardData.size()/3;
81+
}
82+
else{
83+
rows = flashcardData.size()/3 + 1;
84+
}
85+
flashcardPanels.setLayout(new GridLayout( rows, 3));
8086

8187
//This panel customization
8288
this.add(flashcardPanels);
8389
this.setLayout(new FlowLayout());
8490
this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
85-
this.setPreferredSize(new Dimension(1000, 10000));
91+
Dimension fcPSize = flashcardPanels.getPreferredSize();
92+
this.setPreferredSize(new Dimension(fcPSize.width, fcPSize.height + 100));
8693
}
8794

8895
/**

0 commit comments

Comments
 (0)