Skip to content

Commit 88bbe2b

Browse files
Alexei VoitylovRealCLanger
authored andcommitted
8349111: Enhance Swing supports
Reviewed-by: abakhtin, mbalao, andrew Backport-of: 8a34c18c6593da54b6b8695d645310db95f23509
1 parent 10a28c0 commit 88bbe2b

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, 2022, 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

@@ -3445,8 +3449,10 @@ public void componentAdded(final ContainerEvent e) {
34453449

34463450
private void updateHtmlViews(int index, boolean inserted) {
34473451
final String title = tabPane.getTitleAt(index);
3452+
Boolean htmlDisabled = (Boolean)
3453+
tabPane.getClientProperty("html.disable");
34483454
final boolean isHTML = BasicHTML.isHTMLString(title);
3449-
if (isHTML) {
3455+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
34503456
if (htmlViews == null) { // Initialize vector
34513457
htmlViews = createHTMLVector();
34523458
} 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, 2022, 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
@@ -738,6 +738,10 @@ private Color getColor(Component c) {
738738
}
739739

740740
private JLabel getLabel(Component c) {
741+
if (c instanceof JComponent comp) {
742+
this.label.putClientProperty("html.disable",
743+
comp.getClientProperty("html.disable"));
744+
}
741745
this.label.setText(getTitle());
742746
this.label.setFont(getFont(c));
743747
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, 2021, 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, 2022, 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
@@ -495,7 +495,11 @@ protected void installListeners() {
495495
}
496496
tabPane.addContainerListener(getHandler());
497497
if (tabPane.getTabCount()>0) {
498-
htmlViews = createHTMLVector();
498+
Boolean htmlDisabled = (Boolean)
499+
tabPane.getClientProperty("html.disable");
500+
if (!(Boolean.TRUE.equals(htmlDisabled))) {
501+
htmlViews = createHTMLVector();
502+
}
499503
}
500504
}
501505

@@ -4065,8 +4069,10 @@ else if (name =="indexForTitle") {
40654069

40664070
private void updateHtmlViews(int index, boolean inserted) {
40674071
String title = tabPane.getTitleAt(index);
4072+
Boolean htmlDisabled = (Boolean)
4073+
tabPane.getClientProperty("html.disable");
40684074
boolean isHTML = BasicHTML.isHTMLString(title);
4069-
if (isHTML) {
4075+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
40704076
if (htmlViews==null) { // Initialize vector
40714077
htmlViews = createHTMLVector();
40724078
} else { // Vector already exists

0 commit comments

Comments
 (0)