Ver Fonte

Adding page# info for general items.
Removing unneeded sub-panel.

Sam Jaffe há 9 anos atrás
pai
commit
da2a253845
1 ficheiros alterados com 36 adições e 27 exclusões
  1. 36 27
      src/org/leumasjaffe/charsheet/view/inventory/ItemPanel.java

+ 36 - 27
src/org/leumasjaffe/charsheet/view/inventory/ItemPanel.java

@@ -22,28 +22,16 @@ public class ItemPanel extends JPanel {
 	private JTextField weightField;
 	private JTextField countField;
 	private JTextField valueField;
+	private JTextField pageField;
 
 	public ItemPanel(String string) {
 		setPreferredSize(new Dimension(280, 40));
-		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[]{0.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, 0, 0, 0};
+		gbl_panel.columnWidths = new int[]{0, 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.columnWeights = new double[]{1.0, 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);
+		setLayout(gbl_panel);
 		
 		JLabel lblName = new JLabel("ITEM NAME");
 		lblName.setHorizontalAlignment(SwingConstants.CENTER);
@@ -57,17 +45,17 @@ public class ItemPanel extends JPanel {
 		gbc_lblName.gridheight = 2;
 		gbc_lblName.gridx = 0;
 		gbc_lblName.gridy = 0;
-		panel.add(lblName, gbc_lblName);
+		add(lblName, gbc_lblName);
 		
 		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, 1);
+		gbc_verticalStrut.insets = new Insets(0, 0, 0, 0);
 		gbc_verticalStrut.gridx = 2;
 		gbc_verticalStrut.gridy = 0;
-		panel.add(verticalStrut, gbc_verticalStrut);
+		add(verticalStrut, gbc_verticalStrut);
 		
 		JLabel lblCount = new JLabel("COUNT");
 		lblCount.setOpaque(true);
@@ -80,7 +68,7 @@ public class ItemPanel extends JPanel {
 		gbc_lblCount.insets = new Insets(0, 0, 0, 1);
 		gbc_lblCount.gridx = 1;
 		gbc_lblCount.gridy = 1;
-		panel.add(lblCount, gbc_lblCount);
+		add(lblCount, gbc_lblCount);
 		
 		JLabel lblWeight = new JLabel("WEIGHT");
 		lblWeight.setHorizontalAlignment(SwingConstants.CENTER);
@@ -93,7 +81,7 @@ public class ItemPanel extends JPanel {
 		gbc_lblWeight.insets = new Insets(0, 0, 0, 1);
 		gbc_lblWeight.gridx = 2;
 		gbc_lblWeight.gridy = 1;
-		panel.add(lblWeight, gbc_lblWeight);
+		add(lblWeight, gbc_lblWeight);
 		
 		JLabel lblValue = new JLabel("VALUE");
 		lblValue.setOpaque(true);
@@ -106,7 +94,20 @@ public class ItemPanel extends JPanel {
 		gbc_lblValue.insets = new Insets(0, 0, 0, 1);
 		gbc_lblValue.gridx = 3;
 		gbc_lblValue.gridy = 1;
-		panel.add(lblValue, gbc_lblValue);
+		add(lblValue, gbc_lblValue);
+		
+		JLabel lblPage = new JLabel("PAGE");
+		lblPage.setOpaque(true);
+		lblPage.setHorizontalAlignment(SwingConstants.CENTER);
+		lblPage.setForeground(Color.WHITE);
+		lblPage.setFont(new Font("Tahoma", Font.BOLD, 8));
+		lblPage.setBackground(Color.BLACK);
+		GridBagConstraints gbc_lblPage = new GridBagConstraints();
+		gbc_lblPage.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblPage.insets = new Insets(0, 0, 0, 1);
+		gbc_lblPage.gridx = 4;
+		gbc_lblPage.gridy = 1;
+		add(lblPage, gbc_lblPage);
 		
 		nameField = new JTextField();
 		GridBagConstraints gbc_nameField = new GridBagConstraints();
@@ -114,7 +115,7 @@ public class ItemPanel extends JPanel {
 		gbc_nameField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_nameField.gridx = 0;
 		gbc_nameField.gridy = 2;
-		panel.add(nameField, gbc_nameField);
+		add(nameField, gbc_nameField);
 		nameField.setColumns(10);
 		
 		countField = new JTextField();
@@ -123,7 +124,7 @@ public class ItemPanel extends JPanel {
 		gbc_countField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_countField.gridx = 1;
 		gbc_countField.gridy = 2;
-		panel.add(countField, gbc_countField);
+		add(countField, gbc_countField);
 		countField.setColumns(10);
 		
 		weightField = new JTextField();
@@ -132,17 +133,25 @@ public class ItemPanel extends JPanel {
 		gbc_weightField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_weightField.gridx = 2;
 		gbc_weightField.gridy = 2;
-		panel.add(weightField, gbc_weightField);
+		add(weightField, gbc_weightField);
 		weightField.setColumns(10);
 		
 		valueField = new JTextField();
 		GridBagConstraints gbc_valueField = new GridBagConstraints();
+		gbc_valueField.insets = new Insets(0, 0, 0, 0);
 		gbc_valueField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_valueField.gridx = 3;
 		gbc_valueField.gridy = 2;
-		panel.add(valueField, gbc_valueField);
+		add(valueField, gbc_valueField);
 		valueField.setColumns(10);
-		// TODO Auto-generated constructor stub
+		
+		pageField = new JTextField();
+		GridBagConstraints gbc_pageField = new GridBagConstraints();
+		gbc_pageField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_pageField.gridx = 4;
+		gbc_pageField.gridy = 2;
+		add(pageField, gbc_pageField);
+		pageField.setColumns(10);
 	}
 
 }