Scrolling JPanel works but doesnt autoscroll based on focused subcomponents
I need to create a JPanel with large amounts of JTextField components for data entry...
I want to put this in a JScrollpane so that the large amount of fields can fit on the screen.
I have this working, with scrollbars and all however,
When i tab through the textfields, the viewport does not autoscroll to show the active components
I was hoping there was an easy way to get the scrollpane to behave this way.
Any ideas?
Listen focus to force scrolling when a hidden textfield must be scrolled up to get visible.
Try this, I add 10 JTextField to a JPanel. JScollPane receive setViewPosition when focusEvent occur.
JPanel spane = new JPanel(new GridLayout(0,1));
jsp = new JScrollPane(spane);
for (int i=0; i<10; i++) {
JTextField field = new JTextField(20);
spane.add(field);
field.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent fe) {
JTextField field = (JTextField)fe.getSource();
int last = jsp.getVerticalScrollBar().getValue() + jsp.getViewportBorderBounds().height;
if (field.getBounds().y > last) {
jsp.getViewport().setViewPosition(new Point(field.getBounds().x, field.getBounds().y));
}This is working when scrolling down, you have to adapt for scrolling up.
Similar Messages
-
My iphone has always connected automatically and without problem to the wifi at work i.e. BTBusinesshub and at home BTHomehub but yesterday it would not connect at work. It is ok at home but again today at work it is not connecting. It appears to try but is not connecting, please help.
You can try doing a reset, hold down the home/power button until you see the apple logo and then release, then wait for the phone to boot back up - then check wifi - if that doesn't work then
do a network reset note: you will have to reenter wifi password again when your in range.
settings - general - reset - reset network settings. If that doesn't work then I would talk to your IT dept. -
T track pad stoped working properly it moves and scrolls but doesnt click, its
Do you mean that the trackpad will not physically click? Or does not register the click.
Which model Macbook/trackpad do you have? -
Hey, my ipad is disabled and i cant open. i tried connecting it with itunes in recovery mode to restore it but it wont work it doesnt show and options itunes doesnt detect my ipad in recovery mode. what do i do know? please help!!!
If you followed these instructions and you were unable to enter recovery mode, I'm still leaning toward a hardware problem. Also, since you have IOS-7, read this. It might help.
-
Just bought an ipod touch and it wont sync with itunes. Tried resetting sync history but doesnt work, plus when i try to access itunes preferences it freezes for ages and creates loads of distnoted.exe files?????
Just realised when reading other peoples problems that it is not actually letting me reset sync history???
-
I bought a macbook off of a friend but the CD drive to the computer doesnt work and was broke awhile ago. I needed to install some software onto this computer so I bought the Apple USB SuperDrive thinking it would work, but later finding out that it is only compatible with macs that dont have a superdrive built in. An Apple support technician told me that it could be done through a process, but she couldn't help me with. So it would be greatly appreciated if someone can help me with this problem. Thank You!
There is some useful information here about the process mentioned:
http://www.hardturm.ch/luz/2011/10/how-to-make-the-macbook-air-superdrive-work-w ith-any-mac/
Of course you need to be very careful with any use of Terminal. -
I recently had my iphone 4s screen repaired because the screen was cracked. It was all ok and then a few weeks later something strange happened. My touchscreen works, but the screen doesnt show, you can see the light in the background but no picture? has anyone got any ideas as to what the problem is, is it self-repairable or even repairable at al?
The LCD Display connector has partially come loose from the logic board connector, and simply needs to be pressed back down into place. Or the front screen assembly is now faulty, and needs to be replaced again.
-
Hi I have a Konica Minolta PagePro 1300W printer. This works with my Windows-based Toshiba laptop but not with my i-Mac. I have the latest (Mountain Lion 10.8.2) OS-X software.
I have installed the printer using 'System Preferences' on my i-Mac and it appears on the list of available printers but documents that I create just don't print.
Can someone please advise me how I get the Konica Minolta PagePro 1300W printer to work with my i-Mac?
Thanks, John LeeLooking at the Konica web site for the PagePro 1300W, I saw the following note.
Please note: This printer is designed to be used in computer operating systems running MS Windows only. Operating systems such as UNIX, Macintosh, or Linux are not supported nor do we have workaround drivers available. Older MS Windows versions, such as Windows 3.1/95/98[pre-SE] and NT 3.51/4.0, are not supported.
So KM are not going to help you. But the LinuxFoundation does provide a workaround that should allow you to print. Have a look at this web page. You will need to install all three packages as per the instructions from that page. -
i am having alot of trouble i want to use imessage but everytime i turn it on it turns on but doesnt work and it says verifying but its verifying my old number and i need it to verify my new number but it wont let me
You can likely download the last compatible version by:
Starting when iOS 7 was released, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
App Store: Downloading Older Versions of Apps on iOS - Apple Club
App Store: Install the latest compatible version of an app
You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists. -
I have a Mac running 10.9.2. My apple wireless mouse will not scroll in Mail but works fine in other applications.
Any suggestions?First, see this discussion. If the solution suggested there doesn't work for you, continue.
If you've installed a Mail plugin called "Mail Unread Menu" and you know how to remove it, please do that, then quit and relaunch Mail. Test. Otherwise, see below.
Back up all data.
1. Triple-click anywhere in the line below on this page to select it:
~/Library/Mail/Bundles
Right-click or control-click the highlighted line and select
Services ▹ Open
from the contextual menu.* A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.
2. Repeat with this line:
/Library/Mail/Bundles
This time you may be prompted for your login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.
*If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
Go ▹ Go to Folder...
from the menu bar and paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return. -
My touchpad scroll was not working many times after i installed firefox 6. But it works perfectly fine in other browsers at the same time.
After some playing around, i found that this problem occurs only when a pdf is open in some tab (The scrolling works in pdf's tab but not in other tabs). Once that particular tab is closed, the scrolling starts working properly.Using similar scroll function on my netbook. To add to the above, I find that using scroll is actually causing the PDF to scroll rather than the tab I'm actually in.
Reader 9 is installed on my Win7 Starter. -
ı buy virtual tenis game but doesnt work 3gs help please
ı buy virtual tenis game but doesnt work 3gs help please
ALL U.S. iphones are carrier locked and CANNOT be unlocked at all. They can ONLY be activated with AT&T in the U.S. No other carrier, no other country.
No. A U.S. iphone would have to be returned to the U.S.
If possible you need to return the iphone to the U.S. for a full refund and buy one in your country. -
1ST GENERATION I-PHONE RINGER DOESNT WORK VOLUME ADJUSTMENT WORKS BUT NO SO
HELP RINGER DOESNT WORK VOLUME ADJUSTMENTS SHOWS IT WORKS BUT NO SOUND HELP
Hi dolster,
Do you see a red dot on the side of the iPhone?
The iPhone will not ring if the Ring/Silent switch shows a red dot.
If the issue is not because of the Ring/Silent switch, try resetting the iPhone by holding the Home and Sleep/Wake buttons until you see the Apple logo as described here: http://docs.info.apple.com/article.html?artnum=305743
-Jason -
Scrolling Header works in Visual Studio but not on Report Server 2008
2008 R2 Reporting Services. My scrolling header works in Visual Studio but not when deployed to the Report Server and viewed in IE 9. I have read most every post on this issue and can't find a solution. I have the fixed data properties
set correctly. Any suggestions?
Help appreciated!
LindaHi Linda,
As a suggestion, I would try to delete the deployed version and instead of deploying ther RDL file, i would try to upload the file and test it.
If the issue exisit, then I would download the exisiting version from the reportserver and compare the xml versions of the two reports and check if the propoerty is getting over written while deploying.
HTH,
Ram
Please vote as helpful or mark as answer, if it helps -
When i go to swich my 3g on it has the green slider but doesnt work
i reasently purchaced an iphone 5s from EE when i go to swich on my 3g the grren slider in on but the 3g doesnt work it has bars next to it but doesnt work. i have tried everything from taking out my sim card to reseting my whole phone but nothings changed. Its really frustrating and i need help urgent! Thank you
Hi
Welcome to Community.
You need to restore the device via iTunes. Click here for the Apple help & support on restoring.
Let me know how you get on!
Thanks.
Maybe you are looking for
-
Open bat file on client machine using webutil
Hi all. I'm on devsuite 10g. I want to run a bat file on client machine using client_host function of webutil. I have tried first to execute the bat file with mouse double-click in order to check if it is ok, and it works. Now I want to execute this
-
This should be a simple question, I just cant seem to get it. I want to cast an int to an Object. // --- Does not work int num = 16; Object obj = num; // --- Does not work int num = 16; Object obj = (Object)num; // --- Does not work Object obj = (Obj
-
Hi all, I have a 5200 whithout a digital output and I´m interested in a TFT with DVI-I. The manual of the card says that the card "supports" DVI-I. Can I buy a connector forn the card or something like that? Thanks,
-
Calculate future date in MM/dd/yyyy format
Hi, I am trying to add a 56 months to a given date (MM/dd/yyyy string) and output the date in MM/dd/yyyy format. Here is my code: SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy"); date.parse("07/30/2000");
-
Setting up Unity Connection to email/call cell for new vmail msg
Hello, I have been trying to setup Unity connection so that it will send an email to Exchange or a message toa cellphone alerting a user that they have a new vmail. I went in under my user account to test (under Edit\Notifcation Devices) and added my