Skip to main content

On-screen rendering/emulation of console (System.out and System.err)?

3 replies [Last post]
ken2006
Offline
Joined: 2008-07-22
Points: 0

Can someone point me toward a way (code example or concepts) that we can use to modify (hopefully with minimal effort) one of the hdcookbook examples, and cause System.out/err to be redirected/printed onto the screen (perhaps as text overlay)?

This would just be as an simple way of getting debug/event information without needing special player builds or attaching debuggers. It would only need to be output based, no input (for simplicity's sake). I'd find this useful for routine testing and debug in hardware players (in retail stores), and also as a means for ends-users to open debug in the phone when something goes wrong.

In practical use, I hope eventually (once I learn MHP and BDJ some more) to make such a console be standard in all my BD-J apps, for example perhaps the lower-right 2x2 screen coords would have a hidden button that pops-up the console, or perhaps toggled by a numeric key sequence.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ken2006
Offline
Joined: 2008-07-22
Points: 0

Thank you both, I was indeed hoping to get an answer for both, the minimalist/LCD way (Graphics via HSceneFactory), and also to know about hdcookbook's built-in utility. Knowing about both these will be helpful for the learning stage that I'm at.

bjoern_minkmar
Offline
Joined: 2007-06-11
Points: 0

Hi ken2006,

I don't know if grin does already have something like a debug-output.
But you can easily do something like this:

1) get the graphics context of the HScene
Graphics g = HSceneFactory.getInstance().getDefaultHScene().getGraphics();

2) set Color and Font
g.setColor(Color.white);
g.setFont(new Font("Serif", Font.PLAIN, 12));

3) draw debug output to the screen
g.drawString("Error-Message");

So instead of using System.out you could easily create your own debug class,
that implements the steps mentioned above and prints messages directly to the screen.

Hope this helps,
Björn

A. Sundararajan

Hi,

The logger library at
$HD_COOKBOOK/DiscCreationTools/logger/src/net/java/bd/tools/logger may
also be used for debugging.

-Sundar

bd-j-dev@mobileandembedded.org wrote:
> Hi ken2006,
>
> I don't know if grin does already have something like a debug-output.
> But you can easily do something like this:
>
> 1) get the graphics context of the HScene
> Graphics g = HSceneFactory.getInstance().getDefaultHScene().getGraphics();
>
> 2) set Color and Font
> g.setColor(Color.white);
> g.setFont(new Font("Serif", Font.PLAIN, 12));
>
> 3) draw debug output to the screen
> g.drawString("Error-Message");
>
>
> So instead of using System.out you could easily create your own debug class,
> that implements the steps mentioned above and prints messages directly to the screen.
>
> Hope this helps,
> Björn
> [Message sent by forum member 'bjoern_minkmar' (bjoern_minkmar)]
>
> http://forums.java.net/jive/thread.jspa?messageID=293843
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
> For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net
>
>

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