|
@@ -0,0 +1,78 @@
|
|
|
|
|
+package org.leumasjaffe.charsheet.view.config;
|
|
|
|
|
+
|
|
|
|
|
+import javax.swing.JPanel;
|
|
|
|
|
+
|
|
|
|
|
+import org.jdesktop.swingx.VerticalLayout;
|
|
|
|
|
+import org.leumasjaffe.charsheet.config.Constants;
|
|
|
|
|
+
|
|
|
|
|
+import java.awt.GridBagLayout;
|
|
|
|
|
+import java.awt.GridBagConstraints;
|
|
|
|
|
+import javax.swing.JLabel;
|
|
|
|
|
+import java.awt.Insets;
|
|
|
|
|
+import java.awt.Component;
|
|
|
|
|
+import javax.swing.Box;
|
|
|
|
|
+import java.awt.Font;
|
|
|
|
|
+
|
|
|
|
|
+@SuppressWarnings("serial")
|
|
|
|
|
+public class ConfigPanel extends JPanel {
|
|
|
|
|
+ public ConfigPanel() {
|
|
|
|
|
+ GridBagLayout gridBagLayout = new GridBagLayout();
|
|
|
|
|
+ gridBagLayout.columnWidths = new int[]{0, 0};
|
|
|
|
|
+ gridBagLayout.rowHeights = new int[]{0, 0};
|
|
|
|
|
+ gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
|
|
|
+ gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
|
|
|
+ setLayout(gridBagLayout);
|
|
|
|
|
+
|
|
|
|
|
+ JPanel panel = new JPanel();
|
|
|
|
|
+ GridBagConstraints gbc_panel = new GridBagConstraints();
|
|
|
|
|
+ gbc_panel.fill = GridBagConstraints.BOTH;
|
|
|
|
|
+ gbc_panel.gridx = 0;
|
|
|
|
|
+ gbc_panel.gridy = 0;
|
|
|
|
|
+ add(panel, gbc_panel);
|
|
|
|
|
+ GridBagLayout gbl_panel = new GridBagLayout();
|
|
|
|
|
+ gbl_panel.columnWidths = new int[]{0, 0};
|
|
|
|
|
+ gbl_panel.rowHeights = new int[]{0, 0, 0};
|
|
|
|
|
+ gbl_panel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
|
|
|
+ gbl_panel.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
|
|
|
|
|
+ panel.setLayout(gbl_panel);
|
|
|
|
|
+
|
|
|
|
|
+ JLabel lblUnits = new JLabel("Units:");
|
|
|
|
|
+ lblUnits.setFont(new Font("Lucida Grande", Font.PLAIN, 16));
|
|
|
|
|
+ GridBagConstraints gbc_lblUnits = new GridBagConstraints();
|
|
|
|
|
+ gbc_lblUnits.fill = GridBagConstraints.HORIZONTAL;
|
|
|
|
|
+ gbc_lblUnits.insets = new Insets(5, 0, 5, 0);
|
|
|
|
|
+ gbc_lblUnits.gridx = 0;
|
|
|
|
|
+ gbc_lblUnits.gridy = 0;
|
|
|
|
|
+ panel.add(lblUnits, gbc_lblUnits);
|
|
|
|
|
+
|
|
|
|
|
+ JPanel panel_1 = new JPanel();
|
|
|
|
|
+ GridBagConstraints gbc_panel_1 = new GridBagConstraints();
|
|
|
|
|
+ gbc_panel_1.fill = GridBagConstraints.BOTH;
|
|
|
|
|
+ gbc_panel_1.gridx = 0;
|
|
|
|
|
+ gbc_panel_1.gridy = 1;
|
|
|
|
|
+ panel.add(panel_1, gbc_panel_1);
|
|
|
|
|
+ GridBagLayout gbl_panel_1 = new GridBagLayout();
|
|
|
|
|
+ gbl_panel_1.columnWidths = new int[]{0, 0, 0};
|
|
|
|
|
+ gbl_panel_1.rowHeights = new int[]{0, 0};
|
|
|
|
|
+ gbl_panel_1.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
|
|
|
|
|
+ gbl_panel_1.rowWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
|
|
|
+ panel_1.setLayout(gbl_panel_1);
|
|
|
|
|
+
|
|
|
|
|
+ JPanel panel_2 = new JPanel(new VerticalLayout(0));
|
|
|
|
|
+ GridBagConstraints gbc_panel_2 = new GridBagConstraints();
|
|
|
|
|
+ gbc_panel_2.fill = GridBagConstraints.BOTH;
|
|
|
|
|
+ gbc_panel_2.gridx = 1;
|
|
|
|
|
+ gbc_panel_2.gridy = 0;
|
|
|
|
|
+ panel_1.add(panel_2, gbc_panel_2);
|
|
|
|
|
+
|
|
|
|
|
+ Component horizontalStrut = Box.createHorizontalStrut(20);
|
|
|
|
|
+ GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
|
|
|
|
|
+ gbc_horizontalStrut.insets = new Insets(0, 0, 0, 5);
|
|
|
|
|
+ gbc_horizontalStrut.gridx = 0;
|
|
|
|
|
+ gbc_horizontalStrut.gridy = 0;
|
|
|
|
|
+ panel_1.add(horizontalStrut, gbc_horizontalStrut);
|
|
|
|
|
+
|
|
|
|
|
+ panel_2.add(new ConfigEnumPanel<>(Constants.K_DISTANCE, Constants.DistanceMeasurement.class));
|
|
|
|
|
+ panel_2.add(new ConfigEnumPanel<>(Constants.K_DURATION, Constants.DurationMeasurement.class));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|