shortened code:
public class Test{ private JFrame frame; private TestPanel panel; Object obj; public static void main(String args[]) { Test test = new Test(); } public Test() { try { // Setup GUI frame = new JFrame("Test"); panel = new TestPanel(); frame.add(panel); } } }
Is it possible to directly access obj from panel? If yes: How?
Thank you in advance for your help. 🙂
Advertisement
Answer
No; Not without passing the reference to object to the panel.