panelPlay.add(sw_state);
final AbstractAction action_play = new AbstractAction("(ALT+P)", UIMessage._getIcon(UIMessage.PLAYER_PLAY_TYPE, true)) {
public void actionPerformed(ActionEvent e) {
SortedMap<Integer, Animation> animations = character.accessSynchCache();
Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
if (anim instanceof Animation) {
if (animator instanceof javax.swing.Timer) {
if (!animator.isRunning()) {
animator.start();
}
} else {
animator = new javax.swing.Timer((int) character.getFrameRate(), new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD) instanceof JComponent) {
JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
comp.paintImmediately(0, 0, comp.getWidth(), comp.getHeight());
}
}
});
animator.start();
}
anim.play();
}
sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
}
};
panelPlay.add(new JButton(action_play));
panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PAUSE_TYPE, true)) {
public void actionPerformed(ActionEvent e) {
SortedMap<Integer, Animation> animations = character.accessSynchCache();
Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
if (anim instanceof Animation) {
anim.pause();
JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
if (comp instanceof JComponent) {
comp.repaint();
}
if (animator instanceof javax.swing.Timer) {
if (animator.isRunning()) {
animator.stop();
}
}
}
sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
}
}));
panelPlay.add(new JButton(modelPanel.action_playSfx));
panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PREVIOUS_TYPE, true)) {
public void actionPerformed(ActionEvent e) {
SortedMap<Integer, Animation> animations = character.accessSynchCache();
Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
if (anim instanceof Animation) {
anim.stop();
anim.rewind();
JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
if (comp instanceof JComponent) {
comp.repaint();
}
if (animator instanceof javax.swing.Timer) {
if (animator.isRunning()) {
animator.stop();
}
}
}
sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
sw_state.repaint();
}
}));
panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FB_TYPE, true)) {
public void actionPerformed(ActionEvent e) {
SortedMap<Integer, Animation> animations = character.accessSynchCache();
Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
if (anim instanceof Animation) {
anim.pause();
anim.position(Math.max(0, anim.getPosition() - 1));
JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
if (comp instanceof JComponent) {
comp.repaint();
}
if (animator instanceof javax.swing.Timer) {
if (animator.isRunning()) {
animator.stop();
}
}
}
sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
sw_state.repaint();
}
}));
panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FF_TYPE, true)) {
public void actionPerformed(ActionEvent e) {
SortedMap<Integer, Animation> animations = character.accessSynchCache();
Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
if (anim instanceof Animation) {
anim.pause();
anim.position(Math.min(anim.length() - 1, anim.getPosition() + 1));
JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
if (comp instanceof JComponent) {
comp.repaint();
}
if (animator instanceof javax.swing.Timer) {
if (animator.isRunning()) {
animator.stop();
}
}
}
sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
}
}));
panelPlay.add(this.sw_refresh = new JButton("refresh", UIMessage._getIcon(UIMessage.REFRESH_TYPE, false)));
sw_refresh.addActionListener(new ActionListener() {