-
problem accessing the parent class
Hei, I have the following problem within my java application:
I have a Main class that executes when I open the containing .jar file.
In Main I create a new JFrame, then I show it, in the following way: I have a class that extends JFrame, named "Interfata".
Code:
Interfata f = new Interfata();
f.setVisible(true);
Then, in Main class I wrote this function
Code:
public static void setLook(int tip)
to change the appearance of the application, but I don't know how to access it from f (Interfata object).
Practically, I need to access from a class, one function that resides in the class that instanciated that class.
If anyone has a modality to solve this, I would apreciate it very much.
Thanks!
-
1-its static , you can call YourMainClass.setLook(...) .
2-for non static ones , you may put a instance variable into other class (Interfata ) and set it from main class. ( f.setMainClass( this ) )
3-if you define Interfata as an "inner class" ,
you can use every method or variable of the outer class (even private ones.)
-
Thanks very much mr1yh1, it worked...
-
Ow... it looks like I have one more problem:
My function changes the lookAndFeel property.. and it changes.. partially. But the main window looks like a hibryd of the windows and metal themes. Is there a refresh.. or something like that function available ?
Thanks.
Similar Threads
-
By news://news.devx.com in forum .NET
Replies: 1
Last Post: 03-16-2003, 01:37 AM
-
Replies: 5
Last Post: 10-17-2002, 01:58 PM
-
By Luchador in forum Java
Replies: 3
Last Post: 07-23-2001, 11:05 AM
-
Replies: 1
Last Post: 11-09-2000, 05:38 PM
-
Replies: 1
Last Post: 04-04-2000, 06:28 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|