java dnd
dndÊÇdrag and dropµÄËõд.
javaÖеÄdndÖ÷񻃾¼°µ½3¸öÀà:TransferHandler(ÓÃÀ´´¦ÀíÊý¾ÝµÄÍϷŹý³Ì),Transferable(ÓÃÀ´°ü×°ÍϷŵÄÊý¾Ý),ºÍDataFlavor(ÓÃÀ´±íʾÍϷŵÄÊý¾ÝµÄÀàÐÍ).ÏÂÃæÀ´½éÉÜÕâ3¸öÀàµÄ·½·¨
1.javax.swing.TransferHandler
ËüÓÐÁ½¸ö¹¹Ô캯Êý:
TransferHandler() ×ÓÀàµÄ±ã½Ý¹¹Ôì·½·¨¡£
TransferHandler(String property) ¹¹ÔìÒ»¸öͨ¹ý¼ôÌù°å»òÍϷŲÙ×÷¿ÉÒÔ½« Java Bean ÊôÐÔ´ÓÒ»¸ö×é¼þ´«Êäµ½ÁíÒ»¸ö×é¼þµÄ´«Êä´¦Àí³ÌÐò¡£
Èç,JLabelºÍJTextField¶¼ÓÐtextÕâ¸öÊôÐÔ,ËùÒÔ¿ÉÒԺܼòµ¥µØÊµÏÖ´ÓJTextFieldÀïÍÏÎı¾µ½JLabelÀï,¸Ä±äËüµÄÎı¾.ÏÂÃæÊÇÒ»¸öÀý×Ó
ÔÚtextFieldÀïÊäÈëÎı¾ºó,ÍùlabelÀïÍÏ,labelµÄÎı¾¾Í±äΪtextFieldÀïµÄÎı¾ÁË.Èç¹ûҪʵÏÖ´ÓlabelÍùtextFieldÀïÍÏ,»¹ÒªÁíÍâµÄ·½·¨,ÏȲ»Ëµ
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
class LabelDnd
{
JFrame mainFrame;
JPanel mainPanel;
JLabel label;
JTextField textField;
public LabelDnd() {
mainFrame = new JFrame ( );
mainPanel = new JPanel ( new BorderLayout() );
label = new JLabel ("label");
//ÕâÀïµ÷ÓÃÁËTransferHandlerµÄµÚ¶þ¸ö¹¹Ô캯Êý,²ÎÊýÊÇÒ»¸öJava Bean ÊôÐÔ
label.setTransferHandler( new TransferHandler("text") );
textField = new JTextField(20);
//´ò¿ªtextField×Ô´øµÄÍϷʦÄÜ
textField.setDragEnabled( true );
mainPanel.add( label,BorderLayout.PAGE_START );
mainPanel.add( textField,BorderLayout.PAGE_END );
mainFrame.getContentPane().add( mainPanel );
mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
mainFrame.pack();
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible( true );
}
public static&nb
Ïà¹ØÎĵµ£º
finalÀࣺΪ·ÀÖ¹ËûÈË´ÓÄãµÄÀàÉÏÅÉÉúÐÂÀ࣬´ËÀàÊDz»¿ÉÀ©Õ¹µÄ¡£
¡¡¡¡¶¯Ì¬µ÷ÓñȾ²Ì¬µ÷Óû¨·ÑµÄʱ¼äÒª³¤¡£
¡¡¡¡³éÏóÀࣺ¹æ¶¨Ò»¸ö»ò¶à¸ö³éÏó·½·¨µÄÀà±¾Éí±ØÐ붨ÒåΪabstract¡£
¡¡¡¡Àý£º public abstract string getDescripition
¡¡¡¡JavaÖеÄÿһ¸öÀà¶¼ÊÇ´ÓObjectÀàÀ©Õ¹¶øÀ´µÄ¡£
¡¡¡¡objectÀàÖеÄequalºÍtoString·½· ......
JAVA
ѧϰ±Ê¼Ç£¨Ò»£©£º
JAVA
Ìåϵ¼°Æä±à³ÌµÄ¹ý³Ì
°¥£¬±ÏÒµÁËÒ²Ò»¶Îʱ¼äÁË£¬Ö»ÖªµÀÌìÌì³´úÂ룬
JAVA
µÄ»ù´¡ÖªÊ¶»ù±¾ÊÇÍüµôÁË£¬¼ÓÉÏÒÔǰһֱûÓÐϵͳµØÑ§Ï°¹ý£¬¸Ð¾õ¿ìÒª·ÏÁË¡£»¹ÊǺúþ²ÏÂÐÄÀ´Ñ§Ñ§»ù´¡°É¡£²»ÄÜÌìÌ쿼³´úÂë¹ýÈÕ×Ó°¡¡£¡£¡£¡££¨ÏÂÎÄ´ó¶àÀ´×Կα¾ÒÔ¼°Ò»Ð©¼¼ÊõÊÓÆµÉϵÄÄÚÈÝ£¬»ù±¾Àí½âÁËһЩÁË£¬Ê ......
µ¥Àýģʽ£¬¹ËÃû˼Ò壬ֻÄÜÓÐÒ»¸öʵÀý¡£
Ò».´Ó¶àḬ̈߳²È«ËµÆð£¬ÈçÏÂͼ´úÂ룬´ËÎÊÌâ¿ÉÒÔÓÃsynchronized¹Ø¼ü×ÖÀ´½â¾ö¡£¸Ã·½·¨È±µã£ºÃ¿Ò»¸öÏß³ÌÔÚ»ñȡʵÀý¶ÔÏó֮ǰ¶¼ÒªÔÚsynchronizedÉÏͬ²½µÄ¶ÔÏóÉϽøÐеȴý£¬Òò´ËЧÂʲ»¸ß¡£
¶þ.Double Check·½·¨£¬¼ûÏÂͼ´úÂë¡£Double CheckµÄ³õÖÔÊÇÖ»Óе±instanceΪNULLʱִÐеÄÏ̲߳ÅÐèÒªÔÚ ......
ÕýÔò±í´ïʽÊÇ×Ö·û´®´¦ÀíµÄÖÕ¼«ÎäÆ÷£¬±¾ÎÄÒÔÒ»¸ö¾ßÌåÌâÄ¿¼ò½éjava¶ÔÕýÔò±í´ïʽµÄÖ§³Ö¡£
ÌâÄ¿£º½«Ò»¸ö×Ö·û´®ÖеÄÐÎÈçhref=“XXXX”ºÍsrc=“XXXX”µÄ²¿·ÖÈ¡³ö£¬´òÓ¡¡£
´¦ÀíÕýÔò±í´ïʽÖ÷ÒªÓõ½java.util.regex.MatcherºÍjava.util.regex.PatternÁ½¸öÀà¡£
\\²âÊÔÓõÄ×Ö·û´®
String source= "...href=\" ......
£¨1£©¸ù¾ÝxmlÎļþÀ´¹ÜÀíÏ̳߳صÄ×î´ó×îСÏß³ÌÊý
¡¡¡¡£¨2£©¶ÔÏ̳߳ØÍ¨¹ýTimer¶¨ÆÚɨÃèÒÔ·ÀÖ¹Ïß³Ìδ¼¤»î£»
¡¡¡¡£¨3£©Í¨¹ýijһ¸ö±äÁ¿£¨±¾³ÌÐòÖÐÊÇfreeThreadCount£©À´µÃµ½¿ÕÏÐÏ̵߳ÄÊýÄ¿£»
¡¡¡¡Ò»¡¢ÅäÖÃxml£¨listen.xml£©ÊÇ£º
¡¡¡¡<?xml version="1.0" encoding="UTF-8"?>
¡¡¡¡ <config>
¡¡¡¡ <Con ......