我有两个var elixir = require('laravel-elixir');
var gulp = require('gulp');
var fs = require('fs');
elixir.extend('inlineTask', function(func, watcher) {
var task = new elixir.Task(func.name, func);
if (watcher) {
task.watch(watcher);
}
});
elixir(function(mix) {
mix.inlineTask(function t1() {
console.log('1 -> 2');
return gulp.src('1/1.js')
.pipe(gulp.dest('2'));
}, '1/**/*.js').inlineTask(function t2() {
console.log('2 -> 3');
console.log(fs.existsSync('2/1.js'));
return gulp.src('2/1.js')
.pipe(gulp.dest('3'));
}, '2/**/*.js');
});
。第一个是主要名为JDialog
的人。第二个是名为MainJDialog
的孩子。我在ChildJDialog
JButton
MainJDialog
,按此时按ChildJDialog
进行屏幕显示;
ChildJDialog childJDialog;
childJDialog = new ChildJDialog (MainJDialog.this, true);
childJDialog.setVisible(true);
此外,我在JTextArea
中有几个MainJDialog
填充了用户输入的信息。
我已将JButton
添加到ChildJDialog
,并希望在按下时访问当前正在运行的所有者JTextArea
的特定MainJDialog
文字。
private void getTextOfJTextArea1ButtonActionPerformed(java.awt.event.ActionEvent evt)
{
System.out.println(ChildJDialog.this.getOwner().getClass());
}
结果:
class tryingproject.MainJDialog
以上ActionEvent
给了我真正的所有者JDialog
,但我不知道如何访问其组件。
任何帮助表示赞赏。感谢。
答案 0 :(得分:0)
---已解决---
我在ChildJDialog
中创建了一个构造函数,并在用户调用MainJDialog
时将ChildJDialog
的JTextArea1文本作为参数传递给ChildJDialog
,如下所示;
ChildJDialog childJDialog;
childJDialog = new ChildJDialog (MainJDialog.this, true, textOfJTextArea1);
childJDialog.setVisible(true);
我在ChildJDialog
不是我知道但现在正在工作的确切解决方案。