Re: How get the MySQL data in a Netbeans UI

"sandhu@tatwaa" <[email protected]> Mon, 11 Feb 2008 22:55:11 -0800 (PST)
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
declare  "jTextFieldMV"  as static variable.... hope,u wont get error this
time.






anko wrote:
> 
> Hello Phil,
> Your answer is clear, but I don't understand how to do it in my program. I
> tried to change the status of the methods in several ways, but keep having
> this problem or don't get any output at all.
> I found another example that does work inside Netbeans but not from the
> command line.
> But from Wade I understand this is the wrong list for my questions so I
> will ask somewhere else.
> 
> Phil Doble wrote:
>> 
>> The clue is in the "static context" part of the error message.
>> 
>> The components on a form are all "Instance variables" - so they belong to
>> an instance of the form - one you create using the "new" keyword. The
>> examples use static variables and methods - these belong to the class
>> itself. If you declare a method (or "function" if you have a background
>> in other languages) as static, it can only use static variables - not
>> instance variables. An example may make this clearer...
>> 
>> public class AClass {
>>    private static int aStaticVariable
>>    private int anInstanceVariable
>>    
>>    public static void aStaticMethod() {
>>       aStaticVariable = 1; // this is OK
>>       anInstanceVariable = 1; // this will cause a compliler error
>>    }
>> 
>>    public void anInstanceMethod() {
>>       aStaticVariable = 1; // this is OK
>>       anInstanceVariable = 1; // this is OK
>>    }
>> 
>> }
>> 
>> It appears that you have tried to use jTextFieldMV.setText() inside a
>> method marked as static.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-get-the-MySQL-data-in-a-Netbeans-UI-tp14486637p15426945.html
Sent from the Netbeans - UI mailing list archive at Nabble.com.