我試圖瞭解一個油漆圖形,但我的橢圓形不能繪製。有人可以告訴我我做錯了什麼,橢圓形不是繪圖嗎? 我在哪裏犯了一個錯誤? 主要類: import java.awt.EventQueue;
public class Main {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
我想知道如何繪製多行,看起來像分割面板分成部門。 This is the example of lines that I wanted to draw 下面是到目前爲止,我想通了,但它只能畫「X」行的代碼,並在面板上的一個水平線上。我想知道我如何畫上面的圖像。 public void paintComponent(Graphics g){
super.paintComponent(g);
我需要一個小建議如何設置多個顏色的方法setBackgroundColor,我設法做出多種顏色,但只有當程序隨機選擇顏色但我想設置特定4種或五種顏色,這裏是我的代碼的一部分: (所以選擇的對象就可以改變顏色) if (isSelected)
style.setBackgroundColor (new Color ((float) Math.random(),