Head First Java是本挺好的書,講的比較清楚和簡單。主要看原則、概念啥的。語法什麼的,仍是靠谷歌吧:)java
這部分的筆記也有不少了,最近會努力更新和搬運。順便本身也從新讀一下。ui
就醬。想要這本書的能夠私信我:)this
這兩天在看圖形化界面這塊,因此先更新這裏吧。感受java的體系仍是比較嚴謹的,思路都是一致的,比較適合spa
我這種腦子很差用的:)code
import javax.swing.*; // import ActionListener and ActionEvent import java.awt.event.*; // 事件只會通知有實現ActionListener的類 public class haha implements ActionListener { JButton button; public static void main(String[] args) { haha gui = new haha(); gui.go(); } public void go() { JFrame frame = new JFrame(); button = new JButton("click me"); // 向按鈕註冊 button.addActionListener(this); frame.getContentPane().add(button); // exit when closing window frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); // display, yeah frame.setVisible(true); } // 實現interface上的方法,即處理事件的方法 public void actionPerformed(ActionEvent event) { button.setText("I've been clicked!"); } }