Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Unable to add Labels with Image to Panel thru KeyListener.  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could any one help me. When I add an image to Label and That label to Panel Its working fine. When I do the same in Event Listener method, Its passing thru it but images are not displaying. the code is as follows,

addLabel("a"); // working fine.......

txt.addKeyListener(new KeyListener()

{

public void keyReleased(KeyEvent ke)

{}

public void keyTyped(KeyEvent ke)

{

}

public void keyPressed(KeyEvent ke)

{
char key = ke.getKeyChar();
System.out.println("--before "+key);
addLabel(st);

System.out.println("--after "+st);
}

})

Thanks.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you add the Label try calling validate for the panel.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!