Skip to content

Commit f07c7d3

Browse files
Alexei VoitylovRealCLanger
authored andcommitted
8349111: Enhance Swing supports
Reviewed-by: abakhtin, mbalao, andrew Backport-of: 8a34c18c6593da54b6b8695d645310db95f23509
1 parent 5b443e9 commit f07c7d3

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -404,7 +404,11 @@ protected void installListeners() {
404404
}
405405
tabPane.addContainerListener(getHandler());
406406
if (tabPane.getTabCount() > 0) {
407-
htmlViews = createHTMLVector();
407+
Boolean htmlDisabled = (Boolean)
408+
tabPane.getClientProperty("html.disable");
409+
if (!(Boolean.TRUE.equals(htmlDisabled))) {
410+
htmlViews = createHTMLVector();
411+
}
408412
}
409413
}
410414

@@ -3446,8 +3450,10 @@ public void componentAdded(final ContainerEvent e) {
34463450

34473451
private void updateHtmlViews(int index, boolean inserted) {
34483452
final String title = tabPane.getTitleAt(index);
3453+
Boolean htmlDisabled = (Boolean)
3454+
tabPane.getClientProperty("html.disable");
34493455
final boolean isHTML = BasicHTML.isHTMLString(title);
3450-
if (isHTML) {
3456+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
34513457
if (htmlViews == null) { // Initialize vector
34523458
htmlViews = createHTMLVector();
34533459
} else { // Vector already exists

src/java.desktop/share/classes/javax/swing/border/TitledBorder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -736,6 +736,10 @@ private Color getColor(Component c) {
736736
}
737737

738738
private JLabel getLabel(Component c) {
739+
if (c instanceof JComponent comp) {
740+
this.label.putClientProperty("html.disable",
741+
comp.getClientProperty("html.disable"));
742+
}
739743
this.label.setText(getTitle());
740744
this.label.setFont(getFont(c));
741745
this.label.setForeground(getColor(c));

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -472,6 +472,10 @@ protected void addMessageComponents(Container container,
472472
}
473473
JLabel label;
474474
label = new JLabel(s, JLabel.LEADING);
475+
if (Boolean.TRUE.equals(
476+
this.optionPane.getClientProperty("html.disable"))) {
477+
label.putClientProperty("html.disable", true);
478+
}
475479
label.setName("OptionPane.label");
476480
configureMessageLabel(label);
477481
addMessageComponents(container, cons, label, maxll, true);

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -456,7 +456,11 @@ protected void installListeners() {
456456
}
457457
tabPane.addContainerListener(getHandler());
458458
if (tabPane.getTabCount()>0) {
459-
htmlViews = createHTMLVector();
459+
Boolean htmlDisabled = (Boolean)
460+
tabPane.getClientProperty("html.disable");
461+
if (!(Boolean.TRUE.equals(htmlDisabled))) {
462+
htmlViews = createHTMLVector();
463+
}
460464
}
461465
}
462466

@@ -4026,8 +4030,10 @@ else if (name =="indexForTitle") {
40264030

40274031
private void updateHtmlViews(int index, boolean inserted) {
40284032
String title = tabPane.getTitleAt(index);
4033+
Boolean htmlDisabled = (Boolean)
4034+
tabPane.getClientProperty("html.disable");
40294035
boolean isHTML = BasicHTML.isHTMLString(title);
4030-
if (isHTML) {
4036+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
40314037
if (htmlViews==null) { // Initialize vector
40324038
htmlViews = createHTMLVector();
40334039
} else { // Vector already exists

0 commit comments

Comments
 (0)