如何在Netbeans中使用事件? [英] How do I use events with Netbeans?

查看:191
本文介绍了如何在Netbeans中使用事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这里有...因为Netbeans在私有方法中声明所有GUI

我无法直接访问它们。所以,点击一下按钮,我该怎么办

就像jTextField1.setText(" Hello!");?


TIA,

Scirious。

解决方案

Scirious写道:

好的,这里有...自Netbeans以来在私有方法中声明所有GUI
我无法直接访问它们。所以,点击一下按钮,我该怎么办呢?像jTextField1.setText(" Hello!");?

TIA,
Scirious。




如果你只想初始化,那么选择GUI中的对象

面板。然后你必须在屏幕右侧的

右侧选择该对象的属性。您可以在那里添加数据。我认为该领域是'b $ b''价值''。您仍然可以在不要

修改之外引用对象。码。请正确引用它。

在此先感谢...

IchBin,Pocono Lake,Pa,USA
http://weconsultants.servebeer.com/JHackerAppManager

__________________________________________________ ________________________


''如果有的话,知识就是青春之泉''

-William E. Taylor,Regular Guy(1952-)


好吧,我想使用一个事件来改变这个特性,而且似乎

我没有正确地重新放置这些物体。你能举个例子吗?


TIA,

Scirious。


Scirious写道:< blockquote class =post_quotes>好吧,我想使用一个事件来改变这个特性,似乎我没有正确地重新设置对象。你能举个例子吗?

TIA,
Scirious。



对不起,我没有早点回来。 Netbeans在使用

网络包时出现问题。在组件的GUI构建器中设置文本的步骤:


确定..


1 - 选择新的Panel窗体。保存它。


2 - 从Swing Palette中选择一个JTextField并拖动到新的面板窗口。


3 - 选择新的JTextField on你的新面板。您现在可以使用相同的结果做两件事之一:


A - 正确<点击>在JTextField上,然后选择属性。然后

找到Text属性。你在

右边的文字标签处添加字符串数据。


B - 在右侧,JTextField属性面板找到Text属性。

你在Text标签的右边添加了String数据。

刚刚在你的邮件标题中注意到你正在询问有关Netbeans的更改

事件。


要做到这一点,你可以按照上面的方式进入对象属性列表。

这一次选择''Events''而不是''属性''。找到你想要的活动

添加代码,你很高兴...

在此先感谢...

IchBin,美国宾夕法尼亚州波科诺湖
http://weconsultants.servebeer.com/JHackerAppManager

__________________________________________________ ________________________


''如果有的话,知识就是青春之泉''

-William E. Taylor,Regular Guy(1952-)


Ok, here it goes... Since Netbeans declares all GUI inside a private method
I cant access them directly. So, on a button click, how can I do something
like jTextField1.setText("Hello!");?

TIA,
Scirious.

解决方案

Scirious wrote:

Ok, here it goes... Since Netbeans declares all GUI inside a private method
I cant access them directly. So, on a button click, how can I do something
like jTextField1.setText("Hello!");?

TIA,
Scirious.



If you just want to initialize then select on the object in your GUI
panel. Then you have to select the properties, of that object, on the
right side of the screen. You can add data there. I think the field is
''value''. You can still reference the Object outside of the "do not
Modify" code. Just reference it correctly.
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________ ________________________

''If there is one, Knowledge is the "Fountain of Youth"''
-William E. Taylor, Regular Guy (1952-)


Well, I want to use an event to change the proprerties and it seems that
I''m not refrencing the objects correctly. Could you give me an example?

TIA,
Scirious.


Scirious wrote:

Well, I want to use an event to change the proprerties and it seems that
I''m not refrencing the objects correctly. Could you give me an example?

TIA,
Scirious.


Sorry I did not get back sooner. Netbeans was having a problem with the
web package. Steps to set the text in the GUI builder for a component:

Ok..

1 - Select new Panel form. Save it.

2 - Select a JTextField from the Swing Palette and drag to new panel form.

3 - Select the new JTextField on your new panel. You can now do one of
two things with the same result:

A - right<click> on the JTextField and then select properties. Then
locate the Text property. You add you String data there on the right of
the Text label.

B - On the right side JTextField properties panel find Text property.
You add you String data there on the right of the Text label.
Just noticed in you message header you are asking about the changing
events with Netbeans.

To do that you do the same as above to get to the object property list.
This time select ''Events'' and not ''Property''. Find the event you want to
add code to and you are good to go...
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________ ________________________

''If there is one, Knowledge is the "Fountain of Youth"''
-William E. Taylor, Regular Guy (1952-)


这篇关于如何在Netbeans中使用事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆