to terranhao You are right,.我也喜欢,自由。虽然做不出来什么像样的大点的东西。
引用于javalobby: -------------------------------------------------------------------------------- Hello, I was team manager to develop a heavy GUI (hundreds classes, tables with thousands rows updating in real time, charts updated in real time, drag and drop, many background threads performing tasks at the same time...). We first started with Swing (SWT was not released or I didn't know about it), and experienced quite quickly several critical problems. Just a quick example: We needed drag and drop from a table. User selects an area in the table and then click in this area and starts dragging. Problem is that in Swing, mouse down throws the selection change event, not mouse up. So when you click in the selected table area, selection is changed by the click before you can start dragging. The only way to correct this problem was to dig in Swing Look and Feel code, and change it...which is not normal. So we had dozens of such critical problems and also serious performance problems. For example with 10 internal frames with tables updating in real time and charts, we reached 90-100% CPU usage. And this is not caused by a bad usage of Swing API, because we have a long experience with it. We tuned everything including the repaint manager, but we never managed to solve the problem. So, after 2 years development, we decided to try SWT, because we were in a bad situation with Swing. We had too many problems with look and feel, component bugs and performance issues. We translated to SWT. It is lighter than Swing and we had to implement several features which are present in Swing but lacking in SWT. Result: - no more look and feel problem, not even a single one. - 20 tables and charts which took before 100% CPU take now 10% CPU. Our GUI even outperforms native GUIs sometimes. - so we were able to focus on new features instead of spending a lot of time correcting swing bugs and trying desperatly to optimize everything to fight against Swing performance issues. - development process was a lot faster with SWT, even if it is lighter than Swing and requires sometimes more code. Difficult to explain why...after learning to use SWT, it was just easier and faster. So from my experience I can tell you this: - if you want to develop quickly an interface, not too CPU demanding, and look and feel problems are not very critical for you, Swing. - if you need a very professional looking GUI, fast, which never freezes for heavy tasks on CPU, take SWT. You will have to develop some lacking components, but this is reusable for other projects, and developing lacking components in SWT is quicker than fighting all the time with Swing performance issue.
如果大家都不向swing发展
那么swing也就真的没有发展了……
如果是我
100分的信心!
开发的时候是凭借着喜好开发嘛? 需求决定了用什么工具.
我搞MFC,SDK,SWT,Swing,等等...
Swing就是代码看着漂亮...
你多大了?
开发的时候是凭借着喜好开发嘛? 需求决定了用什么工具.
我搞MFC,SDK,SWT,Swing,等等...
Swing就是代码看着漂亮...
会用就可以拉,它只是工具中的一中 学计算机的要学会用适合自己的工具
或许是swing里的事件处理得太合理了
还是代码写起来精彩,
我就是对swing特别的偏好,
工作之余一直在研究,
有志同道合的人可以
加我QQ:270765324
那我也来研究Swing好了应该可以加深自己对java的理解
只可学习,不可用于开发
偏爱swt/jface,因为我用eclipse.
========================
agree
只可学习,不可用于开发
偏爱swt/jface,因为我用eclipse.
----------------------------
如果Sun把IBM的swt的dll包含到JDK我就支持swt.
对Java界面涉及不深的人往往偏好SWT,对Java界面设计非常熟悉才能真正洞悉Swing的内涵。人们对于SWT的喜爱是同他对SWT的了解深刻度成反比的,Swing恰好相反。对于SWT了解越浅的人,越对他的光鲜外表(主要是Eclipse的表现比较好,但毕竟Eclipse的漂亮程度归公于他的界面设计艺术,实质并不在SWT的高级)。随着开发者对于SWT的深入了解,就会发现越来越多的问题和局限性,了解不深的人,或者从传统C/C++,WinForm以及MFC等东东转过了的人,往往被SWT的表面所迷惑。可以不客气的说SWT是AWT早已抛弃的努力。
SWT凭着它对Windows平台的优化迷惑很多人,又以它的编程简单性忽悠了很多人。其实SWT它在Linux的效率和Mac OS上的错误简直要让人发疯。如果你真的想需要Windows平台的界面,干嘛要用Java? C#岂不是更好?
SWT一个迷惑人的地方是所谓平台保真(Fidelity),其实这也造成它不能轻易扩展和Customization的根源,而且,开发者往往喜欢平台保真的界面,而用户却不一定,相当的用户最终喜欢WinAMP等类似可以更换皮肤和LookAndFeel的功能。即使是平台保真度,Java6已经完完全全的实现平台一致性。SWT已经没有优势可言。
SWT的另一个迷惑人的地方就是所谓速度,人们往往认为本地组件就比模拟组件要快,其实不然,由于Java虚拟机和运行时速度的提高,Java编写的程序已经可以与C的速度相媲美,加上Swing内在有虚拟机内嵌代码和热编译的等功能支持,Java实现的Swing代码已经和操作系统本身的组件没有什么两样了。最近有JavaLobby上论坛贴出了一个名字叫MiGLayout,关于测试GUI界面的BenchMark,测试的结果是:
Windows平台上Swing的启动速度稍慢于SWT,运行速度几乎一样。
Linux平台上Swing的速度高于SWT,无论是启动速度还是运行速度。GTK2上的速度差别就更大。
MacOS上Swing的速度高于SWT,无论是启动速度还是运行速度。
IBM当时开发Eclipse时,Swing的确不争气,所以才有了SWT的出现,但是如果当时Sun就把Swing打磨成现在这个样子,估计IBM也不会轻易开发SWT,但也多亏SWT的出现,促使Sun将Swing进行改革。
最近一个国外叫EvansData的咨询公司调查的GUI工具结果是:
swing占有率47%,名列第一,WinForm名列第二,SWT不超过8%
结论是:
SWT不会消亡,因为有Eclipse的存在,如果想为它开发插件,就必须使用SWT。另外和AWT相似,SWT可以应用到Mobile开发界面上,因为Swing毕竟太大了。
Swing因为Java5和6的推动将席卷Java Desktop市场。
毕竟任何的东西的存在都是合理,存在即合理,合理就不可能消逝。80/20的关系。
http://www.javalobby.org/java/forums/t78884.html
http://www.clientjava.com/blog/2005/10/18/1129665205787.html
=============
我29了,做过10年Java编程,8年的C/C++编程,我对C/C++也很爱好,但并不盲目。开发的时候是凭借着喜好开发嘛? 需求决定了用什么工具.
==========================
咱们中国就是这样,使用什么界面工具都由需求决定,就只差怎么写代码他们也要管了。我搞MFC,SDK,SWT,Swing,等等...
==========================
怪不得你对Swing不顺眼,SWT更像MFC代码啊。
我不过我也挺佩服你的,95年才出的Java,你下一年就学了,.厉害
大学时我性格很内向,很喜欢数学,但特别喜欢图形学,开始时使用C编程画图形,后来听说Java特别擅长处理图形,那时没有多少人知道Java,我还是从图书馆里借书获知的。96年年底吧,jdk1.0.1,几乎没有任何Java教程。我喜欢Java早已经经历狂热阶段,现在应该还算理智吧。
比如前面有人说swt是旁门左道甚么的,呵呵.就像tomcat6把? connector的实现好像也换成了本地代码调用Socket.但是我们也不能说它是旁门左道吧? 所以,我还是希望他们能像您这样,东西摸多了,再来决定和选择,而不是被一部分言论,带着走上了宗教式的道路.
我觉得swt更像是swing,而和MFC一点都不像.
我做过swt的东西,swing就是看过一点.MFC我比较熟悉.
就事件来说,swt和swing是一致的,都是走Listener.这点和MFC的消息映射是一点都不一样的.
但是我们来看即便有了Composite模式,但Composite模式通常是构建静态组合,如果要动态的替换一个复合组件内部的子元素如何办呢?如此一来这个组件就只能定义自己的布局形式,而不能定死在这个布局形式内的元素。
其实从用户角度来说一个GUI元素通常就是两种情况要么就是表现,要么就是处于和用户交互状态,这是它们的形态通常不一样。所以组件不仅仅要只定义自己的布局形式,还要给于外部机会来配置当自己的子元素处于这两种状态时相应的UI组件是什么!
swing通过renderer/editor达到了这种灵活性。如swing中JTable,JList,JTree等组件都只是定义了自己的布局形式。并且都可以配置renderer/editor,这样你的renderer/editor实现就接管了组件里面元素的表现形式和交互形态。理论上你可以用任何JComponent作为组件里面元素的表现形式和交互形态。其灵活性和重用性达到了一个巅峰!
以前还聊过一个JTable的例子!
http://www.douban.com/group/topic/1112689/
其实swing的目标就是建立一个独立的GUI系统(独立于OS),所以GUI的绘制都是自己实现(建立在java 2D上)。这样带来的好处就是可以抛开历史包袱,从头开始实现一个灵活,现代,面向对象,真正跨平台的 GUI框架。
当初swing设计思想是卓越的,Swing有着无与伦比的扩展性和灵活性,它采用了很多现代的UI理论,如renderer/editor等。只是碍于实现性能。
但随着swing实现的性能越来越高,硬件环境越来越好。swing的发展一定更好!
要说sun对于swing的失败,不是swing设计思想和架构有问题。而是他们为swing实现的默认look & feel是糟糕的!
它是我第所见的在工业界最优雅和一致的GUI框架。你熟悉了swing你在回头看看MFC时代的GUI库,你会发出这样的感叹:靠,这也能叫OO的抽象!有人说从很多角度来看swing都是一件艺术品,swing非常灵活灵活到你可以几乎定制它的每一个方面。
swing的组件都是四两拨千斤,模型和绘图都是分离的,如
JTable 就有TableModel ---->JTable<-----TableUI,从结构来说JTable完全扮演着控制器的角色.从API的使用者角度来说它是一个MVC体系的外观,让人想起了设计模式中的外观模式.
____________________________________________
这个叫TWaver的东西就是在swing基础上扩展的一套用于电信方面的GUI库.写的非常好,灵活而高效.上面有一个使用TWaver构建的demo.提供了webstart,如果你机器上已近安装了JRE(java 运行环境),那么点那个Launch就可以运行.
国内深入研究swing的人不多,开发TWaver的那帮家伙算NB的!
本人学习swing只有2年时间,可能都是机会的原因才接触到的。
第二份工作就是用这个开发,所以就要学习了,后来换了份工作,本来想涉足其他的j2ee之类的,毕竟这个现在比较火,就业范围也广,可是做这些又要重头再来没有优势,所以不得已,正好有公司需要,又接着干这个了。
像上面有些人说的,我用swing更多的感觉它是艺术,写出的代码确实感觉漂亮,但是执行效率至今没有发现什么优势。有的时候也会发现一些它本身的问题,可能其他的语言也会是这样的吧。
可能是出于某种偏好,舍不得放弃,总觉得里面可以学习的东西太多了,如果消失掉太可惜,而谈到它有什么优点吧,又说不出什么真的让人心服口服的理由。
国内深入研究swing的人是不多,不过也有些牛人啊。
我以前的头,很牛,移民canada了,后来想再招聘一个,也一样牛,薪水还是比较羡慕地!
我再次声明一次: CSDN 真TM烂,烂到我想骂人!
这是我第二次写下上面的内容,第一次好不容易写好了,不知什么原因就搞丢了,建议以后大家如果发表长贴的时候先复制一下再提交。
MD,天下第一烂:::
理由-> 例如,你点击上面“本版我的问题”,如果你不靠IE的后退,保证你没有后路可以退,让你走到死胡同!!!!但愿我用swing做的GUI不会这样被别人骂。
用用就生气!
https://substance.dev.java.net/
https://substance.dev.java.net/
很酷啊,你是项目拥有者之一吗?真牛啊,佩服。我也很喜欢Swing,但估计搞不出这么好的东西。
国外swing做的好的人还是蛮多的!
————————————————————————————————————
一针见血,说的好极了!
感觉Swing挺好的
做毕业设计一直用着,,
我的QQ:390432960。。
为什么JTree要分为N大块,要根据选中的结点找到userObject要几个调用......
因为用他们可以随心所欲
blog.csdn.net/bradwoo8621
我热衷Swing。
You are right,.我也喜欢,自由。虽然做不出来什么像样的大点的东西。
--------------------------------------------------------------------------------
Hello, I was team manager to develop a heavy GUI (hundreds classes, tables with thousands rows updating in real time, charts updated in real time, drag and drop, many background threads performing tasks at the same time...). We first started with Swing (SWT was not released or I didn't know about it), and experienced quite quickly several critical problems.
Just a quick example: We needed drag and drop from a table. User selects an area in the table and then click in this area and starts dragging. Problem is that in Swing, mouse down throws the selection change event, not mouse up. So when you click in the selected table area, selection is changed by the click before you can start dragging.
The only way to correct this problem was to dig in Swing Look and Feel code, and change it...which is not normal. So we had dozens of such critical problems and also serious performance problems. For example with 10 internal frames with tables updating in real time and charts, we reached 90-100% CPU usage. And this is not caused by a bad usage of Swing API, because we have a long experience with it. We tuned everything including the repaint manager, but we never managed to solve the problem. So, after 2 years development, we decided to try SWT, because we were in a bad situation with Swing. We had too many problems with look and feel, component bugs and performance issues.
We translated to SWT. It is lighter than Swing and we had to implement several features which are present in Swing but lacking in SWT. Result:
- no more look and feel problem, not even a single one.
- 20 tables and charts which took before 100% CPU take now 10% CPU. Our GUI even outperforms native GUIs sometimes.
- so we were able to focus on new features instead of spending a lot of time correcting swing bugs and trying desperatly to optimize everything to fight against Swing performance issues.
- development process was a lot faster with SWT, even if it is lighter than Swing and requires sometimes more code. Difficult to explain why...after learning to use SWT, it was just easier and faster. So from my experience I can tell you this: - if you want to develop quickly an interface, not too CPU demanding, and look and feel problems are not very critical for you, Swing. - if you need a very professional looking GUI, fast, which never freezes for heavy tasks on CPU, take SWT. You will have to develop some lacking components, but this is reusable for other projects, and developing lacking components in SWT is quicker than fighting all the time with Swing performance issue.