17 package com.generalrobotix.ui.view.graph;
19 import java.util.ArrayList;
21 import java.awt.event.*;
25 import javax.swing.plaf.basic.BasicArrowButton;
42 JPanel panel =
new JPanel() {
45 super.setEnabled(flag);
46 Component[] cmps = getComponents();
47 for(
int i = 0;
i < cmps.length;
i ++) {
48 cmps[
i].setEnabled(flag);
53 panel.setLayout(
new BorderLayout());
54 panel.add(BorderLayout.CENTER,component);
55 panel.add(BorderLayout.EAST, spin);
65 listenerList_ =
new ArrayList<SpinListener>();
67 setLayout(
new GridLayout(2,1));
68 btnUp_ =
new BasicArrowButton(BasicArrowButton.NORTH);
69 btnDown_ =
new BasicArrowButton(BasicArrowButton.SOUTH);
71 btnUp_.addMouseListener(
new MyListener(BUTTON_UP));
72 btnDown_.addMouseListener(
new MyListener(BUTTON_DOWN));
78 super.setEnabled(flag);
79 btnUp_.setEnabled(flag);
80 btnDown_.setEnabled(flag);
84 listenerList_.add(listener);
88 listenerList_.remove(listener);
101 if (!isEnabled()) {
return; }
103 if (e.isAltDown() || e.isMetaDown()) {
return; }
110 ActionListener listener =
new ActionListener() {
111 private int allCount_ = 0;
112 private int ikiCount_ = 0;
115 private int sleep_ = sleepTime_ * 2;
116 private int iki_ = 10 / 2;
117 public void actionPerformed(ActionEvent e) {
118 if(ikiCount_ % iki_ ==0){
120 if(sleep_ >= sleepMin_){
123 timer_.setDelay(sleep_);
134 timer_ =
new Timer(sleepTimeFirst_,listener);
135 timer_.setInitialDelay(sleepTimeFirst_);
136 timer_.setCoalesce(
true);
141 if (timer_ !=
null) {
149 for (
int i = 0;
i < listenerList_.size();
i ++) {
static final int BUTTON_DOWN
SpinControl(SpinListener listener)
#define null
our own NULL pointer
java.util.List< SpinListener > listenerList_
void setEnabled(boolean flag)
void removeSpinListener(SpinListener listener)
void mousePressed(MouseEvent e)
void mouseReleased(MouseEvent e)
static final int BUTTON_UP
void addSpinListener(SpinListener listener)
png_infop png_uint_32 flag
static JComponent getComponentWithSpin(JComponent component, SpinControl spin)
synchronized void _broadCast(int button)