Topic: 求各位大哥帮忙,小弟是新手关于swing

  Print this page

1.求各位大哥帮忙,小弟是新手关于swing Copy to clipboard
Posted by: redfox
Posted on: 2003-04-03 20:02

问两个窗口之间怎么交互>?很幼稚,多谢

2.Re:求各位大哥帮忙,小弟是新手关于swing [Re: redfox] Copy to clipboard
Posted by: jiangns3000
Posted on: 2003-04-03 21:18

是类似于:在一个窗口中选择文本等,然后拖放到另一个窗口中去 之类的交互?

3.Re:求各位大哥帮忙,小弟是新手关于swing [Re: redfox] Copy to clipboard
Posted by: 南京肥牛
Posted on: 2003-04-03 22:13

一个窗口获得另一个的实例即可,获得实例的方法很多,如静态工厂方法等,看你程序的组织了

4.Re:求各位大哥帮忙,小弟是新手关于swing [Re: redfox] Copy to clipboard
Posted by: redfox
Posted on: 2003-04-04 08:49

比如说记事本中主窗口同查找、替换窗口的交互,就是子窗口的一个按钮事件怎么影响主窗口
在顺便问一句什么叫静态窗口方法,是不是用this 作参数,然后在另一个类中构造主类的对象??
谢谢

5.Re:求各位大哥帮忙,小弟是新手关于swing [Re: redfox] Copy to clipboard
Posted by: snowbug
Posted on: 2003-04-05 07:04

redfox wrote:
比如说记事本中主窗口同查找、替换窗口的交互,就是子窗口的一个按钮事件怎么影响主窗口
在顺便问一句什么叫静态窗口方法,是不是用this 作参数,然后在另一个类中构造主类的对象??
谢谢

I would first suggest to grab a Java language book and read it through first so you are familiar with some common concepts.

As of the question, in the Find/Replace window, you change the data model of the main window (which is usually a Document in a text editor). And when the document of the main window changes, its view components get notified of the events automatically and will display the changes. This pattern is called Model-View-Control(MVC), and you should be able to find a handful of tutorials at the Sun's web site.

6.Re:求各位大哥帮忙,小弟是新手关于swing [Re: redfox] Copy to clipboard
Posted by: Jove
Posted on: 2003-04-07 13:11

redfox wrote:
比如说记事本中主窗口同查找、替换窗口的交互,就是子窗口的一个按钮事件怎么影响主窗口
在顺便问一句什么叫静态窗口方法,是不是用this 作参数,然后在另一个类中构造主类的对象??
谢谢


对于这种功能,一种方案是你建一个JDialog的子类,把父Frame作为构造方法的参数传进去, 为类的属性赋值
以后要用就parent.setXXX()
你也可以考虑用内部类,可以用OutClass.this访问外部类
也可以不写类,直接JDialog dlg=new JDialog(this,true);dlg.setBounds(..)

7.关于swing [Re: redfox] Copy to clipboard
Posted by: redfox
Posted on: 2003-04-07 15:38

thanks

8.Re:swing [Re: redfox] Copy to clipboard
Posted by: feiggle
Posted on: 2003-04-09 10:02

得到实例即可,看你的程序组织了


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923