How to update GUI from Inherit Class [message #1395194] |
Sun, 06 July 2014 10:37  |
Eclipse User |
|
|
|
I have 2 panels: Panel1 and Panel2, the Panel2 inherit from Panel1. In constructor of Panel1, I create 3 JLabels and display them in order Label1-Label2-Label3. When I switch from Source Tab to Design Tab, the Preview Window display corectly what I want

In constructor of Panel2, I want to custom Panel1, so, I change order of 3 JLabels, like this:
public class Panel2 extends Panel1 {
public Panel2() {
super();
reverse();
}
}
but when I switch from Source Tab to Design Tab, int Preview Window, nothing change
Attachment: Panel2.java
(Size: 0.11KB, Downloaded 183 times)
Attachment: 1.jpg
(Size: 125.37KB, Downloaded 990 times)
Attachment: 2.jpg
(Size: 204.42KB, Downloaded 837 times)
Attachment: Panel1.java
(Size: 2.31KB, Downloaded 318 times)
|
|
|
|
|
Re: How to update GUI from Inherit Class [message #1399051 is a reply to message #1398289] |
Fri, 11 July 2014 20:49  |
Eclipse User |
|
|
|
Sure. All statically defined components and properties are inherited (as you can see by the fact that the widgets all show up in the subclass).
If you embed Panel2 in another class as a custom component, it will show up with those components reversed as you wish.
At design time, however, the reverse() method means nothing and is ignored.
|
|
|
Powered by
FUDForum. Page generated in 0.07577 seconds