| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package org.leumasjaffe.recipe.view;
- import javax.swing.JPanel;
- import org.leumasjaffe.recipe.model.Rest;
- import lombok.AccessLevel;
- import lombok.Getter;
- import lombok.experimental.FieldDefaults;
- import java.awt.GridBagLayout;
- import javax.swing.JLabel;
- import java.awt.GridBagConstraints;
- import java.awt.Insets;
- @SuppressWarnings("serial")
- @FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
- public class RestPanel extends JPanel {
- @Getter(AccessLevel.PACKAGE) JLabel lblLocation;
- @Getter(AccessLevel.PACKAGE) JLabel lblDuration;
- public RestPanel(Rest rest) {
- GridBagLayout gridBagLayout = new GridBagLayout();
- gridBagLayout.columnWidths = new int[]{0, 0, 0, 0};
- gridBagLayout.rowHeights = new int[]{0, 0};
- gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
- gridBagLayout.rowWeights = new double[]{0.0, Double.MIN_VALUE};
- setLayout(gridBagLayout);
-
- JLabel lblRest = new JLabel("Rest");
- GridBagConstraints gbc_lblRest = new GridBagConstraints();
- gbc_lblRest.insets = new Insets(0, 0, 0, 5);
- gbc_lblRest.gridx = 0;
- gbc_lblRest.gridy = 0;
- add(lblRest, gbc_lblRest);
-
- lblLocation = new JLabel(rest.getWhere().getHumanReadable());
- GridBagConstraints gbc_lblLocation = new GridBagConstraints();
- gbc_lblLocation.insets = new Insets(0, 0, 0, 5);
- gbc_lblLocation.gridx = 1;
- gbc_lblLocation.gridy = 0;
- add(lblLocation, gbc_lblLocation);
-
- lblDuration = new JLabel(rest.getDuration().toString());
- GridBagConstraints gbc_lblDuration = new GridBagConstraints();
- gbc_lblDuration.gridx = 2;
- gbc_lblDuration.gridy = 0;
- add(lblDuration, gbc_lblDuration);
- }
- }
|