posted 8 years ago
Please help. I developed a PDF and Tiff image viewer as an applet.
Its working fine, but I have the following problem.
Applests cant resize, so now I'm trying to drag the applet of the page by using the new Alt + Leftclick,
The new draggable functionality from Java 1.6.10.
It works fine, but I want it to become a windowed frame so that it can be resized.
Any body please!!!
Its working fine, but I have the following problem.
Applests cant resize, so now I'm trying to drag the applet of the page by using the new Alt + Leftclick,
The new draggable functionality from Java 1.6.10.
It works fine, but I want it to become a windowed frame so that it can be resized.
Any body please!!!
Jacques Gertenbach
Greenhorn
Posts: 4
posted 8 years ago
With the new Java 1.6.10 release you are nou able to drag and drop you applets out of a web page to be stand alone applications on the desktop, using Alt + Left click.
It works fine, but once you have done so, you cannot resize the applet. This is due to the fact that the applets parent containter is a Frame without any features. It only gives you a little black x at the top right to close the applet which anchers it back to your page.
I have mangange to detach the applet by using the following code, but I would like to keep the Alt + Left click functionality and force the applet into a visable framed window that can be resized.
Meaning, I would like to be able to minipulate the parent container that is created by the Draggable functionality now available in 1.6.10.
Thanks
public void putInFrame()
{
AttachDetachButton.setText("Attach");
bStandalone = true;
dimOrigSize = new Dimension(getSize());
myParent = getParent();
myFrame = new DetachedJFrame(this,"Image Viewer");
Dimension siz = new Dimension(dimOrigSize);
myFrame.setSize(siz);
myFrame.add("Center",this);
myFrame.setVisible(true);
}
public void removeFromFrame()
{
AttachDetachButton.setText("Detach");
bStandalone = false;
myFrame.remove(imageViewer);
myFrame.dispose();
myFrame = null;
myParent.add("Center",imageViewer);
resize(dimOrigSize);
myParent.setVisible(true);
}
class DetachedJFrame extends JFrame
{
private ImageViewer iv;
public DetachedJFrame(ImageViewer imageViewer,String strName)
{
super(strName);
iv = imageViewer;
}
@Override
public void processEvent(AWTEvent evt)
{
if (evt.getID() == WindowEvent.WINDOW_CLOSING) {
iv.removeFromFrame();
return;
}
processWindowEvent((WindowEvent)evt);
}
}
It works fine, but once you have done so, you cannot resize the applet. This is due to the fact that the applets parent containter is a Frame without any features. It only gives you a little black x at the top right to close the applet which anchers it back to your page.
I have mangange to detach the applet by using the following code, but I would like to keep the Alt + Left click functionality and force the applet into a visable framed window that can be resized.
Meaning, I would like to be able to minipulate the parent container that is created by the Draggable functionality now available in 1.6.10.
Thanks
public void putInFrame()
{
AttachDetachButton.setText("Attach");
bStandalone = true;
dimOrigSize = new Dimension(getSize());
myParent = getParent();
myFrame = new DetachedJFrame(this,"Image Viewer");
Dimension siz = new Dimension(dimOrigSize);
myFrame.setSize(siz);
myFrame.add("Center",this);
myFrame.setVisible(true);
}
public void removeFromFrame()
{
AttachDetachButton.setText("Detach");
bStandalone = false;
myFrame.remove(imageViewer);
myFrame.dispose();
myFrame = null;
myParent.add("Center",imageViewer);
resize(dimOrigSize);
myParent.setVisible(true);
}
class DetachedJFrame extends JFrame
{
private ImageViewer iv;
public DetachedJFrame(ImageViewer imageViewer,String strName)
{
super(strName);
iv = imageViewer;
}
@Override
public void processEvent(AWTEvent evt)
{
if (evt.getID() == WindowEvent.WINDOW_CLOSING) {
iv.removeFromFrame();
return;
}
processWindowEvent((WindowEvent)evt);
}
}
Jacques Gertenbach
Greenhorn
Posts: 4
Jacques Gertenbach
Greenhorn
Posts: 4
posted 8 years ago
I unfortunalty do not have the code any more. After implementing the new code I did a cleanup.
Yes the JFrame in the dragstart event was sizeable.
The frame that java is creating in the draggable functionality is killing or interfeering with JFrame I am implementing.
I will see if I can recreate the code for you. Dont have too much time on my hands at the moment
Yes the JFrame in the dragstart event was sizeable.
The frame that java is creating in the draggable functionality is killing or interfeering with JFrame I am implementing.
I will see if I can recreate the code for you. Dont have too much time on my hands at the moment
