Can't make JScrollPane work
Hello!
I'm just trying to make this have those things that you can scroll with.
Here is my code, it's retty close to a exemple code from a O'reilly book but I can't make it work.
(In case it's important DrawingArea extends JPanel)
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import java.awt.Color;
public class SlidingWindows {
public static void main(String[] args) {
JFrame frame = new JFrame( "Sliding windows" );
DrawingArea pane = new DrawingArea();
JScrollPane scroll = new JScrollPane(pane);
frame.getContentPane().add( scroll );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize( 500, 200 );
frame.setVisible( true );
}
Your code is working but what you are putting inside the scroll pane is resizing so it never needs to scroll (unless you make it really small) try the code below which uses a JTextArea to demonstrate:
public class SlidingWindows {
public static void main(String[] args) {
JFrame frame = new JFrame( "Sliding windows" );
JPanel panel = new JPanel();
JTextArea textArea = new JTextArea(100,200);
panel.add(textArea);
JScrollPane scroll = new JScrollPane(panel);
frame.add(scroll);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize( 500, 200 );
frame.setVisible( true );
}
Similar Messages
-
I have a new MAC MINI and I want to install a second monitor. I have one connected to the HDMI and it works. I can't get a signal to the other one. It is connected from the thunderbolt to its HDMI port. How can I make it work?
Could be a bad cable or bad Thunderbolt port.
You have 90 days of free telephone support on a new device. You can call them at 1-800-MY-APPLE. Have your Mini's serial number handy
You can also make an appointment at the Genius Bar of an Apple store.
Apple Retail Store - Genius Bar -
My Zoom in Gesture Doesn't Work on Safari How can i make it work?
I just bought a mac book pro 2011 and i know that the zoom in gesture used to work on safari at first but it doesnt anymore how can i make it work again?
So it does not work at all in Safari? Do you have any other web browsers installed that you could test it out on to see if it is just acting up with Safari?
-
I use to be able to access all my music and videos on my iTunes via my Apple TV, but since a few months it hasn't work. My daughter tried with her computer and apple ID and it worked, but I want my Library to be accessible. I tried starting it over, rebooting it, but nothing seems to be working.
How can I make it work?
Thank you!Check firewall and any security software installed on your system. Toggle off/on home sharing on your computer.
-
My form has a list of yes or no questions. I want to use either cheboxes or radio buttons. Unfortunatly I can't make it work. When I check yes for one question, it marks all yes answers for all other questions. If I mark some radio buttons to answer, it unmarks later. Need immediate help!!!
Is it that you are using a PDF-based form? Did you copy and paste the Yes/No fields all the way down your form? If so, then all of the yes/no boxes are copies of each other and have the same name and properties in the PDF.
For example, if you had:
Question 1 and Question 1 Yes/No checkboxes
Question 2 and Question 1 Yes/No checkboxes
Question 3 and Question 1 Yes/No checkboxes
Question 4 and Question 1 Yes/No checkboxes
Then whatever answer you selected in Question 1 would populate down through the rest of the form.
Changing the Yes/No field properties in questions two through four would eliminate the problem.
I hope that helps,
Brian -
when i burn videos to a dvd-r disc it works on my macbook but not on a windows/pc or my dvd player. How can i make it work on all the above and not just a mac product?
Unfortunately, the recording & movie industry does not respect the rights of the people who make them money, and thus you can only use the paid-for content in ways they see fit. Even if I lived in a bunker where no one else could possibly see the movie I paid for, therefor I'm not 'sharing it illegally', I would still not be allowed in a blue moon to copy that movie to DVD for TV viewing. Someone will tell you to get an AppleTV. How about Apple give us one for free? Until this changes, people wanting to use their content in multiple locations will continue to download music & movies via torrents, legally or illegally.
-
I'm new to mac. Just started out. Have OS 10.8.3. I have an HP 1315 printer. It prints and copies, wont scan. I see old threads on this, nothing recent. ?can i make this work, or do i need a new printer??
Hi Newbie111
I see that you are unable to scan with the Photosmart 1315.
What driver are you using?
The driver listed in the url below is a basic print driver that will allow you to print only.
http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ps242muc&c c=us&dlc=en&lc=en&os=1006&product=61956&sw_lang=
You can try using the apple drivers in the url below.
http://support.apple.com/kb/DL907
If you have any further issues please let me know. -
my apple store isn't working after I updated to ios 8.1.3, its just a blank screen and it won't load after doing everything I can to make it work again. I even restarted the phone and I just don't know what to do at this moment.
Sign out of the Appstore and back in and it should resolve the issue.
Setting > iTunes and App Store > click the Apple ID at the top and click sign out. Click sign in. -
When I insert a photo from iphoto into imovie, the photo that appears is different from the one that I inserted. Why is this and how can I make it work properly?
WHat version of iMovie, and iPhoto?
THIs forum is for iMovie iOS (iPads, iPhones).
Are you talking about iMovie for Mac? -
The "always match my default message font" option in the Signature preferences from Mac Mail does not work if e-mail is received in other Mail Software. How can I make it work?
I found this plugin which solved pretty much all of my mail font rendering problems. It is designed for Lion, so don't know whether it will work but thought I would offer it up.
http://noware-it.zxq.net/ -
Compatibility of Firefox 6 with Trend Micro titanium - how can I make them work together?
I have not downloaded FF6 yet because it is not compatible with my virus software - has this changed? If not, is there a simple "fix" or workaround?
Thanks.Found the following on the TrendMicro forum:
*TrendMicro forum: http://community.trendmicro.com/
*Found fix in this thread: http://community.trendmicro.com/t5/Home-and-Home-Office-Forum/Firefox-6-amp-TM-Firefox-Extension-6-5-0-1234/td-p/43735 (posted by PartyJetsetGo, Customer Service Manager)
*[Hot Fix] B1306: http://esupport.trendmicro.com/solution/en-us/1059243.aspx
'''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.''' -
I´m new at Garageband and Mainstage. How can I make them work together?
You may want to download and read the manual for your phone. It may answer a lot of the basic questions.
http://support.apple.com/manuals/#iphone
There is an app on your phone called "Mail". Yes, it's for reading your email.
Best of luck. -
Need to add condition to a template and can not make it work.
I am trying to add a condition to a template and can not make it work. Mainly because I am new at this. I have a field that needs to have a condition set. The field is LTD. The maximum value is $233.00. If the amount is less the 233, that value is used. If it is over 233 then 233 is used. So, if LTD is greater then 233.00 then 233.00 else LTD.
Can anyone help me write this for a Word BI Publisher Template. I need this report now but can't go to class until later this year.
Thanks,
RickReplace LTD with the correct element name.
<?choose:?>
<?when: LTD > 233 ?>233<?end when?>
<?otherwise:?><?LTD?><?end otherwise?>
<?end choose?> -
My Macbook Pro has become very slow and it sometimes hangs. How can I make it work faster and normal? I used Etrecheck and got the report below;
EtreCheck version: 1.9.12 (48)
Report generated June 16, 2014 at 18:05:25 GMT+1
Hardware Information:
MacBook Pro (13-inch, Mid 2012) (Verified)
MacBook Pro - model: MacBookPro9,2
1 2.5 GHz Intel Core i5 CPU: 2 cores
4 GB RAM
Video Information:
Intel HD Graphics 4000 - VRAM: (null)
Color LCD 1280 x 800
System Software:
OS X 10.9.3 (13D65) - Uptime: 0 days 1:50:52
Disk Information:
APPLE HDD TOSHIBA MK5065GSXF disk0 : (500.11 GB)
EFI (disk0s1) <not mounted>: 209.7 MB
Machintosh HD (disk0s2) / [Startup]: 499.25 GB (465.33 GB free)
Recovery HD (disk0s3) <not mounted>: 650 MB
MATSHITADVD-R UJ-8A8
USB Information:
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. Apple Internal Keyboard / Trackpad
Apple Inc. BRCM20702 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Computer, Inc. IR Receiver
Thunderbolt Information:
Apple Inc. thunderbolt_bus
Gatekeeper:
Mac App Store and identified developers
Launch Daemons:
[loaded] com.adobe.fpsaud.plist Support
[loaded] com.microsoft.office.licensing.helper.plist Support
User Login Items:
iTunesHelper
Dr.Web Light
Dropbox
Internet Plug-ins:
SharePointBrowserPlugin: Version: 14.0.0 Support
FlashPlayer-10.6: Version: 14.0.0.125 - SDK 10.6 Support
Flash Player: Version: 14.0.0.125 - SDK 10.6 Support
QuickTime Plugin: Version: 7.7.3
Default Browser: Version: 537 - SDK 10.9
Safari Extensions:
iGetter Extension: Version: 2.9.2
Audio Plug-ins:
BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
AirPlay: Version: 2.0 - SDK 10.9
AppleAVBAudio: Version: 203.2 - SDK 10.9
iSightAudio: Version: 7.7.3 - SDK 10.9
iTunes Plug-ins:
Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
User Internet Plug-ins:
iGetter Plugin: Version: 2.9.2 Support
iGetterScriptablePlugin: Version: 2.9.2 Support
3rd Party Preference Panes:
Flash Player Support
Time Machine:
Time Machine not configured!
Top Processes by CPU:
4% Dropbox
3% WindowServer
0% fontd
0% Microsoft Word
0% Microsoft Excel
Top Processes by Memory:
242 MB drwebd
176 MB Dropbox
147 MB Dr.Web Light
86 MB WindowServer
82 MB App Store
Virtual Memory Information:
43 MB Free RAM
1.68 GB Active RAM
1.65 GB Inactive RAM
641 MB Wired RAM
421 MB Page-ins
0 B Page-outsMeli070,
uninstall Dr.Web Light. -
I have a version 1 iPad. I would like to be able to use my LCD projector to display content to my students. I have the dongle to attach to the projector, but can't make it work. The process DOES work with my friend's iPad 2. Any advice? Thanks!
Expanding on what deggie said, with an iPad 1 the app you're using must support video out. Only the iPad 2 can mirror the screen. The apps included with the iPad that output to external monitors are given here:
http://support.apple.com/kb/HT4108
For third-party apps, consult the app's documentation or contact the developer.
Regards.
Maybe you are looking for
-
Why can't i buy more than one thing at a time?
I have 20+ items in my Wish List & I can find no way to buy all of them at once...only one at a time. Since that is a highly irritating way to make my purchases, I have to believe that I am missing something somewhere - is there no shopping cart any
-
Is there a way to have the use of what we used to call "Macros" which would be a key you could hit where you have installed a word, phrase, etc that you type repeatedly? By this I mean if, while on line, you repeatedly type out the phrase "Thank you
-
Why don't I have enough memory on Nokia 6230?
Hi: I have a Nokia 6230 and sync it regularly with my computer. I have about 700 contacts and sync a relatively full calendar from one week ago to two weeks in advance. A to-do list also synchronizes. I regularly get the following error on my compute
-
Alert Mail configuration in Solution Manager 7.1 for Portal Runtime errors
Dear Friends, We have EP7.01 SP5 installed on windows environment with Oracle DB. Also we have SAP EHP 1 for SAP Solution Manager 7.0. Please help to provide steps to configure proactive mail alert configuration , GRMG for High availability Any por
-
Crystal Report Database connection problem in CMC
Dear All, We are using Business Objects XI 3.1, Crystal Report 2008 SP1 for report development. Crystal reports are generated using SAP BW Query. Where in, once you have published Crystal report to Enterprise server and open the same using Infoview i