neilcsmith-net commented on code in PR #4335:
URL: https://github.com/apache/netbeans/pull/4335#discussion_r914929498
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/ui/FlatViewTabDisplayerUI.java:
##########
@@ -207,40 +220,51 @@ protected void paintTabBackground(Graphics g, int index,
int x, int y, int width
}
private void paintTabBackgroundAtScale1x(Graphics2D g, int index, int
width, int height, double scale) {
- // do not round tab separator width to get nice small lines at 125%,
150% and 175%
- int tabSeparatorWidth = (showTabSeparators && index >= 0) ? (int) (1 *
scale) : 0;
+ boolean selected = isSelected(index);
- // paint background
Color bg = colorForState(index, background, activeBackground,
selectedBackground,
- hoverBackground, attentionBackground);
+ hoverBackground, unselectedHoverBackground,
attentionBackground);
+
+ boolean showSeparator = showTabSeparators &&
+ // Show separators _between_ tabs (not after the last one),
like for editor tabs.
+ index >= 0 && index < getDataModel().size() - 1 &&
+ /* Don't show separators around the selected tab, if there's
already a border or
+ color contrast at its sides. */
+ (!showSelectedTabBorder &&
selectedBackground.equals(activeBackground) ||
+ (!selected && !isSelected(index + 1)));
+
+ int contentBorderWidth = unscaledBorders ? 1 :
HiDPIUtils.deviceBorderWidth(scale, 1);
+ int tabSeparatorWidth = showSeparator ? contentBorderWidth : 0;
+
+ // paint background
g.setColor(bg);
g.fillRect(0, 0, width - (bg != background ? tabSeparatorWidth : 0),
height);
- if (isSelected(index) && underlineHeight > 0) {
- // paint underline if tab is selected
- int underlineHeight = (int) Math.round(this.underlineHeight *
scale);
- g.setColor(isActive() ? underlineColor : inactiveUnderlineColor);
- if (underlineAtTop) {
+ if (selected) {
+ if (showSelectedTabBorder) {
g.setColor(contentBorderColor);
- int borderWidth = (int) (1 * scale);
- g.fillRect(0, 0, borderWidth, height);
- g.fillRect(width - tabSeparatorWidth - borderWidth, 0,
borderWidth, height);
- g.setColor(isActive() ? underlineColor :
inactiveUnderlineColor);
- g.fillRect(0, 0, width - tabSeparatorWidth, underlineHeight);
- } else {
+ g.fillRect(0, 0, width - tabSeparatorWidth,
contentBorderWidth); // Top
Review Comment:
Yes, you're probably right. Leave it. I guess I see the underline as part
of the border - ie. changing that part of the border, whether that border goes
across the bottom or top of the tab. Hadn't considered support for non-opaque
colours.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists