Java Swing/AWT Component Access From Another Class
I am writing a sample application with Sakila Sample Database for some experience. I am using eclipse/windowsbuilder for GUI. I have 3 class; VALIDATION to check component values, CONNECTOR to complete SQL queries and MAIN class which one has components. My problem is, I can not access components from another class. All of them in the same package access modifiers public for the classes.
I have tried below one;
public class Connector{
MovieDB mdb;
public Connector(MovieDB m){
mdb = m;
}
}
public class MovieDB extends JFrame {
Connec开发者_StackOverflow社区tor db = new Connector(this);
}
But still I can not access components and I m in depression pls help:)
Check the access modifier of the components and verify that they are not private.
精彩评论