Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Border to JPanel is displacing JPanel which has Video Component

 
Girish Vasmatkar
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all,

Here is my problem and and i'll try to explain it.

My JFrame contains a JPanel to which i have added a Video component( JMF ). Now after some time say 5 minutes i want to set the border of the JPanel to yellow so that it blinks 10 times. I am just using JPanel.setBorder(new LineBorder()) method to specify the width of the border. But the problem is when i add the Border to the JPanel the JPanel gets displaced. To put it this way the border starts at location from where the JPanel initially started. I tried to solve the issue by setting JPanel's location but the location is not changing. Is there any way by which we can change the location of the JPanel from some other code and then calling revalidate or repaint ?

Thanks and Regards
-- Girish --
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't change the location unless the panel's parent has a null layout,
and if so, adding a wide border you would also need to change the bounds.
Using null layouts often gets messy, and is rarely recommended.

create another program, just frame with panel, add your border blinking code,
but set it to blink immediately.

if this has the same problem, post the code here, so we can see exactly what is happening
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic