小问题,请教各位了:
Class myDialog //这是一个窗体程序,其中有一个jText的文本框
{
T t=new T; //这是一个自定义类
....
}Class T
{
//现在我想在内中对,myDialog类中的jText进行修改,该怎么操作,谢谢!
}
Class myDialog //这是一个窗体程序,其中有一个jText的文本框
{
T t=new T; //这是一个自定义类
....
}Class T
{
//现在我想在内中对,myDialog类中的jText进行修改,该怎么操作,谢谢!
}
解决方案 »
- JSP页面特殊字符的转义
- 关于java多线程问题
- java 的this super 都是分别在哪个类中定义的??
- java如何判断键盘输入双键并读取?
- java proces 的疑难问题
- 关于Applet的问题,高手帮忙
- EJB,Javabean 中的bean翻译成中文到底是什么意思,为什么叫做bean
- java中怎么调用dll啊,而且java程序能编译成dll么
- Eclipse能修改快捷键吗?如果能怎么改呀?
- 熟悉 BigDecimal 这个类的大虾 来谈谈呀
- 求教:linux下RMI的问题
- 有这样一个长字符串,由若干个xml文档加别的字符组成,我想把每个xml文本单独取出来,大家给想想办法!
public modifyJText(JText t){
}
这样,当有一个T的实例后,就可以把myDialog中的JText作为参数进行修改了。
谢谢了
具体实现参照下面的程序。注意去掉序号!
2. import java.awt.event.*;
3. import java.util.*;
4. import javax.swing.*;
5. import javax.swing.Timer;
6.
7. public class InnerClassTest
8. {
9. public static void main(String[] args)
10. {
11. TalkingClock clock = new TalkingClock(1000, true);
12. clock.start();
13.
14. // keep program running until user selects "Ok"
15. JOptionPane.showMessageDialog(null, "Quit program?");
16. System.exit(0);
17. }
18. }
19.
20. /**
21. A clock that prints the time in regular intervals.
22. */
23. class TalkingClock
24. {
25. /**
26. Constructs a talking clock
27. @param interval the interval between messages (in milliseconds)
28. @param beep true if the clock should beep
29. */
30. public TalkingClock(int interval, boolean beep)
31. {
32. this.interval = interval;
33. this.beep = beep;
34. }
35.
36. /**
37. Starts the clock.
38. */
39. public void start()
40. {
41. ActionListener listener = new TimePrinter();
42. Timer t = new Timer(interval, listener);
43. t.start();
44. }
45.
46. private int interval;
47. private boolean beep;
48.
49. private class TimePrinter implements ActionListener
50. {
51. public void actionPerformed(ActionEvent event)
52. {
53. Date now = new Date();
54. System.out.println("At the tone, the time is " + now);
55. if (beep) Toolkit.getDefaultToolkit().beep();
56. }
57. }
58. }