Hi,
Looking through the archives, I came upon ZScrollableDesktop and have been trying to adapt it to my needs. Specifically, I need to have the scrollpane automatically scroll, as in scrollToVisibleRect(), not merely resize the desktop so as to create appropriate scrollbars.
I'm no stranger to writing desktop layout managers, and I know the solution is somewhere in the dragFrame() method of ZDesktopManager, but I just can't get scrolling to work correctly.
My dragframe() looks something like this:
public void dragFrame( JComponent f, int newX, int newY ) {
Rectangle dBounds = f.getParent().getBounds();
if( newX < 0 ) {
newX = 0;
}
if( newY < 0 ) {
newY = 0;
}
super.dragFrame( f, newX, newY);
// I pass a reference to ZDesktopPane to ZDesktopManager
desktop.scrollRectToVisible(new java.awt.Rectangle(newX, newY,1,1));
desktop.repaint();
}
Unfortunately, this doesn't work properly. As the internal frame is dragged beyond the viewport window bounds, the scrollpane does indeed begin to scroll, but the cursor position relative to the internal frame begins to grow in the direction of the scrolling. In essence, the cursor 'runs away' from the internal frame. There is some interaction between scrolling and internal frame position that I'm not taking into account, so that's where I was hoping for some help.
I'd especially appreciate a tested solution.
Thanks in advance,
Alex
I'm having a problem when I copy an image to the Windows SystemClipboard. When I copy an image ...
By jonathanm_usa
Hi, I was wondering if it was at all possible to include a hotkey on a simple JOptionPane. E.g. If a...
By ibeandya
Hey!I'm having problem with entering numbers after decimal point. I 've settwo numbers aft...
By kishanthany_gmail
Hi Guys,Any help appreciated on this one:I was happily building projects using netbeans 3.6, and was...
By jez_naisbitt
Hi all,I am using a lot of JOptionPanes in my swing application and would like toget mnemonics worki...
By hbb, 1 Comments
Salve a tutti,sto sviluppando un'applicazione web piuttosto complessa in java che utilizza il f...
By matic74_libero_it, 1 Comments
Hi all!I want to have both Image and Text on a Button. I want the Image on top of the Button, and th...
By trondaa, 2 Comments
Greetings,Please have a look at this [url=http://www.dadid.com/tmp/example.jpeg]picture[/url]. It's ...
By josaha, 3 Comments
Hi guys, I hope everyone is fine.....Well, i try to finish a project and only have to solve two smal...
By giscard_aiobaa, 4 Comments