编程教程
您现在的位置: 中国个人站长站 >> 网络编程 >> Javascript >> 教程正文 为JEdit设置墙纸(add wallpaper for jedit)
推荐位

为JEdit设置墙纸(add wallpaper for jedit)

中国个人站长站 Javascript 点击数: 更新时间:2007-7-27 23:16:24

1). 前提(condition)
+ jedit4.2final
+ jdk 1.4
2). 步骤(steps)
1. add this at org.gjt.sp.jedit.textarea.TextAreaPainter
in method paintComponent(...)
after:
        extensionMgr.paintScreenLineRange(textArea, gfx, firstInvalid,
                lastInvalid, y, height);
add:
        { // paint wallpaper after all that should be paint
        Rectangle rect = this.getVisibleRect();
        Wallpaper.paintWallpaper(gfx, rect.x, rect.y, rect.width,
                rect.width, this);
        }
        
2. add in org.gjt.sp.jedit.textarea.JEditTextArea        
//    {{{ changeWallpaperDialog() method   
// for change the wallpaper
    /**    
     * Displays the 'changeWallpaperDialog' dialog box.
     * @author neoedmund
     */
    public void changeWallpaperDialog()
    {    
        if (Wallpaper.changeWallpaper(this)){
            repaint();        
        }
    } //}}}

3. add new class org.gjt.sp.jedit.textarea.Wallpaper
/*
 * Created on 2005-3-26
 */
package org.gjt.sp.jedit.textarea;

import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;
import javax.swing.JComponent;
import javax.swing.JFileChooser;

/**
 * @author neoe
 */
public class Wallpaper {
    
    static BufferedImage pic;
    private static final String DEFALUT_IMG = "org/gjt/sp/jedit/icons/wallpaper.jpg";
    static{
        System.out.println("hello Wallpaper");
        loadPic(ClassLoader
                .getSystemResourceAsStream(DEFALUT_IMG));        
    }    
    static AlphaComposite alpha = AlphaComposite.getInstance(
            AlphaComposite.SRC_

[1] [2] [3] 下一页

教程录入:swh    责任编辑:swh 
个人站长站与你风雨同舟!
本站所提供的资源均来源于互联网,如有侵权行为,请与本站管理员联系,我们会第一时间删除!
·如果您发现《为JEdit设置墙纸(add wallpaper for jedit)》文章有错误,也请通知我们修改!
联系邮箱chinageren#126.com,谢谢支持!
站内搜索:
广告服务 | 友情链接 | 联系我们 | 免责声明 | 用户留言 | 网站导航
版权所有:中国个人站长站 2007-2008 未经授权禁止复制或建立镜像 客服QQ号:112731235
copyright © 2007-2008 www.ChinaGeRen.com online services. all rights reserved. 苏ICP备05000059号