<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)  編輯  收藏

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


    網站導航:
     
     
    主站蜘蛛池模板: 国产亚洲精品欧洲在线观看| 91在线视频免费播放| 亚洲精品国产国语| 亚洲成人激情在线| 免费人成视网站在线观看不卡| 久久亚洲春色中文字幕久久久| 中文字幕在线免费看线人| 99久久免费国产精品热| 亚洲中文字幕无码久久| 小小影视日本动漫观看免费| 久久大香伊焦在人线免费| 老汉色老汉首页a亚洲| 2048亚洲精品国产| 久久国产乱子伦精品免费强| 亚洲沟沟美女亚洲沟沟| 亚洲综合色婷婷七月丁香| mm1313亚洲国产精品美女| 丁香六月婷婷精品免费观看| 亚洲日韩aⅴ在线视频| 亚洲AV永久无码精品一区二区国产| 亚洲网址在线观看| 国产精品亚洲а∨无码播放| 免费一级黄色毛片| 性做久久久久免费观看| 成人黄网站片免费视频| 一级一级毛片免费播放| 亚洲伊人tv综合网色| 成年女人永久免费观看片| a毛片全部播放免费视频完整18| 久久精品国产亚洲av高清漫画| 日韩免费毛片视频| 成年女人免费视频播放77777| 国产免费高清69式视频在线观看| 亚洲成人福利网站| 亚洲AV无码乱码精品国产| 国产成人免费一区二区三区| 午夜免费啪视频在线观看| 久久免费精品视频| 免费精品无码AV片在线观看| 十八禁无码免费网站| 猫咪免费人成网站在线观看|