[rcpilot-cvs] src/rcpilot/rcgs RcgsMap.java,1.8,1.9
Status: Beta
Brought to you by:
mjpawlowsky
From: Chris S. <cm...@us...> - 2004-06-27 20:14:16
|
Update of /cvsroot/rcpilot/src/rcpilot/rcgs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30523/rcpilot/rcgs Modified Files: RcgsMap.java Log Message: added scroll buttons, currently non-functional Index: RcgsMap.java =================================================================== RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/RcgsMap.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RcgsMap.java 27 Jun 2004 07:39:45 -0000 1.8 --- RcgsMap.java 27 Jun 2004 20:14:05 -0000 1.9 *************** *** 55,58 **** --- 55,63 ---- private static final String ZOOM_MINUS_IMAGE_PATH = "res/icons/zoom_minus.jpg"; + private static final String SCROLL_UP_IMAGE_PATH = "res/icons/scroll_up.jpg"; + private static final String SCROLL_RIGHT_IMAGE_PATH = "res/icons/scroll_right.jpg"; + private static final String SCROLL_DOWN_IMAGE_PATH = "res/icons/scroll_down.jpg"; + private static final String SCROLL_LEFT_IMAGE_PATH = "res/icons/scroll_left.jpg"; + private Image mapImg, displayImg; *************** *** 88,91 **** --- 93,101 ---- private JButton zoomMinusButton; + private JButton scrollUpButton; + private JButton scrollRightButton; + private JButton scrollDownButton; + private JButton scrollLeftButton; + /* * Create the Map Panel and get the last map. *************** *** 108,111 **** --- 118,131 ---- add(zoomPlusButton); add(zoomMinusButton); + + scrollUpButton = new JButton(new ImageIcon(SCROLL_UP_IMAGE_PATH)); + scrollRightButton = new JButton(new ImageIcon(SCROLL_RIGHT_IMAGE_PATH)); + scrollDownButton = new JButton(new ImageIcon(SCROLL_DOWN_IMAGE_PATH)); + scrollLeftButton = new JButton(new ImageIcon(SCROLL_LEFT_IMAGE_PATH)); + + add(scrollUpButton); + add(scrollRightButton); + add(scrollDownButton); + add(scrollLeftButton); } *************** *** 288,291 **** --- 308,324 ---- } + private void layoutButtons() { + // fix: cleaner way to + // store static values + + zoomPlusButton.setBounds(2,2,34,34); + zoomMinusButton.setBounds(38,2,34,34); + + scrollUpButton.setBounds( (getWidth()/2)-16,2,34,34); + scrollRightButton.setBounds( getWidth()-36,(getHeight()/2)-16,34,34); + scrollDownButton.setBounds( (getWidth()/2)-16,getHeight()-36,34,34); + scrollLeftButton.setBounds(2,(getHeight()/2)-16,34,34); + } + protected void paintComponent(Graphics g) { *************** *** 309,317 **** getHeight()); ! // replace literals here ! ! ! zoomPlusButton.setBounds(2,2,34,34); ! zoomMinusButton.setBounds(38,2,34,34); // in hundredths of a second/pixel --- 342,346 ---- getHeight()); ! layoutButtons(); // in hundredths of a second/pixel |