aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Border to JPanel is displacing JPanel which has Video Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Border to JPanel is displacing JPanel which has Video Component" Watch "Border to JPanel is displacing JPanel which has Video Component" New topic
Author

Border to JPanel is displacing JPanel which has Video Component

Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 199
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

Joined: Jun 09, 2003
Posts: 4632
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Border to JPanel is displacing JPanel which has Video Component
 
Similar Threads
How do you know the available real state in the container/framing component?
Removing Borders
Focus on JPanel
d'n'd any component
weird and unwanted duplicate component is being painted, moving a component(Simple animation)