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

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

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

    關(guān)鍵詞: HSQL DB, Eclipse 3.1, Apache Commons, Swing Hacks

    16:59 2005-7-23

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

    test.properties

    test.script

    test.log

    test.data

    test.backup

    propertiest文件定義數(shù)據(jù)庫的基本設(shè)置;

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

    log包含最近對數(shù)據(jù)庫進(jìn)行的操作;

    data包含被緩存表(cached tables)

    HSqlDBJDBC方法分為:

    連接相關(guān)的方法

    元數(shù)據(jù)方法

    數(shù)據(jù)庫訪問方法

    Hsql建立數(shù)據(jù)庫:

    在一個項目里執(zhí)行建立數(shù)據(jù)庫的代碼,生成的數(shù)據(jù)庫在Workspace對應(yīng)的項目文件夾下;

    而在一個項目里調(diào)用另一個項目的生成數(shù)據(jù)庫的方法,生成的數(shù)據(jù)庫在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鍵,將鼠標(biāo)放在URL的上面就可以了

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

    可以直接將第三方庫轉(zhuǎn)換為庫插件:

    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已經(jīng)習(xí)慣了,但對于大多數(shù)程序員來說

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

    18:03 2005-8-3

    Apache Commons Lang中的一些方法

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

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

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

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

    測試數(shù)值是否在某一范圍:

    Range range = new DoubleRange(90,120);

    range.containsDouble(102.5);

    隨機(jī)數(shù):RandomUtils.nextInt(100);

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

    Stringsplit方法有時會得到意外的結(jié)果:

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

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

    6:58 2005-8-6

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

    11:19 2005-8-7

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

    9:09 2005-8-8

    暈,發(fā)現(xiàn)Eclipse的幫助不能顯示了,顯示找不著org.eclipse.help.internal.webapp.data包,

    找到webapp的插件目錄,發(fā)現(xiàn)里面的web-inf目錄是小寫的,里面lib目錄包含的servlet.jar

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

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

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

    16:00 2005-8-10

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

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

    19:30 2005-8-11

    運(yùn)行程序和瀏覽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.



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

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


    網(wǎng)站導(dǎo)航:
     
     
    主站蜘蛛池模板: 无遮挡免费一区二区三区| 免费毛片在线看不用播放器| 亚洲成A人片在线观看中文| 99免费精品视频| 亚洲一区二区三区免费视频| 亚洲高清国产拍精品青青草原| a在线视频免费观看| 亚洲a级成人片在线观看| 国产成人毛片亚洲精品| 无码av免费毛片一区二区| 污污污视频在线免费观看| 亚洲成年人免费网站| 亚洲欧洲一区二区三区| 性xxxxx免费视频播放| 无码免费又爽又高潮喷水的视频| 久久久亚洲欧洲日产国码二区| 日本一线a视频免费观看| 无码人妻丰满熟妇区免费| 在线视频亚洲一区| 亚洲精品白色在线发布| 亚洲人成色77777在线观看大| 性短视频在线观看免费不卡流畅| 国产A∨免费精品视频| 一本色道久久88亚洲精品综合 | 国产亚洲精品美女久久久久| 亚洲VA中文字幕无码一二三区| 暖暖日本免费在线视频 | 免费国产精品视频| 亚洲美女免费视频| 成全视频免费观看在线看| 国产偷国产偷亚洲高清人| 亚洲综合丁香婷婷六月香| 亚洲国产天堂在线观看| 亚洲午夜AV无码专区在线播放| 美女裸身网站免费看免费网站| 毛片在线全部免费观看| 亚洲免费无码在线| 免费无码午夜福利片69| 九九精品国产亚洲AV日韩| 亚洲男人天堂2018av| 亚洲国产精品日韩在线|