Skip to content

Commit 77d75a1

Browse files
Alexei Voitylovgnu-andrew
authored andcommitted
8349111: Enhance Swing supports
Reviewed-by: abakhtin, andrew, mbalao Backport-of: 8a34c18c6593da54b6b8695d645310db95f23509
1 parent 25101ec commit 77d75a1

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-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, 2017, 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

@@ -3443,8 +3447,10 @@ public void componentAdded(final ContainerEvent e) {
34433447

34443448
private void updateHtmlViews(int index, boolean inserted) {
34453449
final String title = tabPane.getTitleAt(index);
3450+
Boolean htmlDisabled = (Boolean)
3451+
tabPane.getClientProperty("html.disable");
34463452
final boolean isHTML = BasicHTML.isHTMLString(title);
3447-
if (isHTML) {
3453+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
34483454
if (htmlViews == null) { // Initialize vector
34493455
htmlViews = createHTMLVector();
34503456
} else { // Vector already exists

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

Lines changed: 6 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,11 @@ private Color getColor(Component c) {
736736
}
737737

738738
private JLabel getLabel(Component c) {
739+
if (c instanceof JComponent) {
740+
JComponent comp = (JComponent)c;
741+
this.label.putClientProperty("html.disable",
742+
comp.getClientProperty("html.disable"));
743+
}
739744
this.label.setText(getTitle());
740745
this.label.setFont(getFont(c));
741746
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
@@ -482,6 +482,10 @@ public Dimension getPreferredSize() {
482482
} else {
483483
JLabel label;
484484
label = new JLabel( s, JLabel.LEADING );
485+
if (Boolean.TRUE.equals(
486+
this.optionPane.getClientProperty("html.disable"))) {
487+
label.putClientProperty("html.disable", true);
488+
}
485489
label.setName("OptionPane.label");
486490
configureMessageLabel(label);
487491
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
@@ -451,7 +451,11 @@ protected void installListeners() {
451451
}
452452
tabPane.addContainerListener(getHandler());
453453
if (tabPane.getTabCount()>0) {
454-
htmlViews = createHTMLVector();
454+
Boolean htmlDisabled = (Boolean)
455+
tabPane.getClientProperty("html.disable");
456+
if (!(Boolean.TRUE.equals(htmlDisabled))) {
457+
htmlViews = createHTMLVector();
458+
}
455459
}
456460
}
457461

@@ -4017,8 +4021,10 @@ else if (name =="indexForTitle") {
40174021

40184022
private void updateHtmlViews(int index, boolean inserted) {
40194023
String title = tabPane.getTitleAt(index);
4024+
Boolean htmlDisabled = (Boolean)
4025+
tabPane.getClientProperty("html.disable");
40204026
boolean isHTML = BasicHTML.isHTMLString(title);
4021-
if (isHTML) {
4027+
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
40224028
if (htmlViews==null) { // Initialize vector
40234029
htmlViews = createHTMLVector();
40244030
} else { // Vector already exists

0 commit comments

Comments
 (0)