This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 201
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Border to JPanel is displacing JPanel which has Video Component