package org.helioviewer.plugins.eveplugin.lines.gui;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JPanel;

import org.helioviewer.jhv.gui.ImageViewerGui;
import org.helioviewer.plugins.eveplugin.lines.data.Band;

public class LineColorOptionPanel extends JPanel {

    private final Band band;

    public LineColorOptionPanel(Band band) {
        this.band = band;
        initVisualComponents();
    }

    private void initVisualComponents() {
        setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));

        JButton pickColor = new JButton("Line color");
        pickColor.setToolTipText("Change the color of the current line");
        pickColor.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Color newColor = JColorChooser.showDialog(ImageViewerGui.getMainFrame(), "Choose Line Color", band.getGraphColor());
                if (newColor != null) {
                    band.setGraphColor(newColor);
                }
            }
        });
        add(pickColor);
    }

}

@@ -86,26 +86,89 @@
 ava.awt.
-FlowLayout
+GridBagConstraints;%0Aimport java.awt.GridBagLayout;%0Aimport java.awt.Insets
 ;%0Aimport
@@ -672,16 +672,19 @@
 %0A       
+ //
  setLayo
@@ -726,16 +726,329 @@
 0, 0));%0A
+        setLayout(new GridBagLayout());%0A        GridBagConstraints c = new GridBagConstraints();%0A        c.insets = new Insets(0, 0, 0, 0);%0A        c.anchor = GridBagConstraints.WEST;%0A        c.gridx = 0;%0A        c.gridy = 0;%0A        c.weightx = 1;%0A        c.weighty = 1;%0A        c.fill = GridBagConstraints.NONE;
 %0A       
@@ -1091,24 +1091,77 @@
 ne color%22);%0A
+        pickColor.setMargin(new Insets(0, 0, 0, 0));%0A
         pick
@@ -1628,16 +1628,16 @@
     %7D);%0A
-
         
@@ -1645,24 +1645,27 @@
 dd(pickColor
+, c
 );%0A    %7D%0A%0A%7D%0A

Change layout