473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How do I use events with Netbeans?

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.
Jun 16 '06 #1
10 8201
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-)
Jun 16 '06 #2
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.
Jun 17 '06 #3
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-)
Jun 17 '06 #4
Ok, thanks, but howI cange the same text only after the nouse clicked the
button?
Jun 17 '06 #5
Scirious wrote:
Ok, thanks, but howI cange the same text only after the nouse clicked the
button?


Sorry, I did not understand that question.. Are you asking how do you
change it programmatically?

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-)
Jun 17 '06 #6
IchBin wrote:
Scirious wrote:
Ok, thanks, but howI cange the same text only after the nouse clicked
the button?


Sorry, I did not understand that question.. Are you asking how do you
change it programmatically?


Sorry, I just want back and reread your initial question. I just created
a quick panel and added a button and other gui objects.

They are defined as private instance objects in the class and not to
method.

If trying to set or get the objects.text from a different Class then the
solution is to add a *protected* getter() and setter() for the button
object under that owner class. You will then be able to change them that
way and still keep it secure..

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-)
Jun 17 '06 #7
Actually, in the version I have here, which is Netbeans 5.0, they are
defined inside the init method.
Jun 18 '06 #8
Scirious wrote:
Actually, in the version I have here, which is Netbeans 5.0, they are
defined inside the init method.


Well, that explains it. I am running 5.5..

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-)
Jun 18 '06 #9
Scirious wrote:
Actually, in the version I have here, which is Netbeans 5.0, they are
defined inside the init method.


Well, that explains it. I am running 5.5..

You could post the code to figure it out. You could move the definition
out of the init() but still initialize them there.

Sorry but personally I do not use GUI builders for many reasons. I look
at them just because I think they are cute. I have learned it is better
to understand how to code it. You can use it for simple layouts but then
if it is simple it faster for me to just code it.

The only code I do differently is to use the JGoodies Form Layout and
not Sun's
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-)
Jun 18 '06 #10
Scirious wrote:
Actually, in the version I have here, which is Netbeans 5.0, they are
defined inside the init method.


Well, that explains it. I am running 5.5..

Well you cold move the definitions out of init but still initialize them
in the init method. This way you can reference them. If you wanted you
code post the code to figure it out.?

Sorry, I really do not use GUI builders for many reasons. I think they
are cute but far from building professional code. I would rather know
how to code them then rely on a tool that will be different to the next
one that does the same thing. The only thing I do differently, GUI wise,
is that I use the JGoodies Form layout and not Sun's.

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-)
Jun 18 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: King W.Wang | last post by:
Hi all, I've installed NetBeans IDE 3.5 on Windows XP. But if I try to start it, a message box shows "cannot load jvm.dll". This library does exist in a subdirectory. My questions are: 1) Is...
3
by: Joseph Jolic | last post by:
Hi i just installed Netbeans on my windows pc and it installed fine. but when i try to run it i get: JDK 1.3 or later cannot be found on your machine. Please read the README file. i read...
1
by: tmb | last post by:
I'm a newbie to Java. At http://java.sun.com/j2se/1.4.2/download.html I see I can download... NetBeans IDE + J2SE SDK as a 'bundle' I beleive is both NetBeans and the Java SDK... My...
0
by: Federico | last post by:
Hi all, I don't know if this topic is perhaps a little bit off-topic, anyway I have a strange problem in transforming an XML file in an HTML file using XSLT form a Java program written with...
20
by: Bill DeWitt | last post by:
I downloaded the Sun product, and find it feature rich but slow. Can someone recommend a more basic (freeware) IDE which will help a newbie without hiding every bit of code? I can program my way...
1
by: tatamata | last post by:
Hello. I installed NetBeans, Jython and Coyote. I hoped that I could use Swing GUI builder intergrated in NetBeans (Matisse?) with Jython in "Delphi" way. But, it seems that I can drag and drop...
3
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found...
0
by: buk110 | last post by:
Hi everyone, I'm new to using JAVA and I'm trying to interact with a web service I wrote in C# I downloaded Netbeans & followed the instructions to point to the wsdl file I navigated to my...
0
by: sokeefe | last post by:
I use NetBeans IDE to develop a Java application. In the past, I could use the Design Editor to edit my form for the GUI. Spontaneously, NetBeans is unable to open the form file, producing this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.