FileDocCategorySizeDatePackage
Buttons.javaAPI DocExample4357Mon Apr 06 18:10:26 BST 1998c13.swing

Buttons

public class Buttons extends JPanel

Fields Summary
JButton
jb
BasicArrowButton
up
BasicArrowButton
down
BasicArrowButton
right
BasicArrowButton
left
Spinner
spin
StringSpinner
stringSpin
Constructors Summary
public Buttons()

    
    add(jb);
    add(new JToggleButton("JToggleButton"));
    add(new JCheckBox("JCheckBox"));
    add(new JRadioButton("JRadioButton"));
    up.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e){
        spin.setValue(spin.getValue() + 1);
      }
    });
    down.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e){
        spin.setValue(spin.getValue() - 1);
      }
    });
    JPanel jp = new JPanel();
    jp.add(spin);
    jp.add(up);
    jp.add(down);
    jp.setBorder(new TitledBorder("Spinner"));
    add(jp);
    left.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e){
        stringSpin.setValue(
          stringSpin.getValue() + 1);
      }
    });
    right.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        stringSpin.setValue(
          stringSpin.getValue() - 1);
      }
    });
    jp = new JPanel();
    jp.add(stringSpin);
    jp.add(left);
    jp.add(right);
    jp.setBorder(
      new TitledBorder("StringSpinner"));
    add(jp);
  
Methods Summary
public static voidmain(java.lang.String[] args)

    Show.inFrame(new Buttons(), 300, 200);