Results 1 to 4 of 4
Thread: swing events
- 09-20-2008, 08:29 AM #1
Member
- Join Date
- Sep 2008
- Posts
- 1
- Rep Power
- 0
swing events
i am using net beans ide...how to show previously created frame by clicking menu item..i wrote the coding like that..
private void paddnewmenuitemMouseClicked(java.awt.event.MouseEv ent evt) {
patientdetails.pack();
patientdetails.setVisile(true);
}
but it provide the following warning message..
Non-static method pack() can not be referenced from a static context.
pls help me.thanks in advance..
- 09-20-2008, 10:10 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes you can't call the pack() within the static contest. Actually you should do it within the previously constructed frame. No need to do it here, and you can't do it also.
-
This actually has little to do with Swing and everything to do with understanding and respecting the differences between the static world and the non-static or instance world -- a cornerstone of OOPS programming. I suggest you read up on this including this series of tutorials from Sun: Lesson: Object-Oriented Programming Concepts.
Good luck.
- 09-20-2008, 04:57 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Need Help With Button Events
By adlb1300 in forum New To JavaReplies: 5Last Post: 11-03-2007, 05:36 AM -
Help with keyboard events?
By Bibendum in forum New To JavaReplies: 2Last Post: 11-02-2007, 02:51 AM -
To capture events with struts
By Ed in forum Web FrameworksReplies: 2Last Post: 07-04-2007, 06:01 AM -
Help, events in Jbutton class
By Heather in forum Java AppletsReplies: 2Last Post: 06-30-2007, 04:32 PM


LinkBack URL
About LinkBacks


Bookmarks