<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 羅明 閱讀(316) 評論(0)  編輯  收藏

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


    網站導航:
     
     
    主站蜘蛛池模板: 日本免费电影一区| 免费看成人AA片无码视频吃奶| 99热精品在线免费观看| 亚洲成亚洲乱码一二三四区软件| 五月天婷婷精品免费视频| 国产网站免费观看| 国产亚洲欧美日韩亚洲中文色| 成人免费视频软件网站| 亚洲人成人网毛片在线播放| 国产卡一卡二卡三免费入口| 亚洲精品国产日韩| 日韩特黄特色大片免费视频| 亚洲AV无码成人精品区狼人影院| 国产美女无遮挡免费网站| 一区二区三区视频免费| 亚洲一区二区三区无码中文字幕| 你是我的城池营垒免费观看完整版| 亚洲大成色www永久网站| 亚洲大片免费观看| 亚洲Av高清一区二区三区| 97无码免费人妻超级碰碰碰碰| 亚洲gay片在线gv网站| 丁香亚洲综合五月天婷婷| 一个人看的www视频免费在线观看 一个人看的免费观看日本视频www | 午夜国产大片免费观看| 一区二区三区免费视频网站| 成人毛片免费视频| 美女裸免费观看网站| aa毛片免费全部播放完整| 一个人免费观看视频在线中文| 操美女视频免费网站| 国产精品麻豆免费版| 亚洲av无码一区二区三区人妖| 免费精品国偷自产在线在线| 国产亚洲综合色就色| 青娱乐在线免费观看视频| 成人毛片免费观看视频大全| 国产精品亚洲综合网站| 久久亚洲综合色一区二区三区| 99在线观看视频免费| 国产精品亚洲一区二区三区在线观看 |