From: Brett L. <wak...@gm...> - 2008-06-03 21:19:11
|
On Tue, 2008-06-03 at 00:55 +0200, Freek Dijkstra wrote: > Erik Vos wrote: > > >> the upgrade value of a city while laying a tile, > > > > E.g. as a tooltip for the upgrade tiles at the left-hand side of the map? > > Good idea. > > Attached is a patch. > > Regards, > Freek Dijkstra > plain text document attachment (tooltips.diff) > diff -waur -x Entries -x Entries.log 18xx repos/rails/ui/swing/UpgradesPanel.java 18xx/rails/ui/swing/UpgradesPanel.java > --- 18xx/rails/ui/swing/UpgradesPanel.java 2008-02-19 21:31:58.000000000 +0100 > +++ 18xx/rails/ui/swing/UpgradesPanel.java 2008-06-03 00:30:02.000000000 +0200 > @@ -280,9 +280,32 @@ > } > > public void mouseEntered(MouseEvent e) { > + Object source = e.getSource(); > + if (!(source instanceof JLabel)) return; > + > + if (tokenMode) { > + // nothing to show > + } else { Is there a reason you didn't use "if (!tokenMode)" ? > + protected void setToolTip() > + { > + TileI currentTile = TileManager.get().getTile(internalId); > + StringBuffer tt = new StringBuffer("<html>"); > + tt.append("<b>Tile</b>: ").append(currentTile.getName()); // or getId() Tooltip text should support localization. We can catch this with a second patch. I'll simplify the tokenMode bits, and commit this shortly. ---Brett. |