在 mac 上運行 jGRASP 時不顯示彩色按鈕? (Colored buttons don't show up when jGRASP is run on mac?)


問題描述

在 mac 上運行 jGRASP 時不顯示彩色按鈕? (Colored buttons don't show up when jGRASP is run on mac?)

我不確定我是否可以就 StackOverflow 上的代碼提出不明確的問題,但我目前有一個涉及彩色按鈕的 java 程序。在學校,當我在不是 Mac 的計算機上運行它時,jGRASP 顯示顏色並且運行得非常好,但是在我的個人 Macbook 上,無論我將顏色設置為什麼,單擊時按鈕都是白色並變為灰色. 所以我知道這不可能是我的代碼,除非有專門針對 Mac 的特殊方法,這是值得懷疑的。這是所有 Mac 的問題嗎?我正在使用

     array[x].setForeground(Color.blue); 

方法來設置所有內容。任何幫助將不勝感激!


參考解法

方法 1:

This may depend on the Look&Feel and Java version. In general, a component doesn't have to pay any attention to its foreground color.

(by mk8139Larry Barowski)

參考文件

  1. Colored buttons don't show up when jGRASP is run on mac? (CC BY‑SA 2.5/3.0/4.0)

#java #jgrasp #macos






相關問題

電子郵件地址中帶有 + 字符的 Java 郵件 (Java mail with + character in email address)

如何快速原型化 Java 代碼? (How to quickly prototype Java code?)

如何使用 Maven 在目標(SVN-)服務器上創建 Javadoc? (How to create Javadoc on the target (SVN-) server using Maven?)

為什麼檢查二叉樹有效性的解決方案不起作用? (Why the solution for checking the validity of binary tree is not working?)

Selenium webdriver通過第一個數字找到texy (Selenium webdriver find texy by first digits)

setOnClickListener 沒有在圖像視圖上被調用 (setOnClickListener is not getting called on image view)

繪製多邊形:找不到錯誤 (Drawing Polygon : unable to find error)

半透明 JButton:對像出現在背景中 (Semi-Transparent JButton: Objects appear in Background)

比較同一數組的元素 (Compare elements of the same array)

Java 屏幕截圖小程序 (Java screen capture applet)

Minecraft 1.8.9 Forge Modding 的Java 開發工具包,需要什麼JDK/JRE,代碼是否正確? (Java Development Kit with Minecraft 1.8.9 Forge Modding, What JDK/JRE Is Needed, Is Code Correct?)

java while (resultset.next()) 不返回同一列中的所有數據 (java while (resultset.next()) does not return all data in the same column)







留言討論