| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- package org.leumasjaffe.charsheet.view.inventory;
- import javax.swing.JPanel;
- import java.awt.GridBagLayout;
- import java.awt.GridBagConstraints;
- import java.awt.Insets;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Color;
- import javax.swing.SwingConstants;
- import org.leumasjaffe.charsheet.model.equip.DDItem;
- import org.leumasjaffe.charsheet.view.StringHelper;
- import java.awt.Component;
- import javax.swing.Box;
- public class ArmorPanel extends JPanel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JTextField armorNameField;
- private JTextField armorTypeField;
- private JTextField armorBonusField;
- private JTextField armorDexField;
- private JTextField checkField;
- private JTextField spellField;
- private JTextField speedField;
- private JTextField weightField;
- private JTextField propField;
- public ArmorPanel(DDItem item) {
- setPreferredSize(new Dimension(280, 70));
- GridBagLayout gridBagLayout = new GridBagLayout();
- gridBagLayout.columnWidths = new int[]{0, 0};
- gridBagLayout.rowHeights = new int[]{0, 0, 0};
- gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
- gridBagLayout.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
- setLayout(gridBagLayout);
-
- JPanel panel = new JPanel();
- GridBagConstraints gbc_panel = new GridBagConstraints();
- gbc_panel.insets = new Insets(0, 0, 0, 0);
- 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, 0, 0, 0};
- gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
- gbl_panel.columnWeights = new double[]{1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
- gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
- panel.setLayout(gbl_panel);
-
- JLabel lblArmorprotectiveItem = new JLabel("ARMOR/PROTECTIVE ITEM");
- lblArmorprotectiveItem.setHorizontalAlignment(SwingConstants.CENTER);
- lblArmorprotectiveItem.setForeground(Color.WHITE);
- lblArmorprotectiveItem.setOpaque(true);
- lblArmorprotectiveItem.setBackground(Color.BLACK);
- lblArmorprotectiveItem.setFont(new Font("Tahoma", Font.BOLD, 10));
- GridBagConstraints gbc_lblArmorprotectiveItem = new GridBagConstraints();
- gbc_lblArmorprotectiveItem.fill = GridBagConstraints.BOTH;
- gbc_lblArmorprotectiveItem.insets = new Insets(0, 0, 0, 1);
- gbc_lblArmorprotectiveItem.gridheight = 2;
- gbc_lblArmorprotectiveItem.gridx = 0;
- gbc_lblArmorprotectiveItem.gridy = 0;
- panel.add(lblArmorprotectiveItem, gbc_lblArmorprotectiveItem);
-
- Component verticalStrut = Box.createVerticalStrut(20);
- verticalStrut.setMinimumSize(new Dimension(0, 10));
- verticalStrut.setMaximumSize(new Dimension(32767, 10));
- verticalStrut.setPreferredSize(new Dimension(0, 10));
- GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
- gbc_verticalStrut.insets = new Insets(0, 0, 0, 0);
- gbc_verticalStrut.gridx = 2;
- gbc_verticalStrut.gridy = 0;
- panel.add(verticalStrut, gbc_verticalStrut);
-
- JLabel lblType = new JLabel("TYPE");
- lblType.setHorizontalAlignment(SwingConstants.CENTER);
- lblType.setForeground(Color.WHITE);
- lblType.setOpaque(true);
- lblType.setBackground(Color.BLACK);
- lblType.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblType = new GridBagConstraints();
- gbc_lblType.fill = GridBagConstraints.HORIZONTAL;
- gbc_lblType.insets = new Insets(0, 0, 0, 1);
- gbc_lblType.gridx = 1;
- gbc_lblType.gridy = 1;
- panel.add(lblType, gbc_lblType);
-
- JLabel lblAcBonus = new JLabel("AC BONUS");
- lblAcBonus.setHorizontalAlignment(SwingConstants.CENTER);
- lblAcBonus.setForeground(Color.WHITE);
- lblAcBonus.setOpaque(true);
- lblAcBonus.setBackground(Color.BLACK);
- lblAcBonus.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblAcBonus = new GridBagConstraints();
- gbc_lblAcBonus.fill = GridBagConstraints.HORIZONTAL;
- gbc_lblAcBonus.insets = new Insets(0, 0, 0, 1);
- gbc_lblAcBonus.gridx = 2;
- gbc_lblAcBonus.gridy = 1;
- panel.add(lblAcBonus, gbc_lblAcBonus);
-
- JLabel lblMaxDex = new JLabel("MAX DEX");
- lblMaxDex.setHorizontalAlignment(SwingConstants.CENTER);
- lblMaxDex.setForeground(Color.WHITE);
- lblMaxDex.setOpaque(true);
- lblMaxDex.setBackground(Color.BLACK);
- lblMaxDex.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblMaxDex = new GridBagConstraints();
- gbc_lblMaxDex.fill = GridBagConstraints.HORIZONTAL;
- gbc_lblMaxDex.insets = new Insets(0, 0, 0, 1);
- gbc_lblMaxDex.gridx = 3;
- gbc_lblMaxDex.gridy = 1;
- panel.add(lblMaxDex, gbc_lblMaxDex);
-
- armorNameField = new JTextField(item.getName());
- GridBagConstraints gbc_armorNameField = new GridBagConstraints();
- gbc_armorNameField.insets = new Insets(0, 0, 0, 0);
- gbc_armorNameField.fill = GridBagConstraints.HORIZONTAL;
- gbc_armorNameField.gridx = 0;
- gbc_armorNameField.gridy = 2;
- panel.add(armorNameField, gbc_armorNameField);
- armorNameField.setColumns(10);
-
- armorTypeField = new JTextField(item.getArmor().getType().toString());
- GridBagConstraints gbc_armorTypeField = new GridBagConstraints();
- gbc_armorTypeField.insets = new Insets(0, 0, 0, 0);
- gbc_armorTypeField.fill = GridBagConstraints.HORIZONTAL;
- gbc_armorTypeField.gridx = 1;
- gbc_armorTypeField.gridy = 2;
- panel.add(armorTypeField, gbc_armorTypeField);
- armorTypeField.setColumns(10);
-
- armorBonusField = new JTextField(StringHelper.toSignedString(item.getArmor().getBonus()));
- armorBonusField.setHorizontalAlignment(SwingConstants.CENTER);
- GridBagConstraints gbc_armorBonusField = new GridBagConstraints();
- gbc_armorBonusField.insets = new Insets(0, 0, 0, 0);
- gbc_armorBonusField.fill = GridBagConstraints.HORIZONTAL;
- gbc_armorBonusField.gridx = 2;
- gbc_armorBonusField.gridy = 2;
- panel.add(armorBonusField, gbc_armorBonusField);
- armorBonusField.setColumns(10);
-
- armorDexField = new JTextField(StringHelper.toSignedString(item.getArmor().getMaxDex()));
- armorDexField.setHorizontalAlignment(SwingConstants.CENTER);
- GridBagConstraints gbc_armorDexField = new GridBagConstraints();
- gbc_armorDexField.fill = GridBagConstraints.HORIZONTAL;
- gbc_armorDexField.gridx = 3;
- gbc_armorDexField.gridy = 2;
- panel.add(armorDexField, gbc_armorDexField);
- armorDexField.setColumns(10);
-
- 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;
- add(panel_1, gbc_panel_1);
- GridBagLayout gbl_panel_1 = new GridBagLayout();
- gbl_panel_1.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
- gbl_panel_1.rowHeights = new int[]{0, 0, 0};
- gbl_panel_1.columnWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
- gbl_panel_1.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
- panel_1.setLayout(gbl_panel_1);
-
- JLabel lblCheckPenalty = new JLabel("CHECK PENALTY");
- lblCheckPenalty.setHorizontalAlignment(SwingConstants.CENTER);
- lblCheckPenalty.setForeground(Color.WHITE);
- lblCheckPenalty.setOpaque(true);
- lblCheckPenalty.setBackground(Color.BLACK);
- lblCheckPenalty.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblCheckPenalty = new GridBagConstraints();
- gbc_lblCheckPenalty.fill = GridBagConstraints.BOTH;
- gbc_lblCheckPenalty.insets = new Insets(0, 0, 0, 1);
- gbc_lblCheckPenalty.gridx = 0;
- gbc_lblCheckPenalty.gridy = 0;
- panel_1.add(lblCheckPenalty, gbc_lblCheckPenalty);
-
- JLabel lblSpellFailure = new JLabel("SPELL FAILURE");
- lblSpellFailure.setHorizontalAlignment(SwingConstants.CENTER);
- lblSpellFailure.setForeground(Color.WHITE);
- lblSpellFailure.setOpaque(true);
- lblSpellFailure.setBackground(Color.BLACK);
- lblSpellFailure.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblSpellFailure = new GridBagConstraints();
- gbc_lblSpellFailure.fill = GridBagConstraints.BOTH;
- gbc_lblSpellFailure.insets = new Insets(0, 0, 0, 1);
- gbc_lblSpellFailure.gridx = 1;
- gbc_lblSpellFailure.gridy = 0;
- panel_1.add(lblSpellFailure, gbc_lblSpellFailure);
-
- JLabel lblSpeed = new JLabel("SPEED");
- lblSpeed.setHorizontalAlignment(SwingConstants.CENTER);
- lblSpeed.setForeground(Color.WHITE);
- lblSpeed.setOpaque(true);
- lblSpeed.setBackground(Color.BLACK);
- lblSpeed.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblSpeed = new GridBagConstraints();
- gbc_lblSpeed.fill = GridBagConstraints.BOTH;
- gbc_lblSpeed.insets = new Insets(0, 0, 0, 1);
- gbc_lblSpeed.gridx = 2;
- gbc_lblSpeed.gridy = 0;
- panel_1.add(lblSpeed, gbc_lblSpeed);
-
- JLabel lblWeight = new JLabel("WEIGHT");
- lblWeight.setHorizontalAlignment(SwingConstants.CENTER);
- lblWeight.setForeground(Color.WHITE);
- lblWeight.setOpaque(true);
- lblWeight.setBackground(Color.BLACK);
- lblWeight.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblWeight = new GridBagConstraints();
- gbc_lblWeight.fill = GridBagConstraints.BOTH;
- gbc_lblWeight.insets = new Insets(0, 0, 0, 1);
- gbc_lblWeight.gridx = 3;
- gbc_lblWeight.gridy = 0;
- panel_1.add(lblWeight, gbc_lblWeight);
-
- JLabel lblSpecialProperties = new JLabel("SPECIAL PROPERTIES");
- lblSpecialProperties.setHorizontalAlignment(SwingConstants.CENTER);
- lblSpecialProperties.setForeground(Color.WHITE);
- lblSpecialProperties.setOpaque(true);
- lblSpecialProperties.setBackground(Color.BLACK);
- lblSpecialProperties.setFont(new Font("Tahoma", Font.BOLD, 8));
- GridBagConstraints gbc_lblSpecialProperties = new GridBagConstraints();
- gbc_lblSpecialProperties.fill = GridBagConstraints.BOTH;
- gbc_lblSpecialProperties.insets = new Insets(0, 0, 0, 1);
- gbc_lblSpecialProperties.gridx = 4;
- gbc_lblSpecialProperties.gridy = 0;
- panel_1.add(lblSpecialProperties, gbc_lblSpecialProperties);
-
- checkField = new JTextField(StringHelper.toString(item.getArmor().getCheckPenalty()));
- checkField.setHorizontalAlignment(SwingConstants.CENTER);
- GridBagConstraints gbc_checkField = new GridBagConstraints();
- gbc_checkField.insets = new Insets(0, 0, 0, 0);
- gbc_checkField.fill = GridBagConstraints.HORIZONTAL;
- gbc_checkField.gridx = 0;
- gbc_checkField.gridy = 1;
- panel_1.add(checkField, gbc_checkField);
- checkField.setColumns(10);
-
- spellField = new JTextField(StringHelper.toString(item.getArmor().getSpellFailure()) + "%");
- spellField.setHorizontalAlignment(SwingConstants.CENTER);
- GridBagConstraints gbc_spellField = new GridBagConstraints();
- gbc_spellField.insets = new Insets(0, 0, 0, 0);
- gbc_spellField.fill = GridBagConstraints.HORIZONTAL;
- gbc_spellField.gridx = 1;
- gbc_spellField.gridy = 1;
- panel_1.add(spellField, gbc_spellField);
- spellField.setColumns(10);
-
- speedField = new JTextField(StringHelper.toString(item.getArmor().getSpeed()));
- speedField.setHorizontalAlignment(SwingConstants.CENTER);
- GridBagConstraints gbc_speedField = new GridBagConstraints();
- gbc_speedField.insets = new Insets(0, 0, 0, 0);
- gbc_speedField.fill = GridBagConstraints.HORIZONTAL;
- gbc_speedField.gridx = 2;
- gbc_speedField.gridy = 1;
- panel_1.add(speedField, gbc_speedField);
- speedField.setColumns(10);
-
- weightField = new JTextField();
- GridBagConstraints gbc_weightField = new GridBagConstraints();
- gbc_weightField.insets = new Insets(0, 0, 0, 0);
- gbc_weightField.fill = GridBagConstraints.HORIZONTAL;
- gbc_weightField.gridx = 3;
- gbc_weightField.gridy = 1;
- panel_1.add(weightField, gbc_weightField);
- weightField.setColumns(10);
-
- propField = new JTextField();
- GridBagConstraints gbc_propField = new GridBagConstraints();
- gbc_propField.fill = GridBagConstraints.HORIZONTAL;
- gbc_propField.gridx = 4;
- gbc_propField.gridy = 1;
- panel_1.add(propField, gbc_propField);
- propField.setColumns(10);
- // TODO Auto-generated constructor stub
- }
- }
|