Author Topic: What's the Best Approach for Menus and Dialogs in Webstart Apps?  (Read 6467 times)

Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Hi All,

I'm wondering, what's the best approach for programming dialogs and menus to use with jPCT in webstart apps?  I'd like to be able to use a custom skin and use transparency... modal and non-modal,...

Thanks!


Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #1 on: January 06, 2009, 12:36:56 am »
The simplest way is to use Swing components, however that only works well when using jPCT in Software rendering mode.  What I am doing in my MapMaker program to work in both Hardware and Software rendering modes, is to use Overlays (and menu components that I programmed myself).  That route, however, is much more involved.  I am relatively new to jPCT myself, though, so these may not be your only two options.

Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #2 on: January 06, 2009, 02:56:08 am »
Thanks!   What do you mean when you say overlay?  Do you mean creating and displaying an image and then detecting mouse clicks on it in specific areas?

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #3 on: January 06, 2009, 02:26:42 pm »
What do you mean when you say overlay?  Do you mean creating and displaying an image and then detecting mouse clicks on it in specific areas?
I meant that I am using jPCT's 'Overlay' class, which is used to create transparent or opaque 2D layers on top of the 3D scene.  As for the mouse clicks and all, what I did for that was to create a base MenuComponent class from which I extended everything like windows, buttons, etc.  The MenuComponents are managed from a MenuManager class, which handles things like focus, etc., and sends the MouseEvents to the proper MenuComponent.  This option is, of course, considerably more involved, but much more customizable.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #4 on: January 06, 2009, 04:35:58 pm »
There's also https://fenggui.dev.java.net/. I've never tried it myself except for some test cases, but it should work in combination with jPCT. I've no idea if it's still actively being developed or not though.
Which renderer are you using?

Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #5 on: January 14, 2009, 01:21:05 am »
Thanks!  I need to look at overlays. I have been experimenting with having the option of both hardware or software rendering, so I've been looking at a solution for both for general menus.  I found a very cool demo that blits invisible swing components to the screen, and preserves their mouse events, but it doesn't seem readily adaptable. (Google swingle)  I did try getting it to blit a texture, but I'm not too good with bytebuffers...  It could be pretty cool to be able to blit a swing component to a texture.  It would open up use of all swing components.

It would be great to have some kind of menu library that can handle all sorts of things like dialogs, windows and chat boxes ect...it seems fengui isn't out there anymore.




Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #6 on: January 14, 2009, 05:25:04 am »
The idea of blitting swing components onto a texture sounds really interesting.  Be sure to post an update if you manage to get it to work - I'd love to see the source code for that!

Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #7 on: January 15, 2009, 04:15:11 am »
I've started making dialogs with overlays.  Is there something I'm missing about using transparency with overlays?  I can't seem to make it happen in hw/sw modes.  Transparent textures in 3Dobjects do work fine...

Basically, I'm just creating the texture with something like;

Texture texture = new Texture(image,useAlpha);

and I've tried adding textureInfo to the effect of;

ti.add(textureID,TextureInfo.MODE_ADD);

For the moment I'm manually tracking overlay depth(z-order) while testing, and everything is 1f apart.  (I will make a depthmananger soon...)

My efforts so far give me overlays, but they all seem to jiggle on the screen x-axis abit, and transparency isn't working.

Tips appreciated!


Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #8 on: January 15, 2009, 05:46:04 am »
setTransparency(0) seems to do the trick for hw rendering at least,...

Offline Nodin

  • byte
  • *
  • Posts: 13
    • View Profile
Re: What's the Best Approach for Menus and Dialogs in Webstart Apps?
« Reply #9 on: January 15, 2009, 05:58:07 am »
I've discovered my graphic was also messed up, and switched to png with no problems.