- importcom.sun.jna.win32.StdCallLibrary;
- importcom.sun.jna.*;
- publicinterfaceKernel32extendsStdCallLibrary{
- Kernel32INSTANCE=(Kernel32)Native.loadLibrary("kernel32",Kernel32.class);
- intGetStdHandle(intstdHand);
- booleanSetConsoleTextAttribute(inthConsoleOutput,inttextAtt);
- }
- defout={color,str->
- intptr=Kernel32.INSTANCE.GetStdHandle(-11);
- Kernel32.INSTANCE.SetConsoleTextAttribute(ptr,color);
- print(str);
- Kernel32.INSTANCE.SetConsoleTextAttribute(ptr,3);
- }
- out(13,"windows?"+Platform.isWindows());
- out(14,"X11?"+Platform.isX11());
最后我再这个基础上改了一个数据比对程序,下面是效果图