8349111: Enhance Swing supports

Backport-of: 8a34c18c6593da54b6b8695d645310db95f23509
This commit is contained in:
Prasanta Sadhukhan
2025-02-27 02:33:34 +00:00
committed by Vitaly Provodin
parent 2aad127e57
commit 4caeab6ffb
4 changed files with 28 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -404,7 +404,11 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
}
tabPane.addContainerListener(getHandler());
if (tabPane.getTabCount() > 0) {
htmlViews = createHTMLVector();
Boolean htmlDisabled = (Boolean)
tabPane.getClientProperty("html.disable");
if (!(Boolean.TRUE.equals(htmlDisabled))) {
htmlViews = createHTMLVector();
}
}
}
@@ -3445,8 +3449,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
private void updateHtmlViews(int index, boolean inserted) {
final String title = tabPane.getTitleAt(index);
Boolean htmlDisabled = (Boolean)
tabPane.getClientProperty("html.disable");
final boolean isHTML = BasicHTML.isHTMLString(title);
if (isHTML) {
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
if (htmlViews == null) { // Initialize vector
htmlViews = createHTMLVector();
} else { // Vector already exists

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -738,6 +738,10 @@ public class TitledBorder extends AbstractBorder
}
private JLabel getLabel(Component c) {
if (c instanceof JComponent comp) {
this.label.putClientProperty("html.disable",
comp.getClientProperty("html.disable"));
}
this.label.setText(getTitle());
this.label.setFont(getFont(c));
this.label.setForeground(getColor(c));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -472,6 +472,10 @@ public class BasicOptionPaneUI extends OptionPaneUI {
}
JLabel label;
label = new JLabel(s, JLabel.LEADING);
if (Boolean.TRUE.equals(
this.optionPane.getClientProperty("html.disable"))) {
label.putClientProperty("html.disable", true);
}
label.setName("OptionPane.label");
configureMessageLabel(label);
addMessageComponents(container, cons, label, maxll, true);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -495,7 +495,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
}
tabPane.addContainerListener(getHandler());
if (tabPane.getTabCount()>0) {
htmlViews = createHTMLVector();
Boolean htmlDisabled = (Boolean)
tabPane.getClientProperty("html.disable");
if (!(Boolean.TRUE.equals(htmlDisabled))) {
htmlViews = createHTMLVector();
}
}
}
@@ -4065,8 +4069,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
private void updateHtmlViews(int index, boolean inserted) {
String title = tabPane.getTitleAt(index);
Boolean htmlDisabled = (Boolean)
tabPane.getClientProperty("html.disable");
boolean isHTML = BasicHTML.isHTMLString(title);
if (isHTML) {
if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) {
if (htmlViews==null) { // Initialize vector
htmlViews = createHTMLVector();
} else { // Vector already exists