Refreshing frames

T

torchestra

I am using Quicktime for Java and have placed a movie in a frame. I
would like to replace the movie with another movie when it finish
playing. For this I use the triggerAtStop in the quicktime.std.clocks
class. My problem is that the new movie is placed bellow the first
movie in the frame and do not replace it.


(Some of the code - the programme load files, L1M1.mp4, L1M2,mp4 etc.
where the numbers in the file name are generated from variables.


(...)

class MyQTCallback extends ExtremesCallBack {
public MyQTCallback (Movie m) throws QTException {
super (m.getTimeBase(), StdQTConstants.triggerAtStop);
callMeWhen();
}


public void execute () {
try {
M = M+1;
NewMovie();

} catch (QTException qte) {
qte.printStackTrace();
}
}


public static void main (String [] Args) {
try {
QTSessionCheck.check();
System.out.println(filpath+filnavn);
filnavn = "L"+ Integer.toString(L) + "M" +

Integer.toString(M) + ".mp4";
QTFile file = new QTFile( new File(filpath,
filnavn));
OpenMovieFile omFile =
OpenMovieFile.asRead((QTFile) file);
Movie m = Movie.fromFile(omFile);
Frame f = new BasicQTSherlock (m);
f.pack();
f.setVisible(true);
m.start();

} catch (Exception e) {
e.printStackTrace();
}
}


public void NewMovie () throws QTException {
filnavn = "L"+ Integer.toString(L) + "M" + Integer.toString(M) +
".mp4";
QTFile file = new QTFile( new File(filpath, filnavn));
OpenMovieFile omFile = OpenMovieFile.asRead((QTFile) file);
Movie m = Movie.fromFile(omFile);
QTComponent qc= QTFactory.makeQTComponent(m);
Component c = qc.asComponent();
add (c,BorderLayout.CENTER);
m.start();
}

(...)
 
M

Monique Y. Mudama

I am using Quicktime for Java and have placed a movie in a frame. I
would like to replace the movie with another movie when it finish
playing. For this I use the triggerAtStop in the quicktime.std.clocks
class. My problem is that the new movie is placed bellow the first
movie in the frame and do not replace it.

[snip]


public void NewMovie () throws QTException {
filnavn = "L"+ Integer.toString(L) + "M" + Integer.toString(M) +
".mp4";
QTFile file = new QTFile( new File(filpath, filnavn));
OpenMovieFile omFile = OpenMovieFile.asRead((QTFile) file);
Movie m = Movie.fromFile(omFile);
QTComponent qc= QTFactory.makeQTComponent(m);
Component c = qc.asComponent();
add (c,BorderLayout.CENTER);
m.start();
}

I'm not really familiar with this QT stuff, but I didn't see a
remove() anywhere. At a very rough glance, it looks like you keep
adding components, but you never take the old ones away.
 
R

Roedy Green

Movie m = Movie.fromFile(omFile);
Frame f = new BasicQTSherlock (m);
f.pack();
f.setVisible(true);

It looks as though you create a whole new frame for each movie. If
you want that frame to disappear, you will need a f.dispose()

I have never heard of this API. Look for some close, dispose, remove
methods at the various levels that you call when the movie is done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top