锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久热综合在线亚洲精品,香蕉视频国产精品,亚洲午夜日本在线观看 http://www.aygfsteel.com/kissjava/category/30380.htmlzh-cn Thu, 20 Aug 2009 02:59:30 GMT Thu, 20 Aug 2009 02:59:30 GMT 60 鍩轟簬pureMVC鐨凷wing紼嬪簭鐨勫叆闂ㄤ粙緇?/title> http://www.aygfsteel.com/kissjava/archive/2009/08/20/291888.htmlkissjava kissjava Wed, 19 Aug 2009 16:36:00 GMT http://www.aygfsteel.com/kissjava/archive/2009/08/20/291888.html http://www.aygfsteel.com/kissjava/comments/291888.html http://www.aygfsteel.com/kissjava/archive/2009/08/20/291888.html#Feedback 0 http://www.aygfsteel.com/kissjava/comments/commentRss/291888.html http://www.aygfsteel.com/kissjava/services/trackbacks/291888.html PureMVC妗嗘灦鐨勭洰鏍囧緢鏄庣‘錛屽嵆鎶婄▼搴忓垎涓轟綆鑰﹀悎鐨勪笁灞傦細Model銆乂iew鍜孋ontroller銆傞檷浣庢ā鍧楅棿鐨勮﹀悎鎬э紝鍚勬ā鍧楀浣曠粨鍚堝湪涓璧峰伐浣滃浜庡垱寤烘槗鎵╁睍錛屾槗緇存姢鐨勫簲鐢ㄧ▼搴忔槸闈炲父閲嶈鐨勩傚湪PureMVC瀹炵幇鐨勭粡鍏窶VC鍏冭璁℃ā寮忎腑錛岃繖涓夐儴鍒嗙敱涓変釜鍗曚緥妯″紡綾葷鐞嗭紝鍒嗗埆鏄疢odel銆乂iew鍜孋ontroller銆備笁鑰呭悎縐頒負鏍稿績灞傛垨鏍稿績瑙掕壊銆侾ureMVC涓繕鏈夊彟澶栦竴涓崟渚嬫ā寮忕被鈥擣acade錛孎acade鎻愪緵浜嗕笌鏍稿績灞傞氫俊鐨勫敮涓鎺ュ彛錛屼互綆鍖栧紑鍙戝鏉傚害銆? 闃呰鍏ㄦ枃 ]]> JFrame錛孞Dialog錛孞InternalFrame鍏抽棴鐨勬嫤鎴?/title> http://www.aygfsteel.com/kissjava/archive/2009/08/14/291210.htmlkissjava kissjava Fri, 14 Aug 2009 14:58:00 GMT http://www.aygfsteel.com/kissjava/archive/2009/08/14/291210.html http://www.aygfsteel.com/kissjava/comments/291210.html http://www.aygfsteel.com/kissjava/archive/2009/08/14/291210.html#Feedback 0 http://www.aygfsteel.com/kissjava/comments/commentRss/291210.html http://www.aygfsteel.com/kissjava/services/trackbacks/291210.html 闃呰鍏ㄦ枃 ]]> 鍥哄畾JTable涓殑鍓嶅嚑鍒?/title> http://www.aygfsteel.com/kissjava/archive/2009/08/12/290907.htmlkissjava kissjava Wed, 12 Aug 2009 15:22:00 GMT http://www.aygfsteel.com/kissjava/archive/2009/08/12/290907.html http://www.aygfsteel.com/kissjava/comments/290907.html http://www.aygfsteel.com/kissjava/archive/2009/08/12/290907.html#Feedback 1 http://www.aygfsteel.com/kissjava/comments/commentRss/290907.html http://www.aygfsteel.com/kissjava/services/trackbacks/290907.html 闃呰鍏ㄦ枃 ]]> Swing涓負鏂囨湰緇勪歡瀹氬埗緇熶竴鐨勮彍鍗?/title> http://www.aygfsteel.com/kissjava/archive/2009/06/27/284430.htmlkissjava kissjava Sat, 27 Jun 2009 15:31:00 GMT http://www.aygfsteel.com/kissjava/archive/2009/06/27/284430.html http://www.aygfsteel.com/kissjava/comments/284430.html http://www.aygfsteel.com/kissjava/archive/2009/06/27/284430.html#Feedback 4 http://www.aygfsteel.com/kissjava/comments/commentRss/284430.html http://www.aygfsteel.com/kissjava/services/trackbacks/284430.html 闃呰鍏ㄦ枃 ]]> 涓涓彲鎺掑簭鐨凧List http://www.aygfsteel.com/kissjava/archive/2008/12/20/247531.htmlkissjava kissjava Sat, 20 Dec 2008 10:52:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/12/20/247531.html http://www.aygfsteel.com/kissjava/comments/247531.html http://www.aygfsteel.com/kissjava/archive/2008/12/20/247531.html#Feedback 2 http://www.aygfsteel.com/kissjava/comments/commentRss/247531.html http://www.aygfsteel.com/kissjava/services/trackbacks/247531.html 闃呰鍏ㄦ枃 ]]> Swing is Especially Effective If... http://www.aygfsteel.com/kissjava/archive/2008/11/27/242972.htmlkissjava kissjava Thu, 27 Nov 2008 03:57:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/11/27/242972.html http://www.aygfsteel.com/kissjava/comments/242972.html http://www.aygfsteel.com/kissjava/archive/2008/11/27/242972.html#Feedback 0 http://www.aygfsteel.com/kissjava/comments/commentRss/242972.html http://www.aygfsteel.com/kissjava/services/trackbacks/242972.html
You know your target domain or business logic, so that you are able to design expressive and concise domain objects.
You are thinking in "swing models", not the UI-components. If you understand your domain, you probably have an idea as well how to visualize the business concepts in object oriented way. The use of Swing models just becomes natural.
You are starting with the domain objects covered with unit tests, then develop the Swing models - after that the work is almost complete. You "only" have to create the view and pass the model to it.
You are NOT trying to work with the views directly and force them to behave in your way. This could become quite complex, cumbersome and very hard to maintain. E.g. if you are working with the JTable directly, instead of TableModel , even reordering the table columns can cause you some headaches. The are no issues with a custom model in this case.
The use of TableCellRenderers and TableCellEditors in JTable s helps you to visualize you domain objects directly - without any overhead.
You are using visual designers like e.g. Matisse in pragmatic way and separate the generated, from your code.
You have a clear concept how to bind (e.g. with reflection+annotations or JSR-295) the UI-components to domain objects and how and where to validate the input (e.g. in controllers, domain objects or converters).
Try to leverage existing JavaBean patterns like PropertyChangeListener , PropertyChangeSupport and the already built-in listeners in the UI-components. There is lot of stuff which can be reused.
If you spend more than half hour to solve a specific "Swing-problem", just stop hacking and use google to find a solution for your problem. There are amazingly good tutorials, articles and posts out there.
If you lose your motivation. Just stop developing Swing, build a quick prototype with SWT/JFace for few hours (but use Tables and Trees). Your motivation should increase dramatically after this experiment :-)
From: Adam Bien's Weblog
]]>java瀹炵幇緋葷粺鎵樼洏 http://www.aygfsteel.com/kissjava/archive/2008/07/30/218654.htmlkissjava kissjava Wed, 30 Jul 2008 03:49:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/07/30/218654.html http://www.aygfsteel.com/kissjava/comments/218654.html http://www.aygfsteel.com/kissjava/archive/2008/07/30/218654.html#Feedback 13 http://www.aygfsteel.com/kissjava/comments/commentRss/218654.html http://www.aygfsteel.com/kissjava/services/trackbacks/218654.html 鍦╦dk1.6涔嬪墠娌℃湁姝ょ被瀹炵幇錛屼箣鍓嶆湁浜烘湁鐢↗NI璋冪敤C++瀹炵幇鐨勶紝浣?.6涔嬪悗灝辨柟渚垮浜嗐?nbsp; 闃呰鍏ㄦ枃 ]]> 鑷畾涔塀utton鐨勪嬌鐢ㄦ晥鏋滀負浣曚笉涓鏍鳳紵 http://www.aygfsteel.com/kissjava/archive/2008/05/11/199818.htmlkissjava kissjava Sun, 11 May 2008 05:44:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/05/11/199818.html http://www.aygfsteel.com/kissjava/comments/199818.html http://www.aygfsteel.com/kissjava/archive/2008/05/11/199818.html#Feedback 2 http://www.aygfsteel.com/kissjava/comments/commentRss/199818.html http://www.aygfsteel.com/kissjava/services/trackbacks/199818.html 闃呰鍏ㄦ枃 ]]> 濡備綍浣垮彲緙栬緫鐨凧ComboBox鐨勮緭鍏ユ楂樹寒鏄劇ず錛?/title> http://www.aygfsteel.com/kissjava/archive/2008/04/02/190383.htmlkissjava kissjava Wed, 02 Apr 2008 07:27:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/04/02/190383.html http://www.aygfsteel.com/kissjava/comments/190383.html http://www.aygfsteel.com/kissjava/archive/2008/04/02/190383.html#Feedback 2 http://www.aygfsteel.com/kissjava/comments/commentRss/190383.html http://www.aygfsteel.com/kissjava/services/trackbacks/190383.html 闃呰鍏ㄦ枃 ]]> 涓篔Table娣誨姞JScrollPane緇檆orner璁劇疆棰滆壊 http://www.aygfsteel.com/kissjava/archive/2008/03/21/187739.htmlkissjava kissjava Fri, 21 Mar 2008 09:08:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/03/21/187739.html http://www.aygfsteel.com/kissjava/comments/187739.html http://www.aygfsteel.com/kissjava/archive/2008/03/21/187739.html#Feedback 0 http://www.aygfsteel.com/kissjava/comments/commentRss/187739.html http://www.aygfsteel.com/kissjava/services/trackbacks/187739.html 闃呰鍏ㄦ枃 ]]> 鍏充簬JTable錛屼負浣曡繖鏍鳳紵 http://www.aygfsteel.com/kissjava/archive/2008/03/21/187671.htmlkissjava kissjava Fri, 21 Mar 2008 04:31:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/03/21/187671.html http://www.aygfsteel.com/kissjava/comments/187671.html http://www.aygfsteel.com/kissjava/archive/2008/03/21/187671.html#Feedback 6 http://www.aygfsteel.com/kissjava/comments/commentRss/187671.html http://www.aygfsteel.com/kissjava/services/trackbacks/187671.html 涓嬪懆瀹屾垜灝卞伐浣滄弧涓騫村暒銆傚洖鎯沖ぇ閮ㄥ垎鐨勬椂闂撮兘琚ソ濂囧績緇欏崰鍘諱簡錛岃繖涓粍浠跺ソ鐜╁紕涓涓嬶紝閭d釜濂界帺涔熷紕涓涓嬶紝鏈鍚庢墜閲岃繕鏄粈涔堥兘娌″緱錛岃屾湰韜殑宸ヤ綔鏄熀浜巗wing錛屽掓槸娌¤姳澶氬皯綺懼姏錛屾渶鍚庝篃鏄swing涓鐭ュ崐瑙o紝浠婂ぉ鎯崇爺絀剁爺絀朵笅talbe錛屽嵈鍙戠幇琚繖涔堜釜闂緇欏崱浣忎簡銆?br />
鏄繖鏍風殑緇橳ableModel浼犲叆琛ㄥご鍜屽唴瀹癸紝浣嗘槸鐩存帴灝唗able鍔犲埌frame涓幓錛宼able鏄劇ず涓嶄簡琛ㄥご濡傚浘1錛屼絾鏄皢table鏀懼埌JScrollPane涓幓錛屽嵈鑳芥樉紺猴紝濡傚浘2銆?br />
鍥句竴
鍥句簩
涓轟粈涔堣繖鏍鳳紵瀹炲湪鏄紕涓嶆槑鐧斤紝涓嶇煡閬撴湁閭d綅楂樻墜鎸囩偣涓嬩笉錛?br />
婧愮爜濡備笅錛?br />
package kissJava.JTable;
import javax.swing. * ;
import javax.swing.table. * ;
import java.awt. * ;
public class TestSortedTable {
public static void main(String args[]) {
JFrame frame = new JFrame( " JTable鐨刪eader嫻嬭瘯 " );
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rows[][] = {
{ " 鐜嬫槑 " , " 涓浗 " , 44 } ,
{ " 濮氭槑 " , " 涓浗 " , 25 } ,
{ " 璧靛瓙榫?/span>" , " 瑗胯渶 " , 1234 } ,
{ " 鏇規搷 " , " 鍖楅瓘 " , 2112 } ,
{ " Bill Gates " , " 緹庡浗 " , 45 } ,
{ " Mike " , " 鑻卞浗 " , 33 } } ;
String columns[] = { " 濮撳悕 " , " 鍥界睄 " , " 騫撮緞 " } ;
TableModel model = new DefaultTableModel(rows, columns);
JTable table = new JTable(model);
RowSorter < TableModel > sorter = new TableRowSorter < TableModel > (model);
table.setRowSorter(sorter);
JScrollPane pane = new JScrollPane(table);
frame.add(pane, BorderLayout.CENTER); // 鏄劇ずheader
// frame.add(table, BorderLayout.CENTER); // 涓嶆樉紺篽eader
frame.setSize( 300 , 150 );
frame.setVisible( true );
}
}
]]> 澶勭悊A4涓嶈兘鎵撳嵃澶у浘鐗?/title> http://www.aygfsteel.com/kissjava/archive/2008/03/05/183898.htmlkissjava kissjava Wed, 05 Mar 2008 03:23:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/03/05/183898.html http://www.aygfsteel.com/kissjava/comments/183898.html http://www.aygfsteel.com/kissjava/archive/2008/03/05/183898.html#Feedback 1 http://www.aygfsteel.com/kissjava/comments/commentRss/183898.html http://www.aygfsteel.com/kissjava/services/trackbacks/183898.html 闃呰鍏ㄦ枃 ]]> JComboBox鐨勪笅鎷夋鍚戜笂 http://www.aygfsteel.com/kissjava/archive/2008/03/05/183895.htmlkissjava kissjava Wed, 05 Mar 2008 03:21:00 GMT http://www.aygfsteel.com/kissjava/archive/2008/03/05/183895.html http://www.aygfsteel.com/kissjava/comments/183895.html http://www.aygfsteel.com/kissjava/archive/2008/03/05/183895.html#Feedback 1 http://www.aygfsteel.com/kissjava/comments/commentRss/183895.html http://www.aygfsteel.com/kissjava/services/trackbacks/183895.html
鏈榪戝涔燬WING錛屾敼鍙楯ComboBox鐨勭殑鏄劇ず鏂瑰紡錛岃繖閲屾槸灝咼ComboBox鐨勪笅鎷夋鍚戜笂鏄劇ず錛屼互涓嬩負璇︾粏浠g爜錛?
package kissJava.JComboBox;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup;
public class PopupComboSample extends JFrame ... {
String labels[] = ... { " Chardonnay " , " Sauvignon " , " Riesling " , " Cabernet " ,
" Zinfandel " , " Merlot " , " Pinot Noir " , " Sauvignon Blanc " ,
" Syrah " , " Gewurztraminer " } ;
JComboBox jcb = null ;
public PopupComboSample() ... {
this .setTitle( " 涓嬫媺妗嗗悜涓?/span>" );
this .setLayout( null );
jcb = new JComboBox(labels);
// setUI.......
jcb.setUI((ComboBoxUI) MyComboBoxUI.createUI(jcb));
jcb.setBounds( 50 , 150 , 200 , 20 );
this .add(jcb, null );
setSize( 300 , 300 );
setVisible( true );
}
public static void main(String args[]) ... {
new PopupComboSample();
}
static class MyComboBoxUI extends BasicComboBoxUI ... {
int newsBarTitleWidth = 0 ;
public static ComponentUI createUI(JComponent c) ... {
return new MyComboBoxUI();
}
// 鏀瑰彉綆ご鐨勬柟鍚?/span>
protected JButton createArrowButton() ... {
JButton button = new BasicArrowButton(BasicArrowButton.NORTH);
return button;
}
// 鏀瑰彉comboBox鐨勫脊鍑烘柟鍚?/span>
protected ComboPopup createPopup() ... {
BasicComboPopup popup = new BasicComboPopup(comboBox) ... {
public void show() ... {
// 澶у皬鎸夐渶瑕佹洿鏀?/span>
Dimension popupSize = new Dimension( 200 - newsBarTitleWidth - 5 , 17 * 5 );
scroller.setMaximumSize(popupSize);
scroller.setPreferredSize(popupSize);
scroller.setMinimumSize(popupSize);
show(comboBox, newsBarTitleWidth, - 17 * 5 ); // getPopupHeightForRowCount(10));
}
};
popup.getAccessibleContext().setAccessibleParent(comboBox);
return popup;
}
}
}
鏄劇ず鏁堟灉涓猴細
涓嶈繃鐪嬪浘鐨勬晥鏋渏cb鐨勮緭鍏ユ娌℃湁綰挎潯鏄劇ず錛岀湅鏉ュ緱鍐嶆敼鏀癸紝瀛︿範涓傘傘傘傘傘傘?/p>
]]>
主站蜘蛛池模板:
习水县 |
延安市 |
华安县 |
贵港市 |
昭平县 |
宁远县 |
朝阳县 |
观塘区 |
德庆县 |
马龙县 |
南乐县 |
万荣县 |
凤城市 |
纳雍县 |
临夏县 |
迭部县 |
伊宁市 |
江川县 |
绥宁县 |
北辰区 |
永清县 |
安国市 |
云南省 |
和顺县 |
田东县 |
衡阳市 |
桦甸市 |
台安县 |
友谊县 |
乳山市 |
四平市 |
莎车县 |
和龙市 |
合水县 |
荣成市 |
咸阳市 |
长汀县 |
江孜县 |
娄烦县 |
布拖县 |
曲沃县 |