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

Commit

Permalink
Merge pull request #127 from kharybdys/master
Browse files Browse the repository at this point in the history
Fix #126: Assumes menubar is drawn on top of the icon
  • Loading branch information
cmadsen committed Aug 4, 2014
2 parents ad8f5a1 + 178b2ae commit f30c6a0
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,16 @@ public void paintComponent(Graphics g) {
if (leftToRight) {
xOffset = 5;
Icon icon = this.frame.getFrameIcon();
int iconWidth = 0;
int menuWidth = 0;
if (icon != null) {
xOffset += icon.getIconWidth() + 5;
iconWidth = icon.getIconWidth() + 5;
}

leftEnd = (this.menuBar == null) ? 0
menuWidth = (this.menuBar == null) ? 0
: (this.menuBar.getWidth() + 5);
leftEnd = Math.max(iconWidth, menuWidth);
xOffset += leftEnd;
if (icon != null)
leftEnd += (icon.getIconWidth() + 5);

rightEnd = width - 5;

Expand Down Expand Up @@ -364,15 +365,17 @@ public void paintComponent(Graphics g) {
theTitle = clippedTitle;
}
} else {
xOffset = width - 5;
int iconWidth = 0;
int menuWidth = 0;

Icon icon = this.frame.getFrameIcon();
if (icon != null) {
xOffset -= (icon.getIconWidth() + 5);
iconWidth = (icon.getIconWidth() + 5);
}

rightEnd = (this.menuBar == null) ? xOffset : xOffset
- this.menuBar.getWidth() - 5;
menuWidth = (this.menuBar == null) ? 0 : this.menuBar.getWidth() + 5;
rightEnd = width - Math.max(iconWidth, menuWidth);
xOffset = rightEnd - 5;

// find the rightmost button for the left end
AbstractButton rightmostButton = null;
Expand Down

0 comments on commit f30c6a0

Please sign in to comment.