X-Git-Url: https://git.piment-noir.org/?p=Persons_Comparator.git;a=blobdiff_plain;f=src%2FWeightView.java;h=fd6d68cb40d0e974ca32b226fb3d80cb6611a9a7;hp=9e7ef20d8c0744377cef894240f2e82f6ce0f60e;hb=2bb2aa17b6533b2e8d2fc97997ed76bc38b6931d;hpb=476910abd64760223f3e4143866134e49facf487 diff --git a/src/WeightView.java b/src/WeightView.java index 9e7ef20..fd6d68c 100644 --- a/src/WeightView.java +++ b/src/WeightView.java @@ -3,12 +3,19 @@ import javax.swing.*; public class WeightView extends JPanel { private Weight weightObj; private JLabel label; + private JComboBox comboBox; WeightView(Weight weightObj) { setWeightObj(weightObj); this.label = new JLabel(); - this.label.setText("Weight"); + this.label.setText("Weight (kilograms)"); + this.comboBox = new JComboBox<>(this.getWeightObj().getValuesArray()); + if (this.getWeightObj().getWeight() != 0) + this.comboBox.setSelectedItem(this.getWeightObj().getWeight()); + else + this.comboBox.setSelectedItem(this.getWeightObj().getDefaultWeight()); add(label); + add(comboBox); } public Weight getWeightObj() {