¿ìËÙÒµÎñͨµÀ

ÖÇÄÜÊý¾ÝʹSwing±£³Ö¼òµ¥ - ±à³ÌÈëÃÅÍø

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-06-17
Æ÷ÒÔ²éÕÒ Object ÀàÐ͵ÄÊý¾Ý£¬Õâ¸ö±à¼­Æ÷ʵ¼ÊÉÏÊÇ Ò»¸ö String ±à¼­Æ÷¡£Ò»µ©Í£Ö¹±à¼­£¬¸Ã±à¼­Æ÷¾Í·µ»ØÒ»¸ö String Öµ£¬Õâ¸ö String Öµ³Ö ¾Ã´æ´¢ÔÚÄ£ÐÍÖУ¬ÆäÖÐʹÓà String ÖµÌæ»» iData ²ãʵÏÖ¡£ÏÂͼÃè»æÁËÒª±£³Ö iData ¼ä½Ó µÄÍêÕûÐÔ±ØÐë×ñÑ­µÄ±à¼­Ë³Ðò¡£

ͼ 5. ±à¼­Ë³Ðò

ÖÇÄÜÊý¾ÝʹSwing±£³Ö¼òµ¥ - ±à³ÌÈëÃÅÍø

ËäÈ»¿ÉÒÔÀ©Õ¹ÒÑÓеı༭Æ÷À´×ñÑ­¸Ã˳Ðò£¬µ«ÕâÖÖ·½·¨ÊDz»ÇÐʵ¼ÊµÄ£»Ëü»áµ¼Ö¹ý¶àµÄÀà ºÍÔì³É²»±ØÒªµÄ¸´ÔÓÐÔ¡£¶¨ÖƱ༭Æ÷ÔÚijЩ¶ÀÌØÇé¿öÏÂÊÇ¿ÉÐеģ¬µ«ÊÇ´ó¶àÊý±à¼­Æ÷½«×ñÑ­ ÏàͬµÄ˳Ðò£¬¿ÉÒÔ½«Õâһ˳Ðò·â×°ÔÚÒ»¸öµ¥¶ÀµÄÀàÖС£iData ¹¤¾ßÏä°üº¬Õâ¸öÀàµÄÒ»¸öʵÏÖ £¬³ÆΪ UniversalTableCellEditor ¡£

UniversalTableCellEditor ʹÓà TableCellEditor µÄÄÚº­¶ø²»ÊÇÆäÀ©Õ¹¡£Ôڱ༭ʱ£¬ UniversalTableCellEditor ´Ó iData ²ãʵÏÖ³éÈ¡³öÊý¾ÝÖµ£¬²¢Ê¹ÓøÃÖµ³õʼ»¯Ëùº¬µÄ TableCellEditor ¡£µ±Í£Ö¹±à¼­Ê±£¬ UniversalTableCellEditor ´Ó TableCellEditor Öмì Ë÷¸ÃÖµ²¢ÏàÓ¦µØÔÚ iData ʵÏÖÖÐÉèÖøÃÖµ¡£Èç¹û¿ªÊ¼Ã»ÓÐÖ¸¶¨±à¼­Æ÷£¬Ôò UniversalTableCellEditor ¼ìË÷ JTable ÖеÄȱʡ±à¼­Æ÷ÒÔ²éÕÒ iData ʵÏÖµÄÊý¾ÝÀàÐÍ¡£

ÔÚÒÔÉÏËùÊöµÄÕû¸ö±à¼­³ÌÐòÍêÈ«·â×°ÔÚ UniversalTableCellEditor ÖС£ÕâÒâζ×Å£¬¿ÉÒÔ Ê¹ÓÃÈκα༭Æ÷£¬ÉõÖÁÊǵÚÈý·½±à¼­Æ÷£¬¶ø²»ÐèҪʵÏÖ iData Âß¼­µÄÀ©Õ¹¡£

ÎÒ½¨Òéͨ¹ý½«Ã¿¸ö TableColumn µÄȱʡ±à¼­Æ÷ÉèÖÃ³É UniversalTableCellEditor À´Éè Öà JTable Öеı༭Æ÷¡£iData ¹¤¾ßÏ京ÓÐÒ»¸ö´øÓм¸¸ö¾²Ì¬ÖúÊÖ·½·¨µÄʵÓÃÀࡣʵÓÃÀàÖÐ µÄ configureTable() ·½·¨¶Ô TableColumns ½øÐбéÀú£¬½«Ã¿¸öµ±Ç°±à¼­Æ÷ÉèÖóɰüº¬ÄÇÒ» ÁÐÒÔÇ°µÄµ¥Ôª±à¼­Æ÷µÄ UniversalTableCellEditor µÄÐÂʵÀý¡£

µ±¹¤¾ßÏäÓëäÖȾÆ÷Ïà¹Øʱ£¬ËüÓоßÓÐÀàËƹ¦ÄÜµÄ UniversalTableCellRenderer £¬Ëü¾ßÓÐ ÓëäÖȾÆ÷ÀàËƵŦÄÜ¡£¹¤¾ßÏäÖл¹°üÀ¨ JTree ºÍ JComboBox/JList µÄͨÓñ༭Æ÷ºÍäÖȾÆ÷ ×éºÏ¡£

ÖÇÄÜÊý¾ÝʹSwing±£³Ö¼òµ¥(9)

ʱ¼ä:2011-04-16 IBM Jonathan Simon

ʾÀý£ºµ¥ÔªÄÚÑéÖ¤±£Ö¤Á˼۸ñ¸ßÓڳɱ¾

±à¼­µÄ±ê×¼À§ÄÑÊÇ µ¥ÔªÄÚÑéÖ¤£¬¼´ÔÚµ¥Ôª±à¼­Í£Ö¹Ö®Ç°½øÐÐÊý¾ÝÑéÖ¤¡£ setData() ·½·¨ ´´½¨ÁËÒ»¸öÓÃÓÚµ¥ÔªÄÚÑéÖ¤µÄ¼¯ÖÐλÖá£Ç뿼ÂÇÕâÑùÒ»¸öʾÀý£¬ÔÚ¶Ô price »ò cost ½øÐÐ±à ¼­Ö®ºó£¬Èç¹û price ÖµµÍÓÚ cost £¬ÔòÓû§Ó¦¸Ã½Óµ½Í¨Öª¡£Õâʱ£¬ÎÒÃÇÏ£ÍûÏòÓû§ÏÔʾÏÂÁÐ Ñ¡Ï

¶ÔÁ½¸öÖµ²»×öÈκδ¦Àí¡£

Ìá¸ß price ʹ֮µÈÓÚ cost ¡£

ÐÞ¸Äδ±à¼­µÄÄǸöÖµ£¬Ê¹Õâ¸öÖµÓë¸Õ±à¼­¹ýµÄÖµÖ®¼äµÄ²îÖµÓë×î³õµÄ¼Û²îÏàµÈ¡£

ÔÚ setData() ·½·¨ÖУ¬ÊµÏÖËüÃÇÏà¶Ô±È½ÏÈÝÒס£ËüÏòÓû§ÌṩÁËÒ»¸ö JOptionPane ÒÔ±ê ʶÊ×Ñ¡µÄÑ¡Ïî¡£Ò»µ©Ñ¡¶¨ÁËij¸öÑ¡ÏÔò»áÖ´ÐмÆËãÒÔÉèÖÃÊʵ±µÄÖµ¡£ÖªµÀʵÏÖÕâÒ»ÒµÎñÂß ¼­µÄËùÓÐÊý¾ÝÖµÒÔ¼°¼¯ÖÐλÖÃÊÇ iData ¼¼ÊõÁé»îÐԵĹؼü¡£

Çåµ¥ 9. µ¥ÔªÄÚÑéÖ¤

String doNotEdit = "Do Not Edit"; String priceEqualsCost = "Price = Cost"; String keepProfitDifference = "Keep Profit Difference"; String keepProfitPercentage = "Keep Profit Percentage"; ... public boolean setData(Object data) { ¡¡¡¡ double newCost = new Double(data.toString()).doubleValue(); ¡¡¡¡ double oldCost = this.bicycle.getCost(); ¡¡¡¡ double price = bicycle.getPrice(); ¡¡¡¡ ((Bicycle)this.getSource()).setCost(newCost); ¡¡¡¡ if (price > newCost) ¡¡¡¡ { ¡¡¡¡¡¡ Object result = JOptionPane.showInputDialog ¡¡¡¡¡¡ ( ¡¡¡¡¡¡¡¡ null, ¡¡¡¡¡¡¡¡ "Cost you have entered is more than the set price for this bicycle" ¡¡¡¡¡¡¡¡ + "\nPlease select from the following options", ¡¡¡¡¡¡¡¡ "", ¡¡

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à
Äã¿ÉÄܶÔÏÂÃæµÄÎÄÕ¸ÐÐHTTP/1.1 401 Access Denied ËȤ
35380.htm" title="Photoshop»æÖƸ߹âË®¾§ÖʸÐË®¾§Æ»¹û" target="_blank">Photoshop»æÖƸ߹âË®¾§ÖʸÐË®¾§Æ»¹û

Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ