• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to view loading Image on click event by making full page dark?

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I have make one j2ee application which includes more than 200 pages. Now I want to show loading Image in the middle of page by making remaining page data dark.
I want to make it on click event.
How can I make it possible?

Regards,
Chauhan Sunil  
 
Rancher
Posts: 3204
29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe something like the Disabled Glass Pane is what you are looking for.

The current code only displays text, but you should be able to modify the code to display an Icon.
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a usability perspective, you should not forget to the give the user a 'Cancel' option in case the image retrieval get stuck e.g. network issues
 
SunilK Chauhan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya it's true.

I am looking for such facilities in j2ee application actually.
In swing application I can do it using disabledglasspane. But how can I do the same thing for java Web application.

 
Marshal
Posts: 25805
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certainly not with Swing, then. You would want to use Javascript in the HTML -- that's the onClick event you are talking about, right?

Let me put the thread into a suitable forum.
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make sure I understand what you are after:
  • Upon an event, such as a button click, you want to display a pane that covers the window with a "loading" image or similar.
  • Presumably, at some point, the pane will be removed; such as at the end of an Ajax request.


  • Right so far?

    If so, here's the high level overview of how I'd handle it.

  • Create the pane and its contained image in the HTML.
  • Use CSS to make it absolutely positioned, with a high z-index, and hidden from display. A partial opacity and dark background may give you the "darkening" effect I think you are after.
  • Register an event handler for the button click.
  • In the event handler add a class (name of your choosing) to the body, or at any level higher than the modal pane.
  • Augment the CSS so that the pane is shown when it is a child of that class.
  • When it is time to remove the pane, simply remove the class from the body.


  • This makes everything pretty much declarative, except for the actions of adding and removing a class in the script.

    All of this would be much easier using jQuery versus raw JavaScript.
     
    Don't get me started about those stupid light bulbs.
      Bookmark Topic Watch Topic
    • New Topic