| Home >> All >> org >> incenter >> [ ngbclient Javadoc ] |
Source code: org/incenter/ngbclient/frmGetSector.java
1 2 package org.incenter.ngbclient; 3 import org.incenter.ngbclient.*; 4 import org.incenter.gb.*; 5 6 import java.awt.*; 7 import java.awt.event.*; 8 import java.net.*; 9 import java.io.*; 10 import java.lang.*; 11 import java.util.*; 12 13 14 /** 15 * 16 * @author 17 * @version 18 */ 19 public class frmGetSector extends java.awt.Frame 20 implements MouseListener 21 { 22 public frmGetSector(frmClient p,planetMap map, location loc) { 23 this.map = map; 24 parent = p; 25 location = loc; 26 Label lbl = new Label("Select a sector"); 27 add(lbl); 28 pack(); 29 } 30 31 location location; 32 planetMap map; 33 frmClient parent; 34 sector_remote currentSector; 35 sectorUser user; 36 37 public void show(sectorUser su) { 38 map.addMouseListener(this); 39 user = su; 40 show(); 41 } 42 43 public sector_remote getCurrentSector() { return currentSector; } 44 /** 45 * call this before asking for a sector 46 */ 47 public void initCurrentSector() { currentSector = null; } 48 49 public void mousePressed(MouseEvent evt) { 50 try { 51 if((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { 52 if(evt.getSource().equals(map)) { 53 int x = evt.getX(), y = evt.getY(); 54 try { 55 sector_remote sec = map.getSector(x,y); 56 currentSector = sec; 57 location.setSectorXY(new Point(sec.getX().intValue(), 58 sec.getY().intValue())); 59 map.removeMouseListener(this); 60 hide(); 61 user.setSector(location); 62 } catch(Exception e) { 63 parent.addMessage("frmGetSector.mousePressed:" + e); 64 return; 65 } 66 } 67 } 68 69 } catch(Exception e) { 70 parent.addMessage("frmGetSector:" + e + ", " + evt); 71 } 72 } 73 74 public void mouseReleased(MouseEvent evt) { 75 ; 76 } 77 78 public void mouseExited(MouseEvent evt) { 79 ; 80 } 81 82 public void mouseEntered(MouseEvent evt) { 83 ; 84 } 85 86 public void mouseClicked(MouseEvent evt) { 87 ; 88 } 89 90 }