Skip to main content

Starter problem - can't get dispayed anything in SG

2 replies [Last post]
vvessan
Offline
Joined: 2007-10-13
Points: 0

Hello, I'm just trying to play a bit with SG and I was unable to display anything at all. I have tryied some stuff, but nothing helped. Now I have the following code in a constructor in class extending JDialog:

JSGPanel panel = new JSGPanel();
setLayout(new BorderLayout());
add(panel, BorderLayout.CENTER);

panel.setPreferredSize(new Dimension(640, 400));
SGText text = new SGText();
text.setText("Test");
panel.setScene(text);

... but nothing gets displayed, no excpetion (Java 1.6.3 + SceneGraph 0.5). Am I missing something like initialization, some render method call?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Campbell

The problem is likely that since SGText uses baseline-relative
positioning, your text is rendered outside the top of the panel. Try
setting a non-zero location. Also, there is no default font property
at the moment, so you'll need to set that as well, for example:

SGText text = new SGText();
text.setText("Test");
text.setLocation(20, 20);
text.setFont(new Font(...));
text.setFillPaint(Color.RED);

Chris

On Feb 15, 2008, at 5:55 AM, scenario@javadesktop.org wrote:
> Hello, I'm just trying to play a bit with SG and I was unable to
> display anything at all. I have tryied some stuff, but nothing
> helped. Now I have the following code in a constructor in class
> extending JDialog:
>
> JSGPanel panel = new JSGPanel();
> setLayout(new BorderLayout());
> add(panel, BorderLayout.CENTER);
>
> panel.setPreferredSize(new Dimension(640, 400));
> SGText text = new SGText();
> text.setText("Test");
> panel.setScene(text);
>
>
> ... but nothing gets displayed, no excpetion (Java 1.6.3 +
> SceneGraph 0.5). Am I missing something like initialization, some
> render method call?
> [Message sent by forum member 'vvessan' (vvessan)]
>
> http://forums.java.net/jive/thread.jspa?messageID=259174
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

vvessan
Offline
Joined: 2007-10-13
Points: 0

Thanks a lot.