@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==newFrameButton) {
Animation selectedAnimation = getSelectedAnimation();
Frame selectedFrame = getSelectedFrame();
if(selectedAnimation != null) {
Frame newFrame = new Frame("NewFrame" + newFrameSuffix++);
selectedAnimation.addFrame(newFrame);
} else if(selectedFrame != null) {
Frame newFrame = new Frame("NewFrame" + newFrameSuffix++);
Animation parent = selectedFrame.getParent();
parent.addFrame(newFrame, parent.getFrameIndex(selectedFrame)+1);
} else return;
}
if(e.getSource()==newAnimationButton) {
Animation newAnimation = new Animation("NewAnimation" + newAnimationSuffix++);
editor.getData().addAnimation(newAnimation);
}
}