Show tooltip for truncated caption

This commit is contained in:
drdev
2014-01-18 02:55:09 +00:00
parent 86cea92ca1
commit 814a8976fb

View File

@@ -324,8 +324,12 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
int cbViewsWidth = this.cbViews.getAutoSizeWidth(); int cbViewsWidth = this.cbViews.getAutoSizeWidth();
int availableCaptionWidth = helper.getParentWidth() - cbViewsWidth - ratioWidth - helper.getX() - 9; int availableCaptionWidth = helper.getParentWidth() - cbViewsWidth - ratioWidth - helper.getX() - 9;
if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it
this.lblCaption.setToolTipText(this.lblCaption.getText());
captionWidth = availableCaptionWidth; captionWidth = availableCaptionWidth;
} }
else {
this.lblCaption.setToolTipText(null);
}
helper.include(this.lblCaption, captionWidth, FTextField.HEIGHT); helper.include(this.lblCaption, captionWidth, FTextField.HEIGHT);
helper.fillLine(this.lblRatio, FTextField.HEIGHT, cbViewsWidth); //leave room for cbViews helper.fillLine(this.lblRatio, FTextField.HEIGHT, cbViewsWidth); //leave room for cbViews
helper.fillLine(this.cbViews.getComponent(), FTextField.HEIGHT); helper.fillLine(this.cbViews.getComponent(), FTextField.HEIGHT);