public static JPanel createDirectionPanel(boolean enable, String selected, ActionListener l) {
JPanel p = SwingSet.createVerticalPanel(false);
p.setAlignmentY(TOP_ALIGNMENT);
p.setAlignmentX(LEFT_ALIGNMENT);
Box firstThree = Box.createHorizontalBox();
Box secondThree = Box.createHorizontalBox();
Box thirdThree = Box.createHorizontalBox();
if(!enable) {
selected = "None";
}
ButtonGroup group = new ButtonGroup();
DirectionButton b;
b = (DirectionButton) firstThree.add(new DirectionButton( tl_dot, tldn_dot, "NW", "Sets the orientation to the North-West", l, group, selected.equals("NW")));
b.setEnabled(enable);
b = (DirectionButton) firstThree.add(new DirectionButton( tm_dot, tmdn_dot, "N", "Sets the orientation to the North", l, group, selected.equals("N")));
b.setEnabled(enable);
b = (DirectionButton) firstThree.add(new DirectionButton( tr_dot, trdn_dot, "NE", "Sets the orientation to the North-East", l, group, selected.equals("NE")));
b.setEnabled(enable);
b = (DirectionButton) secondThree.add(new DirectionButton( ml_dot, mldn_dot, "W", "Sets the orientation to the West", l, group, selected.equals("W")));
b.setEnabled(enable);
b = (DirectionButton) secondThree.add(new DirectionButton( c_dot, cdn_dot, "C", "Sets the orientation to the Center", l, group, selected.equals("C")));
b.setEnabled(enable);
b = (DirectionButton) secondThree.add(new DirectionButton( mr_dot, mrdn_dot, "E", "Sets the orientation to the East", l, group, selected.equals("E")));
b.setEnabled(enable);
b = (DirectionButton) thirdThree.add(new DirectionButton( bl_dot, bldn_dot, "SW", "Sets the orientation to the South-West", l, group, selected.equals("SW")));
b.setEnabled(enable);
b = (DirectionButton) thirdThree.add(new DirectionButton( bm_dot, bmdn_dot, "S", "Sets the orientation to the South", l, group, selected.equals("S")));
b.setEnabled(enable);
b = (DirectionButton) thirdThree.add(new DirectionButton( br_dot, brdn_dot, "SE", "Sets the orientation to the South-East", l, group, selected.equals("SE")));