Exemple #1
0
 /** Update the icon in the run button */
 private void updateRunButton() {
   if (stopIcon == null) {
     stopIcon = Resource.getIcon(getIcon("Pause"), true);
     startIcon = Resource.getIcon(getIcon("Play"), true);
   }
   if (startStopBtn != null) {
     boolean running = isRunning() && haveTimes();
     if (running) {
       startStopBtn.setIcon(stopIcon);
       startStopBtn.setToolTipText("Stop animation");
     } else {
       startStopBtn.setIcon(startIcon);
       startStopBtn.setToolTipText("Start animation");
     }
   }
 }
 private AbstractButton createButton(
     String text, ImageIcon icon, String toolTip, ActionListener actionListener) {
   AbstractButton button = new JButton(text, icon);
   button.setMaximumSize(buttonDimension);
   button.setPreferredSize(buttonDimension);
   if (toolTip != null) {
     button.setToolTipText(toolTip);
   }
   if (actionListener != null) {
     button.addActionListener(actionListener);
   }
   return button;
 }