<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    關鍵詞: HSQL DB, Eclipse 3.1, Apache Commons, Swing Hacks

    16:59 2005-7-23

    HSQL DB里,一個Database由四個文件組成:(如數據庫test)

    test.properties

    test.script

    test.log

    test.data

    test.backup

    propertiest文件定義數據庫的基本設置;

    script包含數據庫表和數據庫對象的定義,還有non-cached tables的數據;

    log包含最近對數據庫進行的操作;

    data包含被緩存表(cached tables)

    HSqlDBJDBC方法分為:

    連接相關的方法

    元數據方法

    數據庫訪問方法

    Hsql建立數據庫:

    在一個項目里執行建立數據庫的代碼,生成的數據庫在Workspace對應的項目文件夾下;

    而在一個項目里調用另一個項目的生成數據庫的方法,生成的數據庫在Eclipse Home文件夾下

    Indicate things are happening in the view –only through jobs

    ***getSite().getAdapter(IWorkbenchSiteProgressService.class)***

    Eclipse3.1的一些新特性:

    Open Untitled File

    A text editor can be opened without creating a file first.

    Simply go to File > New > Untitled Text File.

    Text編輯器也開始支持超鏈接了,按住Ctrl鍵,將鼠標放在URL的上面就可以了

    我以前寫過一篇制作和使用庫插件的文章,制作庫插件得花一點時間,但在3.1里做就非常方便了,

    可以直接將第三方庫轉換為庫插件:

    Create a plug-in from existing JAR

    PDE now provides a wizard that creates a plug-in from existing JAR archives.

    This wizard is ideal if you would like to package third-party non-Eclipse JARs as an

    Eclipse plug-in.

    The wizard can be invoked via File > New > Project > Plug-in from existing JAR archives.

    Java SE6Mustang)要提供中文的Doc了,盡管用英文的Doc已經習慣了,但對于大多數程序員來說

    也是一件好事啊。呵呵(見blogExcellence

    18:03 2005-8-3

    Apache Commons Lang中的一些方法

    首字母大寫打印字符串:StringUtils.capitalize(string);

    打印布爾值,用YesNo表示:BooleanUtils.toStringYesNo(true);

    求一個數值數組中的最大值: NumberUtils.max(array);

    打印數組:ArrayUtils.toString(array);

    測試數值是否在某一范圍:

    Range range = new DoubleRange(90,120);

    range.containsDouble(102.5);

    隨機數:RandomUtils.nextInt(100);

    測試字符串是否為數值:NumberUtils.isNumber(string/*eg. 0x3F*/);

    Stringsplit方法有時會得到意外的結果:

    "aaa|bbb|ccc".split("|") 結果:{,a,a,a,}

    "aaa|bbb|ccc".split("\\|")才能得到正確結果,*+也是如此

    6:58 2005-8-6

    w.k. Eclipse3.1垃圾回收后只占18M內存,我現在可以一直開著Eclipse了,呵呵

    11:19 2005-8-7

    找出Java反編譯利器DJ,打算破解IDEA。

    9:09 2005-8-8

    暈,發現Eclipse的幫助不能顯示了,顯示找不著org.eclipse.help.internal.webapp.data包,

    找到webapp的插件目錄,發現里面的web-inf目錄是小寫的,里面lib目錄包含的servlet.jar

    剛好包括了org.eclipse.help.internal.webapp.data包,可以肯定是web-inf目錄小寫的緣故,

    但為什么會變成小寫的呢,我的D盤數據通過ghost從俱樂部的機器上拷過來的,以前好像聽說過

    一些軟件不支持大小寫,不出意外的話,就是ghost幫我改的咯。

    16:00 2005-8-10

    看一個項目的源代碼時,如果出現字符方面的錯誤,有可能是Encoding沒有設置好,

    看看Readme要求怎么設(一般要設為UTF-8

    19:30 2005-8-11

    運行程序和瀏覽URL(包括mailto::

    /** Launch default browser on Windows */

    if (GlobalSettings.isWindows())

    {

    Program.launch(localHref);

    }

    19:38 2005-8-11

    mailto:?body=TheEmailBody&subject=TheSubject

    15:14 2005-8-12

    Shell最小化:shell.setMinimized(true);

    18:19 2005-8-18

    JDK5.0文檔,CHM版本的:

    http://www.matrix.org.cn/resource/upload/content/2005_07_30_191519_vorbArhhNZ.chm

    22:47 2005-8-25

    Get Large File Icons

    Not to leave Windows lonely, here is an undocumented class that will let you obtain large desktop icons and other file information. The FileSystemView only provides access to file icons of a "default" size, which usually means 16 by 16 pixels. If you look at your operating system desktop, however, you may see icons that are much bigger, with more detail. There is no standardized way of getting to the larger icons, but on Windows you can use the hidden class called sun.awt.shell.ShellFolder to retrieve larger (32 by 32) desktop file icons. This class is only available in Sun's JVM, so it won't work with other vendors, or on other platforms.

    The code below will take a filename and show the file's large icon in a window.

    public class LargeIconTest {

    public static void main(String[] args) throws Exception {

    // Create a File instance of an existing file

    File file = new File(args[0]);

    // Get metadata and create an icon

    sun.awt.shell.ShellFolder sf =

    sun.awt.shell.ShellFolder.getShellFolder(file);

    Icon icon = new ImageIcon(sf.getIcon(true));

    System.out.println("type = " + sf.getFolderType());

    // show the icon

    JLabel label = new JLabel(icon);

    JFrame frame = new JFrame();

    frame.getContentPane().add(label);

    frame.pack();

    frame.show();

    }

    }

    ShellFolder is a wrapper for the metadata of the selected file. From this object, you can retrieve both the icon and a text description of the file's type. If you run this on an MP3 file, it might print the string "type = MPEG Layer 3 Audio" and show a 32 by 32 pixel iTunes MP3 icon.

    Change the Look and Feel of an App from the Command Line

    Sometimes, Swing applications don't provide a way to change a look and feel at runtime. When using an application like this, you can override the default look and feel with your own setting from the command line using the swing.defaultlaf property.

    java -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel

    myapp.MainClass

    You can also use this technique to apply a new look and feel that the original developer never thought of.

    Hacks for the Metal Look and Feel

    There are a variety of undocumented properties that control the look of Metal, Swing's cross-platform look and feel. JTree nodes can have lines connecting children to their parent, but depending on your current setup, the lines may or may not be showing. You can control the lines with a client property called JTree.lineStyle. Add this code after you create your JTree.

    // show the lines in a JTree

    tree.putClientProperty("JTree.lineStyle", "Angled");

    // hide the lines in a jtree

    tree.putClientProperty("JTree.lineStyle", "None");

    One of the big complaints about Metal is that the menus and labels use bold fonts. With another quick undocumented system property, you can turn that off.

    java -Dswing.boldMetal=false myapp.MainClass

    You can also turn on the rollover for JToolBar buttons by using a secret property. A rollover is useful because it gives the user visual feedback that the mouse cursor is over the right place. Given the size of the typical toolbar button, this feedback is essential.

    toolbar.putClientProperty("JToolBar.isRollover",Boolean.TRUE);

    There is a longer (though, by no means comprehensive) list of properties on this wiki page. Swing, and Metal in particular, has lots of undocumented system properties. As you discover them, please add your own comments to the wiki page. Also remember that these are undocumented for a reason, and could easily change or go away in the future. Use them at your own risk.

    Conclusion

    Swing is a powerful toolkit with lots of hidden features that you can use to bring out the best in your application. This article documents just a few interesting techniques. Swing Hacks from O'Reilly covers another 100 hacks to improve your software. None of the techniques I've shown are required features, but they can add a level of polish that will make your apps stand out from the rest. And in a crowded software marketplace, anything that makes your program better than the competition is a good thing.



    版權所有 羅明
    posted on 2005-09-12 21:08 羅明 閱讀(314) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
     
    主站蜘蛛池模板: 嫩草成人永久免费观看| 亚洲色四在线视频观看| 美女视频黄a视频全免费| A国产一区二区免费入口| 国产精品无码亚洲一区二区三区| 亚洲精品在线电影| 亚洲AV午夜成人影院老师机影院| 国产免费怕怕免费视频观看| 国产精品视频免费| 亚洲视频在线免费观看| 两性色午夜视频免费播放| 美美女高清毛片视频黄的一免费 | 337P日本欧洲亚洲大胆艺术图| 亚洲精品视频在线免费| 婷婷亚洲综合五月天小说| 亚洲三区在线观看无套内射| 亚洲日韩中文在线精品第一| 免费jjzz在线播放国产| 国产成人免费a在线资源| 蜜臀91精品国产免费观看| 免费看国产成年无码AV片| 四虎免费影院ww4164h| 最近2019免费中文字幕6| 一区二区三区四区免费视频 | 国产精品亚洲αv天堂无码| 国产免费观看a大片的网站| 啦啦啦手机完整免费高清观看| 国产精品成人免费视频网站京东| 国产在线jyzzjyzz免费麻豆 | 亚洲成a人片毛片在线| 亚洲色偷偷av男人的天堂| 91在线亚洲精品专区| 久久久无码精品亚洲日韩京东传媒| 亚洲av色福利天堂| 亚洲系列中文字幕| 久久久久久亚洲精品影院| 亚洲国产精品久久久久秋霞小| 亚洲AV无码XXX麻豆艾秋| 黄人成a动漫片免费网站| 一级毛片免费观看不收费| 你好老叔电影观看免费|