Cope if we have no NodeMap.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@829 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: NodeMapPanel.java,v 1.5 2001/10/11 00:41:27 shaper Exp $
|
// $Id: NodeMapPanel.java,v 1.6 2001/12/18 08:39:20 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.nodemap;
|
package com.threerings.nodemap;
|
||||||
|
|
||||||
@@ -61,15 +61,29 @@ public class NodeMapPanel extends JPanel
|
|||||||
_map.setToolTipManager(new ToolTipManager(this));
|
_map.setToolTipManager(new ToolTipManager(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the node map currently being displayed by this panel.
|
||||||
|
*/
|
||||||
|
public NodeMap getNodeMap ()
|
||||||
|
{
|
||||||
|
return _map;
|
||||||
|
}
|
||||||
|
|
||||||
public void paintComponent (Graphics g)
|
public void paintComponent (Graphics g)
|
||||||
{
|
{
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
_map.paint(g);
|
if (_map != null) {
|
||||||
|
_map.paint(g);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getPreferredSize ()
|
public Dimension getPreferredSize ()
|
||||||
{
|
{
|
||||||
return _map.getSize();
|
if (_map != null) {
|
||||||
|
return _map.getSize();
|
||||||
|
} else {
|
||||||
|
return new Dimension(100, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showToolTip (ToolTipProvider tipper, int x, int y)
|
public void showToolTip (ToolTipProvider tipper, int x, int y)
|
||||||
@@ -92,12 +106,16 @@ public class NodeMapPanel extends JPanel
|
|||||||
|
|
||||||
public void mouseClicked (MouseEvent e)
|
public void mouseClicked (MouseEvent e)
|
||||||
{
|
{
|
||||||
_map.handleMouseClicked(e.getX(), e.getY());
|
if (_map != null) {
|
||||||
|
_map.handleMouseClicked(e.getX(), e.getY());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseExited (MouseEvent e)
|
public void mouseExited (MouseEvent e)
|
||||||
{
|
{
|
||||||
_map.handleMouseExited();
|
if (_map != null) {
|
||||||
|
_map.handleMouseExited();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mousePressed (MouseEvent e) { }
|
public void mousePressed (MouseEvent e) { }
|
||||||
@@ -108,8 +126,10 @@ public class NodeMapPanel extends JPanel
|
|||||||
|
|
||||||
public void mouseMoved (MouseEvent e)
|
public void mouseMoved (MouseEvent e)
|
||||||
{
|
{
|
||||||
_map.handleMouseMoved(e.getX(), e.getY());
|
if (_map != null) {
|
||||||
repaint();
|
_map.handleMouseMoved(e.getX(), e.getY());
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseDragged (MouseEvent e) { }
|
public void mouseDragged (MouseEvent e) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user