Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Fixes #143: IllegalArgumentException in ribbon band title calculation #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ protected void paintBandTitle(Graphics graphics, Rectangle titleRectangle,

int currLength = (int) fm.getStringBounds(title, g2d).getWidth();
String titleToPaint = title;
while (currLength > titleRectangle.width) {

while ((currLength > titleRectangle.width) && (title.length() > 0)) {
title = title.substring(0, title.length() - 1);
titleToPaint = title + "...";
currLength = (int) fm.getStringBounds(titleToPaint, g2d).getWidth();
}

if (currLength > titleRectangle.width) {
titleToPaint = "";
}

SubstanceSkin skin = SubstanceCoreUtilities.getSkin(this.ribbonBand);

Expand Down