|
|
@ -184,7 +184,10 @@ public class NotificationDialog extends JDialog { |
|
|
|
int widthUnit = messageComponents.stream() |
|
|
|
int widthUnit = messageComponents.stream() |
|
|
|
.map((component) -> { |
|
|
|
.map((component) -> { |
|
|
|
Dimension preferredSize = component.getPreferredSize(); |
|
|
|
Dimension preferredSize = component.getPreferredSize(); |
|
|
|
return preferredSize.getHeight(); |
|
|
|
double width = preferredSize.getWidth(); |
|
|
|
|
|
|
|
double widthFactor = Math.ceil(width / CONTENT_WIDTH); |
|
|
|
|
|
|
|
// 这里的高度是没有限制宽度的,如果限制宽度,高度会变更,所以这里需要加上宽度的影响
|
|
|
|
|
|
|
|
return preferredSize.getHeight() + widthFactor * SIGN_LABEL_DIMENSION.getHeight(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.reduce(Double::sum) |
|
|
|
.reduce(Double::sum) |
|
|
|
.map(calStandardWidth) |
|
|
|
.map(calStandardWidth) |
|
|
|