/* (non-Javadoc)
* @see org.jpedal.examples.simpleviewer.gui.swing.GUIFactory#addButton(int, java.lang.String, java.lang.String, int)
*/
public void addButton(int line,String toolTip,String path,final int ID) {
GUIButton newButton = new SwingButton();
/**specific buttons*/
switch(ID){
case Commands.FIRSTPAGE:
newButton=first;
break;
case Commands.FBACKPAGE:
newButton=fback;
break;
case Commands.BACKPAGE:
newButton=back;
break;
case Commands.FORWARDPAGE:
newButton=forward;
break;
case Commands.FFORWARDPAGE:
newButton=fforward;
break;
case Commands.LASTPAGE:
newButton=end;
break;
case Commands.SNAPSHOT:
newButton=snapshotButton;
break;
case Commands.SINGLE:
newButton=singleButton;
newButton.setName("SINGLE");
break;
case Commands.CONTINUOUS:
newButton=continuousButton;
newButton.setName("CONTINUOUS");
break;
case Commands.CONTINUOUS_FACING:
newButton=continuousFacingButton;
newButton.setName("CONTINUOUS_FACING");
break;
case Commands.FACING:
newButton=facingButton;
newButton.setName("FACING");
break;
case Commands.PAGEFLOW:
newButton=pageFlowButton;
newButton.setName("PAGEFLOW");
break;
case Commands.PREVIOUSRESULT:
newButton=previousSearch;
newButton.setName("PREVIOUSRESULT");
break;
case Commands.NEXTRESULT:
newButton=nextSearch;
newButton.setName("NEXTRESULT");
break;
case Commands.OPENFILE:
newButton=openButton;
newButton.setName("open");
break;
case Commands.PRINT:
newButton=printButton;
newButton.setName("print");
break;
case Commands.FIND:
newButton=searchButton;
newButton.setName("search");
break;
case Commands.DOCINFO:
newButton=docPropButton;
break;
case Commands.INFO:
newButton=infoButton;
break;
case Commands.MOUSEMODE:
newButton=mouseMode;
newButton.setName("mousemode");
break;
}
//@kieran : This may be a good idea. See how you feel when time to commit.
((SwingButton)newButton).addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {
if(SingleDisplay.allowChangeCursor)
((SwingButton)e.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
public void mouseExited(MouseEvent e) {
if(SingleDisplay.allowChangeCursor)
((SwingButton)e.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
newButton.init(getURLForImage(path), ID,toolTip);
//add listener
((AbstractButton) newButton).addActionListener(currentCommandListener);
int mode=commonValues.getModeOfOperation();