[英]How would I get the text of a JLabel (with an icon) explaining what the label is by hovering over the label?
當我在 label 上進行 hover 時,我想看到 JLabel 的文本。 文中詳細解釋了 label 的作用。
您需要通過調用設置工具提示的文本: setToolTipText()
更多關於教程中的工具提示:http://download.oracle.com/javase/tutorial/uiswing/components/tooltip.html
如果要檢索工具提示,則應使用以下內容:
JLabel label;
...//initialize label, etc
String text = label.getToolTipText();
如果您詢問如何設置工具提示,那么您應該執行相反的操作:
JLabel label;
...//initialize label, etc
label.setToolTipText("this is the description of the label");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.