Browse Source

Fix positioning in the SummaryPanel

Sam Jaffe 5 years ago
parent
commit
2faf65fc1c
1 changed files with 26 additions and 16 deletions
  1. 26 16
      src/main/lombok/org/leumasjaffe/recipe/view/summary/SummaryPanel.java

+ 26 - 16
src/main/lombok/org/leumasjaffe/recipe/view/summary/SummaryPanel.java

@@ -1,6 +1,5 @@
 package org.leumasjaffe.recipe.view.summary;
 
-import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
@@ -28,7 +27,7 @@ public class SummaryPanel extends JPanel {
 		gridBagLayout.columnWidths = new int[]{0, 0, 0};
 		gridBagLayout.rowHeights = new int[]{0, 0, 0, 0};
 		gridBagLayout.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
-		gridBagLayout.rowWeights = new double[]{1.0, 1.0, 1.0, Double.MIN_VALUE};
+		gridBagLayout.rowWeights = new double[]{0.0, 1.0, 1.0, Double.MIN_VALUE};
 		setLayout(gridBagLayout);
 		
 		JPanel panelHeader = new JPanel();
@@ -64,30 +63,41 @@ public class SummaryPanel extends JPanel {
 		
 		panelIngredients = new JPanel();
 		GridBagConstraints gbc_panelIngredients = new GridBagConstraints();
-		gbc_panelIngredients.gridheight = 2;
-		gbc_panelIngredients.insets = new Insets(0, 0, 0, 5);
+		gbc_panelIngredients.insets = new Insets(0, 0, 5, 5);
 		gbc_panelIngredients.fill = GridBagConstraints.BOTH;
 		gbc_panelIngredients.gridx = 0;
 		gbc_panelIngredients.gridy = 1;
 		add(panelIngredients, gbc_panelIngredients);
 		panelIngredients.setLayout(new VerticalLayout());
 		
+		JPanel panel = new JPanel();
+		GridBagConstraints gbc_panel = new GridBagConstraints();
+		gbc_panel.insets = new Insets(0, 0, 5, 0);
+		gbc_panel.fill = GridBagConstraints.BOTH;
+		gbc_panel.gridx = 1;
+		gbc_panel.gridy = 1;
+		add(panel, gbc_panel);
+		GridBagLayout gbl_panel = new GridBagLayout();
+		gbl_panel.columnWidths = new int[]{0, 0};
+		gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
+		gbl_panel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
+		gbl_panel.rowWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE};
+		panel.setLayout(gbl_panel);
+		
 		JPanel panelPhoto = new ImagePanel();
 		GridBagConstraints gbc_panelPhoto = new GridBagConstraints();
 		gbc_panelPhoto.insets = new Insets(0, 0, 5, 0);
-		gbc_panelPhoto.fill = GridBagConstraints.BOTH;
-		gbc_panelPhoto.gridx = 1;
-		gbc_panelPhoto.gridy = 1;
-		add(panelPhoto, gbc_panelPhoto);
+		gbc_panelPhoto.gridx = 0;
+		gbc_panelPhoto.gridy = 0;
+		panel.add(panelPhoto, gbc_panelPhoto);
 		
-		JTextPane txtpnDescription = new JTextPane();
-		txtpnDescription.setPreferredSize(new Dimension(0, 100));
-		txtpnDescription.setText("Description");
-		GridBagConstraints gbc_txtpnDescription = new GridBagConstraints();
-		gbc_txtpnDescription.fill = GridBagConstraints.BOTH;
-		gbc_txtpnDescription.gridx = 1;
-		gbc_txtpnDescription.gridy = 2;
-		add(txtpnDescription, gbc_txtpnDescription);
+		JTextPane textpnDesription = new JTextPane();
+		GridBagConstraints gbc_textpnDesription = new GridBagConstraints();
+		gbc_textpnDesription.insets = new Insets(0, 0, 5, 0);
+		gbc_textpnDesription.fill = GridBagConstraints.BOTH;
+		gbc_textpnDesription.gridx = 0;
+		gbc_textpnDesription.gridy = 1;
+		panel.add(textpnDesription, gbc_textpnDesription);
 	}
 
 	public void addElement(final Element comp) {