开发者

Java Swing/AWT Component Access From Another Class

开发者 https://www.devze.com 2023-03-28 11:13 出处:网络
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 complet

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号