File 新增六個方法動態修改權限(支援擁有者/所有人區分):
setExecutable(boolean, boolean) / setExecutable(boolean)setReadable(boolean, boolean) / setReadable(boolean)setWritable(boolean, boolean) / setWritable(boolean)對應查詢方法:canRead()、canWrite()、canExecute() (新增)。失敗回傳 false、安全管理器阻擋拋 SecurityException。
無縫啟動系統預設應用程式:
if (Desktop.isDesktopSupported()) {
Desktop dt = Desktop.getDesktop();
dt.browse(new URI("https://example.com")); // 瀏覽器
dt.mail(new URI("mailto:user@host?subject=Hi")); // 郵件客戶端
dt.open(new File("doc.pdf")); // 開啟檔案/目錄
dt.edit(new File("doc.txt")); // 編輯
dt.print(new File("report.pdf")); // 列印
}
支援 isSupported(Action) 預檢,或直接呼叫捕捉 UnsupportedOperationException。動作列舉:BROWSE, MAIL, OPEN, EDIT, PRINT。
NetworkInterface 新增 10 方法:
getHardwareAddress() (MAC)、getMTU()、getParent()/getSubInterfaces()isUp()、isLoopback()、isPointToPoint()、isVirtual()、supportsMulticast()getInterfaceAddresses() 回傳 InterfaceAddress 列表,含 IP、子網遮罩/前綴長度、廣播位址 (IPv4)。核心類別 TableRowSorter<M>,啟用最簡單:
table.setAutoCreateRowSorter(true);
進階用法:自建 Sorter 並安裝 RowFilter(支援正則):
TableRowSorter sorter = new TableRowSorter<>(model);
sorter.setRowFilter(RowFilter.regexFilter("^A")); // 僅顯示以 A 開頭
table.setRowSorter(sorter);
索引轉換:convertRowIndexToModel(view) / convertRowIndexToView(model)。排序/過濾僅影響視圖,不改變模型資料。
Compiler API、Scripting API (JSR 223)、內建 Java DB (Derby)、JDBC 4.0、XML 數位簽章、改進國際化等。