DirectionButtonpublic class DirectionButton extends JRadioButton
Fields Summary |
---|
public static ImageIcon | bl_dot | public static ImageIcon | bldn_dot | public static ImageIcon | bm_dot | public static ImageIcon | bmdn_dot | public static ImageIcon | br_dot | public static ImageIcon | brdn_dot | public static ImageIcon | c_dot | public static ImageIcon | cdn_dot | public static ImageIcon | ml_dot | public static ImageIcon | mldn_dot | public static ImageIcon | mr_dot | public static ImageIcon | mrdn_dot | public static ImageIcon | tl_dot | public static ImageIcon | tldn_dot | public static ImageIcon | tm_dot | public static ImageIcon | tmdn_dot | public static ImageIcon | tr_dot | public static ImageIcon | trdn_dot |
Constructors Summary |
---|
public DirectionButton(Icon icon, Icon downIcon, String direction, String description, ActionListener l, ButtonGroup group, boolean selected)A layout direction button
super();
setSelected(selected);
this.addActionListener(l);
setFocusPainted(false);
setHorizontalTextPosition(CENTER);
group.add(this);
setIcon(icon);
setSelectedIcon(downIcon);
setActionCommand(direction);
getAccessibleContext().setAccessibleName(direction);
getAccessibleContext().setAccessibleDescription(description);
|
Methods Summary |
---|
public static JPanel | createDirectionPanel(boolean enable, java.lang.String selected, java.awt.event.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")));
b.setEnabled(enable);
p.add(firstThree);
p.add(secondThree);
p.add(thirdThree);
return p;
| public boolean | isFocusTraversable()
return false;
| public void | setBorder(Border b)
|
|