Access Java Swing / AWT from another class

I am writing an example application with the Sakila Sample Database for some experience. I am using eclipse / windowsbuilder for GUI. I have 3 classes; VALIDATION for checking component values, CONNECTOR for completing SQL queries, and a MAIN class that has components. My problem is that I cannot access components from another class. They all have the same package access modifiers for classes.

I tried below one;

public class Connector{ MovieDB mdb; public Connector(MovieDB m){ mdb = m; } } public class MovieDB extends JFrame { Connector db = new Connector(this); } 

But still, I can’t access the components, and I can help with the help of depression :)

+4
source share
1 answer

Check the access modifier of the components and make sure they are not private.

+2
source

All Articles