Draw text on composite [message #492143] |
Mon, 19 October 2009 06:20 |
bao Messages: 1 Registered: July 2009 |
Junior Member |
|
|
hey, all, now i want to put a new transparent composite on the top of
the clock, so i can draw some text on the composite. But i have met the
problem, I couldn't put the new transparent composite on the top of the
clock. Anyone can help me?
regards,
lefish
public class Snippet3
{
private OleAutomation player;
public Snippet3()
{
final Display display = new Display();
Shell shell = new Shell(display);
Composite c1 = new Composite(shell,SWT.NONE);
shell.setLayout(new FillLayout());
c1.setLayout(new FillLayout());
OleControlSite controlSite;
try
{
OleFrame frame = new OleFrame(c1,SWT.NONE);
controlSite = new OleControlSite(frame,SWT.NONE,"WMPlayer.OCX");
controlSite.doVerb(OLE.OLEIVERB_SHOW);
}
catch (SWTError e)
{
System.out.println("Unable to open activeX control");
return;
}
player = new OleAutomation(controlSite);
c1.setFocus(); // prevents vm from crashing on shutdown.
shell.pack();
shell.open();
setUIMode("none"); // does not display anything without this line.
loadFile("c:/windows/clock.avi");
while ( !shell.isDisposed())
{
if ( !display.readAndDispatch())
display.sleep();
}
player.dispose();
display.dispose();
}
public boolean loadFile(String URL) {
int[] ids = player.getIDsOfNames(new String[] { "URL" });
if (ids != null) {
Variant theFile = new Variant(URL);
return player.setProperty(ids[0], theFile);
}
return false;
}
private void setUIMode(String s) {
int ids[] = player.getIDsOfNames(new String[] { "uiMode" });
if (ids != null) {
player.setProperty(ids[0], new Variant(s));
}
}
public static void main(String[] args) {
new Snippet3();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.01691 seconds