Bonjour afin d'avoir une video de bonne qualité je redimentionne ma video JMF afin qu'elle garde sont format original. Le problème c'est que je n'arrive pas à centrer la video dans mes différent container ! quelqu'un pourrait-il m'aidé svp ?
code de redimentionnement centrage appelé après le start
private void Redimentionne()
{
awtFrame.pack();
// MULTIPLI PAR LE PLUS PETIT DES 2 ZOOM
double zoomWidth = 0 , zoomHeight = 0 ;
zoomWidth = (double)Width / playerComponent.getWidth() ;
zoomHeight = (double)Height / playerComponent.getHeight() ;
int newWidth , newHeight , X , Y;
if ( zoomWidth < zoomHeight)
{
//Aggrandissement
newWidth = (int)(playerComponent.getWidth() * zoomWidth) ;
newHeight = (int)(playerComponent.getHeight() * zoomWidth) ;
//Centrage
X = 0 ;
Y = Height / 2 - newHeight / 2 ;
}
else
{
//Aggrandissement
newWidth = (int)(playerComponent.getWidth() * zoomHeight) ;
newHeight = (int)(playerComponent.getHeight() * zoomHeight) ;
//Centrage
X = Width / 2 - newWidth / 2 ;
Y = 0 ;
}
awtFrame.setSize(newWidth, newHeight);
playerComponent.setBounds(0, 0, newWidth, newHeight);
//System.out.println("X : " + X + " Y : " + Y ) ;
//aucune de ces 3 méthodes ne marche pour centrée
//playerComponent.setLocation(X, Y);
//videoPanel.setLocation(X, Y);
//awtFrame.setLocation(X, Y);
}