Explorar o código

empty border in statisticGraphPanel

dominik.rieder %!s(int64=7) %!d(string=hai) anos
pai
achega
66ce24ec47
Modificáronse 3 ficheiros con 13 adicións e 11 borrados
  1. 1 1
      src/ui/view/GUI.java
  2. 0 4
      src/ui/view/StatPanel2.java
  3. 12 6
      src/ui/view/StatisticGraphPanel.java

+ 1 - 1
src/ui/view/GUI.java

@@ -282,7 +282,7 @@ public class GUI<E> implements CategoryListener {
 		statScrollPane = new JScrollPane(statSplitPane);
 		this.canvas = new MyCanvas(model, control);
 		this.holonCanvas = new HolonCanvas(model, control);
-		//this.unitGraph = new UnitGraph(model, control);
+		this.unitGraph = new UnitGraph(model, control);
 		control.initListener(this);
 		controller.setCanvas(canvas);
 		model.setConsole(console);

+ 0 - 4
src/ui/view/StatPanel2.java

@@ -584,10 +584,6 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 									&& graphNrTxtField.getText().length() > 0) {
 								tmp = new StatisticGraphPanel(controller.getModel(), controller,
 										graphNrTxtField.getText(), graphHashtable);
-								//tmp.setPreferredSize(new Dimension(280, 150));
-								//tmp.setMaximumSize(new Dimension(1000, 1000));
-								// tmp.setMinimumSize(new Dimension(100, 45));
-								tmp.setBorder(new LineBorder(new Color(0, 0, 0), 1));
 								graphPanel.add(tmp);
 								graphPanel.add(Box.createRigidArea(new Dimension(50, 50)));
 								graphPanel.revalidate();

+ 12 - 6
src/ui/view/StatisticGraphPanel.java

@@ -33,10 +33,13 @@ import java.io.IOException;
 import java.util.Hashtable;
 
 import javax.imageio.ImageIO;
+import javax.swing.BorderFactory;
 import javax.swing.BoxLayout;
 import javax.swing.GroupLayout.Alignment;
 
 import java.awt.GridLayout;
+import javax.swing.border.EmptyBorder;
+import java.awt.Component;
 
 public class StatisticGraphPanel extends JPanel {
 
@@ -70,6 +73,7 @@ public class StatisticGraphPanel extends JPanel {
 	 */
 	public StatisticGraphPanel(Model mod, Control cont, String name, Hashtable<String, StatisticGraphPanel> gHt) {
 		super();
+		setBorder(new EmptyBorder(0, 0, 0, 0));
 		this.model = mod;
 		this.controller = cont;
 		this.sGraph = new StatisticGraph(mod, cont);
@@ -79,11 +83,11 @@ public class StatisticGraphPanel extends JPanel {
 
 		// ******************** Component Propertys ***************//
 		// Graph
-		this.setPreferredSize(new Dimension(300, 200));
-		//sGraph.setPreferredSize(new Dimension(200, 200));
-		//sGraph.setMinimumSize(new Dimension(100, 150));
-		this.setMaximumSize(new Dimension(700, 200));
-		this.setMinimumSize(new Dimension(300, 200));
+		//this.setPreferredSize(new Dimension(300, 200));
+		sGraph.setPreferredSize(new Dimension(200, 200));
+		sGraph.setMinimumSize(new Dimension(100, 150));
+		//this.setMaximumSize(new Dimension(700, 200));
+		//this.setMinimumSize(new Dimension(300, 200));
 
 		// Graph Name
 		graphNameLabel = new JLabel(graphName);
@@ -119,6 +123,7 @@ public class StatisticGraphPanel extends JPanel {
 		// Maximum Label
 		maximumLabel.setVerticalAlignment(SwingConstants.TOP);
 		maximumLabel.setMinimumSize(new Dimension(30, 10));
+		legendPanel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
 
 		// Legend Panel
 		legendPanel.setLayout(new GridLayout(0, 5, 0, 0));
@@ -201,7 +206,8 @@ public class StatisticGraphPanel extends JPanel {
 		} else {
 			b = new JLabel(property);
 		}
-		b.setBackground(set.getColor());
+		//b.setBackground(set.getColor());
+		b.setBorder(BorderFactory.createLineBorder(set.getColor()));
 		int color = Math.max(Math.max(set.getColor().getRed(), set.getColor().getGreen()), set.getColor().getBlue());
 		if (color <= 128) {
 			b.setForeground(Color.WHITE);