Changeset 656 for trunk/src/org/expeditee/items
- Timestamp:
- 01/07/14 12:26:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Item.java
r655 r656 157 157 158 158 protected boolean _filled = true; 159 160 private String _tooltip = null; 161 private Text _tooltipItem = null; 159 162 160 163 public static void DuplicateItem(Item source, Item dest) { … … 174 177 dest.setBorderColor(source.getBorderColor()); 175 178 179 dest.setTooltip(source.getTooltip()); 176 180 dest.setData(source.getData()); 177 181 dest.setTag(source.getTag()); … … 1122 1126 */ 1123 1127 public abstract void paint(Graphics2D g); 1124 1128 1129 public void setTooltip(String tooltip) { 1130 _tooltip = tooltip; 1131 _tooltipItem = null; 1132 } 1133 1134 public String getTooltip() { 1135 return _tooltip; 1136 } 1137 1138 public void paintTooltip(Graphics2D g) { 1139 // don't try to show an empty tooltip 1140 if(_tooltipItem == null) { 1141 if(_tooltip != null && _tooltip.trim().length() != 0) { 1142 _tooltipItem = (Text) getParentOrCurrentFrame().getStatsTextItem(_tooltip); 1143 _tooltipItem.setWidth(300); 1144 } else { 1145 return; 1146 } 1147 } 1148 Rectangle bounds = getPolygon().getBounds(); 1149 _tooltipItem.invalidateAll(); 1150 int x = bounds.x + bounds.width; 1151 if(x + _tooltipItem.getPolygon().getBounds().width > FrameGraphics.getMaxFrameSize().width) { 1152 x = bounds.x - _tooltipItem.getPolygon().getBounds().width; 1153 } 1154 int y = bounds.y + bounds.height; 1155 if(y + _tooltipItem.getPolygon().getBounds().height > FrameGraphics.getMaxFrameSize().height) { 1156 y = bounds.y - _tooltipItem.getPolygon().getBounds().height; 1157 } 1158 _tooltipItem.setPosition(x, y); 1159 _tooltipItem.paint(g); 1160 } 1161 1125 1162 public void paintFill(Graphics2D g) { 1126 1163 Color fillColor = getFillColor();
Note:
See TracChangeset
for help on using the changeset viewer.