我正在尝试向我的标题栏添加一个按钮。它似乎没有显示,并且出于某种原因隐藏了标题词。
在我的 JFrame 中,我这样做:
CustomTitlePane.editTitleBar(this);
我的职称类:
public class CustomTitlePane extends SubstanceTitlePane {
private static final long serialVersionUID = 1L;
public CustomTitlePane(JRootPane root, SubstanceRootPaneUI ui) {
super(root, ui);
}
public static void editTitleBar(JFrame frame){
JComponent title = SubstanceLookAndFeel.getTitlePaneComponent(frame);
JButton titleButton = new JButton("test");
titleButton.putClientProperty("substancelaf.internal.titlePane.extraComponentKind", ExtraComponentKind.TRAILING);
title.add(titleButton,2);
}
}