Home » Archived » Visual Editor (VE) » nothing appears on the jframe (problem setvisible)
nothing appears on the jframe (problem setvisible) [message #46875] |
Mon, 05 July 2004 01:49  |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
hi everyone.
i have a little problem, which is not really a problem but if someone has an
explanation ...
when i make a visual class based on a jframe, and i make for instance 2
buttons on the jframe, nothing appears on the jframe when i run the jframe.
in fact i put visible to true for the jframe, the problem is that the java
code line is inserted at the beginning of the function initialise, so that
when the method setVisible is called, the buttons are not existing yet.
So the jframe must be refreshed (resize for example) to draw its buttons.
is it a known problem ? is there a solution ? or do i have to change the
position of the setvisible everytime ?
thanks :p
|
|
| | |
Re: nothing appears on the jframe (problem setvisible) [message #47690 is a reply to message #46875] |
Tue, 06 July 2004 10:21   |
Eclipse User |
|
|
|
Hi Zerovolt,
I was just curious as to the exact steps taken to
create the problem - A new JFrame was created, and two
JButtons are dropped on it. The questions that I had was,
is there a main() in that class, and if so, what are the
contents of it? and how did you run the class - as a java
application, or as a java bean?
Thanks,
Sri.
Zerovolt wrote:
> hi everyone.
>
> i have a little problem, which is not really a problem but if someone has an
> explanation ...
> when i make a visual class based on a jframe, and i make for instance 2
> buttons on the jframe, nothing appears on the jframe when i run the jframe.
> in fact i put visible to true for the jframe, the problem is that the java
> code line is inserted at the beginning of the function initialise, so that
> when the method setVisible is called, the buttons are not existing yet.
> So the jframe must be refreshed (resize for example) to draw its buttons.
>
> is it a known problem ? is there a solution ? or do i have to change the
> position of the setvisible everytime ?
>
> thanks :p
>
>
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #47894 is a reply to message #47690] |
Tue, 06 July 2004 12:14   |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
> I was just curious as to the exact steps taken to
> create the problem - A new JFrame was created, and two
> JButtons are dropped on it. The questions that I had was,
> is there a main() in that class, and if so, what are the
> contents of it? and how did you run the class - as a java
> application, or as a java bean?
> Thanks,
> Sri.
for the exact steps, it is everytime. for example i change the size of the
jframe, i put visible to true, and a setvisible is called at the beginning:
private void initialize() {
this.setVisible(true);
this.setSize(300,200);
}
if i make a new project and just add a button on the defaut layout
private void initialize() {
this.setVisible(true);
this.setContentPane(getJContentPane());
}
the code is the same if i set the value of visible to true before or after
adding a component. i tried several components, jbutton, jpanel, jlabel, it
is the same.
if i dont put any component and just change some properties, the setvisible
is always inserted at the top of the method.
in these previous tests i didn't change anything in the java editor. so no
main.
if i put a main, i put it at the bottom just before the last '}'. if i
change the property "visible" after, it is also inserted at the beginning.
i can run it as a java application or java bean, same thing.
am i the only one with that thing ???
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #48074 is a reply to message #47894] |
Tue, 06 July 2004 15:05   |
Eclipse User |
|
|
|
Hi Zerovolt,
Could it be possible for you to attach/paste a simple source which is
causing the problem for you?
Regards,
Sri.
Zerovolt wrote:
>>I was just curious as to the exact steps taken to
>>create the problem - A new JFrame was created, and two
>>JButtons are dropped on it. The questions that I had was,
>>is there a main() in that class, and if so, what are the
>>contents of it? and how did you run the class - as a java
>>application, or as a java bean?
>>Thanks,
>>Sri.
>
>
> for the exact steps, it is everytime. for example i change the size of the
> jframe, i put visible to true, and a setvisible is called at the beginning:
> private void initialize() {
> this.setVisible(true);
> this.setSize(300,200);
> }
> if i make a new project and just add a button on the defaut layout
> private void initialize() {
> this.setVisible(true);
> this.setContentPane(getJContentPane());
> }
> the code is the same if i set the value of visible to true before or after
> adding a component. i tried several components, jbutton, jpanel, jlabel, it
> is the same.
> if i dont put any component and just change some properties, the setvisible
> is always inserted at the top of the method.
>
> in these previous tests i didn't change anything in the java editor. so no
> main.
> if i put a main, i put it at the bottom just before the last '}'. if i
> change the property "visible" after, it is also inserted at the beginning.
>
> i can run it as a java application or java bean, same thing.
>
> am i the only one with that thing ???
>
>
|
|
| | |
Re: nothing appears on the jframe (problem setvisible) [message #48580 is a reply to message #48458] |
Wed, 07 July 2004 02:29   |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
> Hi Zerovolt,
> I dont think the way to show a Frame/JFrame is to do a setVisible(true)
> on it (others can correct me on this) - the way to do it generally is by
> calling a show() on the Frame/JFrame. So, if you could remove the
> setVisible(true) - and change the line
> new test();
> in your main() to be:
> new test().show();
> it should work fine. If setVisible(true) is the correct way for showing
> Frame/JFrame's then it looks like it should be after the
> setContentPane() statement.
> Regards,
> Sri.
hi,
of course setVisible it must be be after in order to work, but the problem
is that ve put it before ... so if ve make a mistake for a so simple code,
i'm afraid for big code.
when i put visible to true, it is the setvisible which is called, no show.
quote from javasun :
http://java.sun.com/docs/books/tutorial/uiswing/components/f rame.html
"Calling setVisible(true) makes the frame appear onscreen. Sometimes you
might see the show method used instead. The two usages are equivalent, but
we use setVisible(true) for consistency's sake. "
OR
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Component.h tml#show(boolean)
show
public void show(boolean b)Deprecated. As of JDK version 1.1, replaced by
setVisible(boolean).
the problem is that if i have to change the code produced by ve, what is the
utility of ve ? the aim of ve for me is to design visual classes faster.
that's ok to change 1 line, but when i'll have a big code, it'll be harder
to find why something doesn't work.
i hope i'm the only one with that thing, and that it will corrected in next
ve version
have a nice day :)
|
|
| | |
Re: nothing appears on the jframe (problem setvisible) [message #49092 is a reply to message #48755] |
Fri, 09 July 2004 10:40  |
Eclipse User |
|
|
|
Originally posted by: mendelgili.netscape.net
Zerovolt wrote:
> "Gili Mendel" <mendelgili@netscape.net> a écrit dans le message de
> news:ccgs1j$r76$1@eclipse.org...
>
>>Open a bugzilla.
>
>
> hi,
>
> i allready did that. Number 69325
>
> have a nice day
>
>
Tks. VE decoders have a "priority" setting that can be applied for
various features. It is currently used for placing constructors,
layout, table column etc. in the right place (see IJavaFeatureMapper,
IJFCFeatureMapper for more info).
The visible feature uses a default priority and hence placed where it is
today. Watch this defect for a fix.
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594198 is a reply to message #46875] |
Mon, 05 July 2004 10:33  |
Eclipse User |
|
|
|
Zerovolt,
I don't think that's a known issue... please open a bugzilla report
against that problem.
- Jeff
Zerovolt wrote:
> hi everyone.
>
> i have a little problem, which is not really a problem but if someone has an
> explanation ...
> when i make a visual class based on a jframe, and i make for instance 2
> buttons on the jframe, nothing appears on the jframe when i run the jframe.
> in fact i put visible to true for the jframe, the problem is that the java
> code line is inserted at the beginning of the function initialise, so that
> when the method setVisible is called, the buttons are not existing yet.
> So the jframe must be refreshed (resize for example) to draw its buttons.
>
> is it a known problem ? is there a solution ? or do i have to change the
> position of the setvisible everytime ?
>
> thanks :p
>
>
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594332 is a reply to message #47058] |
Tue, 06 July 2004 06:57  |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
> I don't think that's a known issue... please open a bugzilla report
> against that problem.
done
i experienced several critical problems, not precisely identified yet, which
compel me to alt-ctrl-supp to close eclipse, ot others less critical which
seems to disappear for a while when closing and restarting.
many many bugs i think in that version 3.
is a next version coming soon ? my bug was registered number 62xxx, i hope
there are not all real bugs, what the hell otherwise :)
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594429 is a reply to message #46875] |
Tue, 06 July 2004 10:21  |
Eclipse User |
|
|
|
Hi Zerovolt,
I was just curious as to the exact steps taken to
create the problem - A new JFrame was created, and two
JButtons are dropped on it. The questions that I had was,
is there a main() in that class, and if so, what are the
contents of it? and how did you run the class - as a java
application, or as a java bean?
Thanks,
Sri.
Zerovolt wrote:
> hi everyone.
>
> i have a little problem, which is not really a problem but if someone has an
> explanation ...
> when i make a visual class based on a jframe, and i make for instance 2
> buttons on the jframe, nothing appears on the jframe when i run the jframe.
> in fact i put visible to true for the jframe, the problem is that the java
> code line is inserted at the beginning of the function initialise, so that
> when the method setVisible is called, the buttons are not existing yet.
> So the jframe must be refreshed (resize for example) to draw its buttons.
>
> is it a known problem ? is there a solution ? or do i have to change the
> position of the setvisible everytime ?
>
> thanks :p
>
>
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594487 is a reply to message #47690] |
Tue, 06 July 2004 12:14  |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
> I was just curious as to the exact steps taken to
> create the problem - A new JFrame was created, and two
> JButtons are dropped on it. The questions that I had was,
> is there a main() in that class, and if so, what are the
> contents of it? and how did you run the class - as a java
> application, or as a java bean?
> Thanks,
> Sri.
for the exact steps, it is everytime. for example i change the size of the
jframe, i put visible to true, and a setvisible is called at the beginning:
private void initialize() {
this.setVisible(true);
this.setSize(300,200);
}
if i make a new project and just add a button on the defaut layout
private void initialize() {
this.setVisible(true);
this.setContentPane(getJContentPane());
}
the code is the same if i set the value of visible to true before or after
adding a component. i tried several components, jbutton, jpanel, jlabel, it
is the same.
if i dont put any component and just change some properties, the setvisible
is always inserted at the top of the method.
in these previous tests i didn't change anything in the java editor. so no
main.
if i put a main, i put it at the bottom just before the last '}'. if i
change the property "visible" after, it is also inserted at the beginning.
i can run it as a java application or java bean, same thing.
am i the only one with that thing ???
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594534 is a reply to message #47894] |
Tue, 06 July 2004 15:05  |
Eclipse User |
|
|
|
Hi Zerovolt,
Could it be possible for you to attach/paste a simple source which is
causing the problem for you?
Regards,
Sri.
Zerovolt wrote:
>>I was just curious as to the exact steps taken to
>>create the problem - A new JFrame was created, and two
>>JButtons are dropped on it. The questions that I had was,
>>is there a main() in that class, and if so, what are the
>>contents of it? and how did you run the class - as a java
>>application, or as a java bean?
>>Thanks,
>>Sri.
>
>
> for the exact steps, it is everytime. for example i change the size of the
> jframe, i put visible to true, and a setvisible is called at the beginning:
> private void initialize() {
> this.setVisible(true);
> this.setSize(300,200);
> }
> if i make a new project and just add a button on the defaut layout
> private void initialize() {
> this.setVisible(true);
> this.setContentPane(getJContentPane());
> }
> the code is the same if i set the value of visible to true before or after
> adding a component. i tried several components, jbutton, jpanel, jlabel, it
> is the same.
> if i dont put any component and just change some properties, the setvisible
> is always inserted at the top of the method.
>
> in these previous tests i didn't change anything in the java editor. so no
> main.
> if i put a main, i put it at the bottom just before the last '}'. if i
> change the property "visible" after, it is also inserted at the beginning.
>
> i can run it as a java application or java bean, same thing.
>
> am i the only one with that thing ???
>
>
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594585 is a reply to message #48074] |
Tue, 06 July 2004 16:11  |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
in this example, if i just put setvisible after
"this.setContentPane(getJContentPane());" manually, it works fine, otherwise
nothing appears on the jframe until i resize (redraw) the jframe.
import javax.swing.JFrame;
import javax.swing.JButton;
public class test extends JFrame {
private javax.swing.JPanel jContentPane = null;
private JButton jButton = null;
public test() {
super();
initialize();
}
private void initialize() {
this.setVisible(true);
this.setSize(300,200);
this.setContentPane(getJContentPane());
}
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(new java.awt.BorderLayout());
jContentPane.add(getJButton(), java.awt.BorderLayout.WEST);
}
return jContentPane;
}
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("hello");
}
return jButton;
}
public static void main(String[] args){
new test();
}
}
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594651 is a reply to message #48244] |
Tue, 06 July 2004 18:47  |
Eclipse User |
|
|
|
Hi Zerovolt,
I dont think the way to show a Frame/JFrame is to do a setVisible(true)
on it (others can correct me on this) - the way to do it generally is by
calling a show() on the Frame/JFrame. So, if you could remove the
setVisible(true) - and change the line
new test();
in your main() to be:
new test().show();
it should work fine. If setVisible(true) is the correct way for showing
Frame/JFrame's then it looks like it should be after the
setContentPane() statement.
Regards,
Sri.
Zerovolt wrote:
> in this example, if i just put setvisible after
> "this.setContentPane(getJContentPane());" manually, it works fine, otherwise
> nothing appears on the jframe until i resize (redraw) the jframe.
>
>
> import javax.swing.JFrame;
> import javax.swing.JButton;
>
> public class test extends JFrame {
>
> private javax.swing.JPanel jContentPane = null;
>
> private JButton jButton = null;
>
> public test() {
> super();
> initialize();
> }
>
> private void initialize() {
> this.setVisible(true);
> this.setSize(300,200);
> this.setContentPane(getJContentPane());
> }
>
> private javax.swing.JPanel getJContentPane() {
> if(jContentPane == null) {
> jContentPane = new javax.swing.JPanel();
> jContentPane.setLayout(new java.awt.BorderLayout());
> jContentPane.add(getJButton(), java.awt.BorderLayout.WEST);
> }
> return jContentPane;
> }
>
> private JButton getJButton() {
> if (jButton == null) {
> jButton = new JButton();
> jButton.setText("hello");
> }
> return jButton;
> }
>
> public static void main(String[] args){
> new test();
> }
> }
>
>
>
|
|
|
Re: nothing appears on the jframe (problem setvisible) [message #594688 is a reply to message #48458] |
Wed, 07 July 2004 02:29  |
Eclipse User |
|
|
|
Originally posted by: notfree.free.fr
> Hi Zerovolt,
> I dont think the way to show a Frame/JFrame is to do a setVisible(true)
> on it (others can correct me on this) - the way to do it generally is by
> calling a show() on the Frame/JFrame. So, if you could remove the
> setVisible(true) - and change the line
> new test();
> in your main() to be:
> new test().show();
> it should work fine. If setVisible(true) is the correct way for showing
> Frame/JFrame's then it looks like it should be after the
> setContentPane() statement.
> Regards,
> Sri.
hi,
of course setVisible it must be be after in order to work, but the problem
is that ve put it before ... so if ve make a mistake for a so simple code,
i'm afraid for big code.
when i put visible to true, it is the setvisible which is called, no show.
quote from javasun :
http://java.sun.com/docs/books/tutorial/uiswing/components/f rame.html
"Calling setVisible(true) makes the frame appear onscreen. Sometimes you
might see the show method used instead. The two usages are equivalent, but
we use setVisible(true) for consistency's sake. "
OR
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Component.h tml#show(boolean)
show
public void show(boolean b)Deprecated. As of JDK version 1.1, replaced by
setVisible(boolean).
the problem is that if i have to change the code produced by ve, what is the
utility of ve ? the aim of ve for me is to design visual classes faster.
that's ok to change 1 line, but when i'll have a big code, it'll be harder
to find why something doesn't work.
i hope i'm the only one with that thing, and that it will corrected in next
ve version
have a nice day :)
|
|
| | |
Re: nothing appears on the jframe (problem setvisible) [message #594832 is a reply to message #48755] |
Fri, 09 July 2004 10:40  |
Eclipse User |
|
|
|
Zerovolt wrote:
> "Gili Mendel" <mendelgili@netscape.net> a écrit dans le message de
> news:ccgs1j$r76$1@eclipse.org...
>
>>Open a bugzilla.
>
>
> hi,
>
> i allready did that. Number 69325
>
> have a nice day
>
>
Tks. VE decoders have a "priority" setting that can be applied for
various features. It is currently used for placing constructors,
layout, table column etc. in the right place (see IJavaFeatureMapper,
IJFCFeatureMapper for more info).
The visible feature uses a default priority and hence placed where it is
today. Watch this defect for a fix.
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:11:59 EDT 2025
Powered by FUDForum. Page generated in 0.07075 seconds
|