Browse Source

Half-assed fix for bad UnitGraph toolbar Layout.

Ludwig Tietze 6 years ago
parent
commit
7e3958c814
1 changed files with 28 additions and 18 deletions
  1. 28 18
      src/ui/view/GUI.java

+ 28 - 18
src/ui/view/GUI.java

@@ -195,7 +195,7 @@ public class GUI implements CategoryListener {
 	private final JButton btnDel = new JButton("-");
 	private final JButton btnAddHolEL = new JButton("+");
 	private final JButton btnDelHolEL = new JButton("-");
-	private final JButton resetGraphBtn = new JButton("Reset");
+	private final JButton resetGraphBtn = new JButton("  Reset  ");
 	private final JToolBar toolBar = new JToolBar();
 	private final JToolBar toolBarHolonEl = new JToolBar();
 	private final JToolBar toolBarGraph = new JToolBar();
@@ -213,7 +213,7 @@ public class GUI implements CategoryListener {
 	/** Textfield to show the period of an element */
 	private final JTextField unitGraphLocalPeriod = new JTextField();
 	private final JCheckBox unitGraphStretchMode=new JCheckBox();
-	private final JLabel unitGraphStretchModeLbl=new JLabel(" Use global");//Some padding
+	private final JLabel unitGraphStretchModeLbl=new JLabel("  Use global:  ");//Some padding
 	private final JSplitPane splitPane3 = new JSplitPane();
 	private final JSlider sizeSlider = new JSlider();
 	private final JLabel lblImageSize = new JLabel(Languages.getLanguage()[94]);
@@ -1110,35 +1110,45 @@ public class GUI implements CategoryListener {
 		graphLabel.add(medGraph, BorderLayout.CENTER);
 		graphLabel.add(minGraph, BorderLayout.SOUTH);
 
+		GridBagLayout gbl=new GridBagLayout();
+		toolBarGraph.setLayout(gbl);
+		GridBagConstraints c=new GridBagConstraints();
+		c.weightx=0;
+		gbl.setConstraints(lblSelectedElement, c);
+		//TODO here
 		toolBarGraph.add(lblSelectedElement);
-		toolBarGraph.add(elementGraph);
+		c.gridwidth=GridBagConstraints.REMAINDER;
+		gbl.setConstraints(elementGraph, c);
+		toolBarGraph.add(elementGraph/*, BorderLayout.AFTER_LINE_ENDS*/);//TODO
 		
-		Component horizontalStrut = Box.createHorizontalStrut(20);
+		//Component horizontalStrut = Box.createHorizontalStrut(20);
 		/*
 		Component horizontalStrut = Box.createHorizontalStrut(toolBarGraph
 				.getWidth() - resetGraphBtn.getWidth() - unitGraphLocalPeriod.getWidth()
 				-unitGraphLocalPeriodLbl.getWidth());
 
 		*/
-		toolBarGraph.add(horizontalStrut);//What is this for?
+		//toolBarGraph.add(horizontalStrut);//What is this for?
 
 		/** Add local Graph length Textfield an Label */
 		unitGraphLocalPeriod.setPreferredSize(new Dimension(30, 20));//TODO
 		unitGraphLocalPeriod.setText(""+unitGraph.getLocalPeriod());
-		resetGraphBtn.setHorizontalAlignment(SwingConstants.RIGHT);
 		
-		toolBarGraph.add(unitGraphLocalPeriodLbl);
-		unitGraphLocalPeriodLbl.setHorizontalAlignment(SwingConstants.RIGHT);
-		toolBarGraph.add(unitGraphLocalPeriod);
-		
-		resetGraphBtn.setHorizontalAlignment(SwingConstants.RIGHT);
-		toolBarGraph.add(resetGraphBtn);
-		
-		toolBarGraph.add(unitGraphStretchModeLbl);
-		unitGraphStretchModeLbl.setHorizontalAlignment(SwingConstants.RIGHT);
-		
-		toolBarGraph.add(unitGraphStretchMode);
-		unitGraphStretchMode.setHorizontalAlignment(SwingConstants.RIGHT);
+		c.gridwidth=GridBagConstraints.NORTHWEST;
+		gbl.setConstraints(unitGraphLocalPeriodLbl, c);
+		toolBarGraph.add(unitGraphLocalPeriodLbl);//TODO
+		//unitGraphLocalPeriodLbl.setHorizontalAlignment(SwingConstants.RIGHT);
+		gbl.setConstraints(unitGraphLocalPeriod, c);
+		toolBarGraph.add(unitGraphLocalPeriod);//TODO
+		gbl.setConstraints(unitGraphStretchModeLbl, c);
+		toolBarGraph.add(unitGraphStretchModeLbl);//TODO
+		//unitGraphStretchModeLbl.setHorizontalAlignment(SwingConstants.RIGHT);
+		gbl.setConstraints(unitGraphStretchMode, c);
+		toolBarGraph.add(unitGraphStretchMode);//TODO
+		//unitGraphStretchMode.setHorizontalAlignment(SwingConstants.RIGHT);
+		gbl.setConstraints(resetGraphBtn, c);
+		//resetGraphBtn.setHorizontalAlignment(SwingConstants.RIGHT);
+		toolBarGraph.add(resetGraphBtn);//TODO
 		unitGraphStretchMode.addActionListener(e ->
 			{unitGraph.setStretching(unitGraphStretchMode.isSelected());}
 		);