2011年11月15日 星期二
jxl
jxl.write.WritableWorkbook workbook = jxl.Workbook.createWorkbook(filename); jxl.write.WritableSheet sheet = workbook.createSheet(tag,0);
jxl.SheetSettings settings = sheet.getSettings();
settings.setFitHeight(1); // 設定預覽列印與列印成為一頁, 高度
settings.setFitWidth(1); // 設定預覽列印與列印成為一頁, 寬度
settings.setOrientation(jxl.format.PageOrientation.LANDSCAPE);//橫印
settings.setFitToPages(true);
WritableCellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);//垂直置中
WritableCellFormat.setAlignment(jxl.format.Alignment.CENTRE);//水平置中
2011年8月18日 星期四
2011年7月7日 星期四
java 1.4.2 invoke 1.5 method
complation with 1.4.2 has no setAlwaysOnTop but run at 1.5 can use method invoke
try
{
JFrame test =new JFrame();
Method setAlwaysOnTop = null;
setAlwaysOnTop = test.getClass().getMethod("setAlwaysOnTop", new Class[] { Boolean.TYPE });
setAlwaysOnTop.invoke(test, new Object[] { new Boolean(true) });
}
catch (Throwable ....
try
{
JFrame test =new JFrame();
Method setAlwaysOnTop = null;
setAlwaysOnTop = test.getClass().getMethod("setAlwaysOnTop", new Class[] { Boolean.TYPE });
setAlwaysOnTop.invoke(test, new Object[] { new Boolean(true) });
}
catch (Throwable ....
2011年5月24日 星期二
JTable specified row
changeSelection(int rowIndex,int columnIndex,boolean toggle,boolean extend) toggle: false, extend: false. Clear the previous selection and ensure the new cell is selected. toggle: false, extend: true. Extend the previous selection to include the specified cell.
toggle: true, extend: false. If the specified cell is selected, deselect it. If it is not selected, select it. toggle: true, extend: true. Leave the selection state as it is, but move the anchor index to the specified location. reference:javaworld, java 1.4.2 api
2011年5月18日 星期三
JFrame title and Windows taskbar
new Thread(){
public void run(){
String status="";
int num=100000000;
for(int i=0;i < num ;i++){
DecimalFormat df=new DecimalFormat("##.##");
status=df.format((double)i/num*100);//percentage
if(i%1000==0){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
frame.setTitle(status+"%");
}
});
}
}
}
}.start();
public void run(){
String status="";
int num=100000000;
for(int i=0;i < num ;i++){
DecimalFormat df=new DecimalFormat("##.##");
status=df.format((double)i/num*100);//percentage
if(i%1000==0){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
frame.setTitle(status+"%");
}
});
}
}
}
}.start();
2010年4月4日 星期日
NetBeans use GTK style
netbeans --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel
or
/etc/netbeans.conf
netbeans_default_options=" ... --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
or
/etc/netbeans.conf
netbeans_default_options=" ... --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
2009年3月16日 星期一
GPG Key Error
Q:
W: GPG error: http://ppa.launchpad.net intrepid Release: 由於沒有公鑰,下列簽名無法進行驗證: NO_PUBKEY 60D11217247D1CFF
A:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 60D11217247D1CFF
W: GPG error: http://ppa.launchpad.net intrepid Release: 由於沒有公鑰,下列簽名無法進行驗證: NO_PUBKEY 60D11217247D1CFF
A:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 60D11217247D1CFF
訂閱:
文章 (Atom)