發表文章

目前顯示的是有「Java API」標籤的文章

「Java」「API」Java.lang.System.getProperties()

針對System.getProperty(String key) The java.lang.System.getProperties() method determines the current system properties. The current set of system properties for use by the getProperty(String key) method is returned as a Properties object. If there is no current set of system properties, a set of system properties is first created and initialized. This set of system properties includes values for the following keys − Key Description of Associated Value java.version Java Runtime Environment version java.vendor Java Runtime Environment vendor java.vendor.url Java vendor URL java.home Java installation directory java.vm.specification.version Java Virtual Machine specification version java.vm.specification.vendor Java Virtual Machine specification vendor java.vm.specification.name Java Virtual Machine specification name java.vm.version Java Virtual Machine implementation version java.vm.vendor Java Virtual Machine implementation vendor java....

「Java」「轉貼」java.util.Hashtable 和 java.util.Vector

以下來源,來自於: 因特內軟體-技術專欄 http://www.interinfo.com.tw/edoc/ch20/frontline.htm 在JDK 內建的API 中,java.util.Hashtable 和 java.util.Vector 算是兩個非常相似,卻又用法迴異的物件。兩者相似的地方是,都可以動態的將一些物件放進去,相異的地方則是使用的方法與效率的差別。 Java.util.Vector 是一種JDK 內建的 API,它的定義就是一種能夠自動長大或縮小的陣列形態,其最大的用途就是彌補Array 的彈性不足,在宣告的時後,可以不必宣告其大小,等到物件一個個的加入時,容量不足時就會自動加大容量。使用的方式如下 Vector v=new Vector(); v.addElement("line 1"); v.addElement("line 2"); v.addElement("line 3"); v.addElement("line 4"); 由於Vector 是一種物件,因此操作的方式必需透過 method 來運作,如 新增一個物件 addElement(Object obj); 移除一個物件 removeElement(int Index); 清除所有的物件 removeAllElement(); 在Vector 中的元素是按照你加入的順序一個個排好的,所以如果你要讀取第 n 個元素就非常的方便而快速。但如果你要搜尋 "line 3" 這個元素就比較慢了。 Java.util.H...

[Java][API]Action Listener

Document Reference By: https://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html  The Action Listener API The ActionListener Interface Because ActionListener has only one method, it has no corresponding adapter class. Method Purpose actionPerformed(actionEvent) Called just after the user performs an action. The ActionEvent Class Method Purpose String getActionCommand() Returns the string associated with this action. Most objects that can fire action events support a method called setActionCommand that lets you set this string. int getModifiers() Returns an integer representing the modifier keys the user was pressing when the action event occurred. You can use the ActionEvent -defined constants SHIFT_MASK , CTRL_MASK , META_MASK , and ALT_MASK to determine which keys were pressed. For example, if the user Shift-selects a menu item, then the following expression is nonzero: actionEvent.getModifiers() & ActionEvent.SHIFT_MASK Object get...