java启动程序快捷方式_一个快捷打开工具的实现

publicstaticListpanelItemList=newArrayList();static{

ListPanelItem panelItem=null;

panelItem=newListPanelItem();

panelItem.setName("我的电脑");

File[] roots=File.listRoots();

ItemStruct[] itemStructs=newItemStruct[roots.length+3];for(inti=0; i

String totalSpace=calculateSpace(roots[i].getTotalSpace());

String usableSpace=calculateSpace(roots[i].getUsableSpace());

String name=roots[i].toString().replace("\\","");

itemStructs[i]=newItemStruct( name+"盘 ("+usableSpace+")"+totalSpace,"explorer.exe"+roots[i].toString());

}//windows命令行代码,需要其它的话,自行搜索下window命令行命令。itemStructs[roots.length ]=newItemStruct("网上邻居","explorer.exe ::{208D2C60-3AEA-1069-A2D7-08002B30309D}");

itemStructs[roots.length+1]=newItemStruct("回收站","explorer.exe ::{645FF040-5081-101B-9F08-00AA002F954E}");

itemStructs[roots.length+2]=newItemStruct("记事本","notepad");

panelItem.setItems(itemStructs);

panelItemList.add(panelItem);

panelItem=newListPanelItem();

panelItem.setName("关机管理");

panelItem.setItems(newItemStruct[]

{newItemStruct("关机","Shutdown.exe -s -t 00"),newItemStruct("重启","Shutdown.exe -r -f -t 00"),newItemStruct("取消关机","shutdown -a")

}

);

panelItemList.add(panelItem);

panelItem=newListPanelItem();

panelItem.setName("应用程序");

panelItem.setItems(newItemStruct[]

{//这个是我本机的Tomcat安装位置newItemStruct("启动Tomcat","cmd /c E:\\project\\server\\bin\\startup.bat","E:\\project\\server\\bin"),

}

);

panelItemList.add(panelItem);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值