package org.leumasjaffe.charsheet.view.summary; import javax.swing.JPanel; import org.leumasjaffe.charsheet.entity.AbilityScores; import org.leumasjaffe.charsheet.entity.DDCharacter; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Dimension; public class ResistancePanel extends JPanel { /** * */ private static final long serialVersionUID = 1L; private ResistanceLine fortitude; private ResistanceLine reflex; private ResistanceLine will; public ResistancePanel() { setMaximumSize(new Dimension(400, 75)); setMinimumSize(new Dimension(400, 74)); setPreferredSize(new Dimension(400, 75)); setOpaque(false); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0}; gridBagLayout.rowHeights = new int[]{0, 0, 0, 0}; gridBagLayout.columnWeights = new double[]{0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); fortitude = new ResistanceLine("FORTITUDE", DDCharacter::getFortSave, AbilityScores.Scores::getCon); GridBagConstraints gbc_fortitude = new GridBagConstraints(); gbc_fortitude.fill = GridBagConstraints.BOTH; gbc_fortitude.gridx = 0; gbc_fortitude.gridy = 0; add(fortitude, gbc_fortitude); reflex = new ResistanceLine("REFLEX", DDCharacter::getRefSave, AbilityScores.Scores::getDex); GridBagConstraints gbc_reflex = new GridBagConstraints(); gbc_reflex.fill = GridBagConstraints.BOTH; gbc_reflex.gridx = 0; gbc_reflex.gridy = 1; add(reflex, gbc_reflex); will = new ResistanceLine("WILL", DDCharacter::getWillSave, AbilityScores.Scores::getWis); GridBagConstraints gbc_will = new GridBagConstraints(); gbc_will.fill = GridBagConstraints.BOTH; gbc_will.gridx = 0; gbc_will.gridy = 2; add(will, gbc_will); } public void setModel(DDCharacter model) { this.fortitude.setModel(model); this.reflex.setModel(model); this.will.setModel(model); } }