java代码
1,
Properties prop= new Properties(); try { InputStream is = this.getClass().getResourceAsStream ("/data.properties"); prop.load(is); }catch(Exception e) { // fatal error! System.err.println("FATAL ERROR: application root configuration not found: data.properties"); System.exit(0); } String coreRootRelative = prop.getProperty("COREROOT"); Class c = this.getClass(); URL u = c.getProtectionDomain().getCodeSource().getLocation(); String fileUri = ""; try { fileUri = URLDecoder.decode(u.getFile(), "UTF-8") ; } catch(UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } File f = new File(fileUri); String coreRootBeforeChanges = f.getParent();
2.
protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); int defaultCloseOperation = getDefaultCloseOperation(); if (e.getID() == WindowEvent.WINDOW_CLOSING ){ if(defaultCloseOperation != DO_NOTHING_ON_CLOSE){ this.closeCancel(); } // processActionEvent(new ActionEvent(this, // ActionEvent.ACTION_PERFORMED, CANCEL_COMMAND)); }else if (e.getID() == WindowEvent.WINDOW_OPENED) { // simulate tab from last to wrap around to first & properly set // initial focus if (getComponentCount() > 0) getComponent(getComponentCount() - 1).transferFocus(); } }
标签:
java
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 为DeepSeek添加本地知识库
· .NET程序员AI开发基座:Microsoft.Extensions.AI
· 精选4款基于.NET开源、功能强大的通讯调试工具
· 数据不出内网:基于Ollama+OneAPI构建企业专属DeepSeek智能中台
· 大模型工具KTransformer的安装