我按以下方式创建 JFrame。
JFrame f=new JFrame("Title");
f.setUndecorated(true);
f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
但是,我试图显示 JFrame 的自定义工具提示文本(默认情况下它显示“Iconify”)。请帮帮我。
谢谢!
最佳答案
一种方法是使用您需要的工具提示将一些面板添加到框架中:
JPanel panel = new JPanel();
panel.setToolTipText("Message");
frame.add(panel, BorderLayout.CENTER);
如果您有自定义最小化按钮,另一种方法是:
JButton button = new JButton() {
public JToolTip createToolTip() {
JToolTip tip = super.createToolTip();
tip.setBackground(Color.YELLOW);
tip.setForeground(Color.RED);
return tip;
}
关于用于最小化按钮的 Java 自定义工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22500463/