I'll ask once again, what java release is this with?
Dmitri
[EMAIL PROTECTED] wrote:
Hi, I tried JXTransformer. Things seem to work at first except: if I embedded the JXTransformer-Panel into a JScrollPanel then - as soon as I shift the view - I get again this dreaded
Exception in thread "AWT-EventQueue-1" java.lang.InternalError: Win32OSSD_Lock cannot nest locks
:-(
What am I missing??? I seem to be so close!
You can try yourself:
------------------------------------
package test;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.AffineTransform;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import org.jdesktop.swinghelper.transformer.JXTransformer;
import javax.swing.JApplet;
@SuppressWarnings("serial")
public class TestJXTransformer extends JApplet
{
@Override
public void init() {
Container mainPanel = getContentPane();
mainPanel.setLayout(new BorderLayout());
this.setLayout(new BorderLayout());
JPanel viewer = new JPanel();
viewer.setLayout(new GridLayout(4,4));
for (int i = 0; i < 16; i++) {
JButton button = new JButton("button " + i) {
{
this.addActionListener(new
ActionListener()
{
@Override
public void actionPerformed(ActionEvent
e) {
System.out.println(getText() + "
pressed");
}
});
}
};
viewer.add(button);
}
JXTransformer transfomer = new JXTransformer(viewer);
// for some strange reason one can apparently not add a
JXTransformer directly to
// a ScrollPanel - if one first adds it to another JPanel
things seem to work:
JPanel zoomPanel = new JPanel();
zoomPanel.add(transfomer);
mainPanel.add(new JScrollPane(zoomPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
BorderLayout.CENTER);
double scale = 1.5;
AffineTransform at = transfomer.getTransform();
at.scale(scale, scale);
transfomer.setTransform(at);
}
}
------------------------------------
Cheers and thanks,
Michael
[Message sent by forum member 'mmo18' (mmo18)]
http://forums.java.net/jive/thread.jspa?messageID=292912
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".