Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   code help (netbeans) (http://www.programmingforums.org/showthread.php?t=11607)

Nim_ Oct 16th, 2006 5:49 PM

code help (netbeans)
 
Well, i've search many hours b4 posting and i found nothing usefull (im using NetBeans ide 5.0) :

1. How can i jump inside a method from an other?I dont want to use it as a fuction just jump in and run whats inside.(i want to go from a button's actions method to an other's)
2.What actions a "restart" button method need to have instead to work?(Go all over again the project)

i'd be glad if you help me.
ty,
Nim Art

AntiNinja Oct 16th, 2006 5:57 PM

I'm not sure if anyone else can understand that, could you re-post those questions more clearly?

>What actions a "restart" button method need to have instead to work?
WTF?

Nim_ Oct 16th, 2006 7:33 PM

..
1.i want to run a specific method which already exists
2.i want to restart the program with a button..
is it really so hard to understand?:\

andro Oct 16th, 2006 10:44 PM

Can you post some code? Either your examples are really vague, or you're talking about the most basics of basics, like simply calling a method... in which case you've got a lot of learning to do.

crawforddavid2006 Oct 16th, 2006 11:03 PM

Quote:

Originally Posted by Nim_ (Post 116669)
Well, i've search many hours b4 posting and i found nothing usefull (im using NetBeans ide 5.0) :

1. How can i jump inside a method from an other?I dont want to use it as a fuction just jump in and run whats inside.(i want to go from a button's actions method to an other's)
2.What actions a "restart" button method need to have instead to work?(Go all over again the project)

i'd be glad if you help me.
ty,
Nim Art


Here is the best help i can provide... don't use netbeans :D

ReggaetonKing Oct 16th, 2006 11:24 PM

Quote:

Originally Posted by Nim_ (Post 116700)
1.i want to run a specific method which already exists

just call the method!

AntiNinja Oct 16th, 2006 11:33 PM

Quote:

Originally Posted by crawforddavid2006 (Post 116735)
Here is the best help i can provide... don't use netbeans :D

Somebody grill this man a steak!

ReggaetonKing Oct 16th, 2006 11:52 PM

lmao!

Nim_ Oct 17th, 2006 5:57 AM

"private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){..}" i didnt knew how to call this method.

Finally i created a new method (private void blahblah(){..}) and cut/paste the code from the first one to the second and just called the method like that blahblah(); . Forget the 1st question i made.
The 2nd one? how to restart the program?.

There is smth else, more important. I want to make smth like that:
for(i=0;i<=n-1;i++){
jButton + i.setVisible(b);
}
*n is the quantity of my buttons..

sry, english is not my mother tongue (as you see)

ReggaetonKing Oct 17th, 2006 9:43 AM

OMG! #1, use code tags pleeeease! #2 actionPerformed(ActionEvent e) method is automatically called when you have set that ActionListener interface with a corresponding button and or GUI component.

Example
:

//it's given that the needed packages are imported
public class Example implements ActionListener
{
        public static void main(String args[])
        {
                JFrame frame = new JFrame("Example");
                JButton btn = new JButton("Clicky!");
                btn.addActionListener(this);
                //when btn is pressed it goes to the actionPerformed() method
                frame.getContentPane().add(btn, "South");
                frame.setSize(300,300);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
        }
        public void actionPerformed(ActionEvent evt)
        {
                //call some method here
        }
}



All times are GMT -5. The time now is 1:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC