Java SWT 窗口居中对齐
public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) {
shell.getSize().y = height;
}
shell.setLocation((width - x) / 2, (height - y) / 2);
}
相关文档:
最近经常和公司做JAVA的兄弟们打交道,由于需要统加密算法,所以要求做一个加密的DLL文件供兄弟们调用,根据网上各位大虾们的经验,在加上个人在摸索过程中的体会,现在将流程以及个人心得贴上,以供以后漫漫程序生涯参考,如有不对的还请各位大力指正。
第一步是编写java类, ......
因数据安全,需要将生成的报表xls,添加水印,所以自已在jxl中进行代码修改。
使用例子
public class testJxl {
public static void main(String[] args) throws Exception {
OutputStream out = new FileOutputStream("./aaaa.xls"); // 写入到FileInputStream
WritableWorkbook wwb= Workbook.createWorkbook(out);
......
8. 当系统处理完成后,报表被显示出来。这是一份商品销售报告,显示的是每类商品的季度销售额以及累计情况。接下来,我们尝试用 Java
创建一个事件响应处理类,把每季度销售额在10万美元以上的数据用红色标示出来。
创建 Java 类
按照如下步骤,用 Java 创建百灵报表(BIRT)的事件响应处理程序。
......
1,int与bytes 转换
int转换成bytes
public
static
final
byte
[]
int2bytes
(
int
value
)
{
return
new
byte
[]
{
(
byte
)(
value
>>>
24
),
(
byte
)(
value
>>>
16
),
......
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://xiaoxinshome.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%20%20%20%20%20 ......