據我所知add方法的語法是BorderLayout的正確語法
add(Component , String);
前。
add(new Button("North"), BorderLayout.NORTH);
但我在一個類中看到了add方法的語法,並且它傳遞了編譯過程。
add(String , Component);
,這是下面的加入方法:
add("North", new Button("North"));
有人可以解釋我在這裏發生了什麼,如果是這樣去工作,爲什麼?
你檢查過API嗎? – PermGenError
「如果這個工作正常」你試過了嗎? – Aboutblank
我嘗試過,但它工作,但我不知道它爲什麼工作 – user1809300