Help - draw objects doesn't appear on JFrame
i got this code from a book...
import javax.swing.*;
import java.awt.*;
class Ch5SampleGraphics {
public static void main( String[] args ) {
JFrame win;
Container contentPane;
Graphics g;
win = new JFrame("My First Rectangle");
win.setSize(300, 200);
win.setLocation(100,100);
win.setVisible(true);
contentPane = win.getContentPane();
g = contentPane.getGraphics();
g.drawRect(50,50,100,30);
the problem is when i run the app, the frame doesn't always show the rect drawn. sometimes it shows it, but usualy not. if it does show the rect, once i click on minimize, then reopen it from the taskbar, the rect will disappear again and will never show up.
can anyone help me? i've been searching for answers but to no avail. thanks 4 reading, hope someone will offer some help.
an intoduction to oop with java
Jesus wept. The code's about as un-object-oriented as you could possibly make it.
Looking at his sample chapter on the book's web page all I see is main() methods with linear code in and just simple number crunching with primitive types. No objects to speak of at all.
I'm sticking with my "throw the book away" advice :o)
Similar Messages
-
BAM 11g - Data object doesn't appear!!
Hi!
I'm doing the QuoteProcessLab, now I'm doning the BAM lab. It says that after running the setup.bat and redeploying the project with the settings that enable BAM, I should see in the BAM Page a BI_DEFAULT_Composite_Process, but I don't see that data object.
I have run again the setup.bat and redeployed the project and the data object doesn't appear!
Am I missing some step?
Thanks in advance!
AnaChris,
All the details of what the filter is doing are hidden. They only appear on the configuration dialog or in the code inside the Express VI. Without the actual code (an image is useless) we cannot tell.
Most likely the filter is configured in such a way that the output is empty so that there is nothing to write to the file.
Try putting some indicators at the input and output of the filter to see what is there.
Lynn -
I followed the instructions on your site and Roboform's site, but Roboform doesn't appear in the Customize Toolbar window nor does it appear in the Extensions list. How can I get the Roboform Toolbar back?
Here's an interesting bit: iTunes will let me restore my iPod touch from backup: it's still running iOS 4.3.3. I figured as much... there's backups showing in the Preferences -> Devices list for both devices (and even my old, long gone iPod touch 2G), but my iPhone (on iOS5) isn't giving me any such option. I remember I had to downgrade before to get the backup restored (something went haywire in the setup assistant, and I couldn't restore a backup from iTunes there)... If it was possible to go to iOS 5.0 rather than 5.0.1 I would just do the same thing again, but iOS 5.0.1 isn't an option. I attached a screenshot. Hopefully Apple can get this nonsense sorted out; I think iOS 5 might be the root of this, somehow.
-
Help! Dock doesn't appear, font type of hour/battery changed
I've just installed iLife '11 and:
1) dock disappear (if I move the mouse over it's not working)
2) font type of data/hour and batter changed
3) icons don't appear (on application/utility etc)
4) system is incredible slow. When I type it freezes for a while.
What should I do? please help me!I think I understand.
You can also try to reset the PRAM, here are the instructions:
_PRAM RESET_
• Shut down the computer.
• Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
• Turn on the computer.
• Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
• Hold the keys down until the computer restarts and you hear the startup sound for the second time.
• Release the keys. -
If i selected to "Create a new backup" and then canceled that option but want to go back and select "Inherit backup history"; how do I go back and do that since now when I plug in my external hard drive, that option doesn't appear anymore?? Any Help? I bought a MacBook Air, but decided to return it for the newest model, and I wanted to back it up so that I can then back it up on my new MacBook Air. I didn't understand the option to Inherit or start a new back up, and therefore selected the option to create a new backup. I believe I should have selected to Inherit backup history so that when i back it up on the new MackBook Air, it appears the same as the one I'm returning.... Is there anyway that i can re-select the option to Inherit backup history for time machine?
Thanks for sharing this link.
I've posted a question here https://discussions.apple.com/message/22049103#22049103 describing my situation. Are you able to suggest me the right option? -
I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
Thank youSo it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB
-
The download button as described on the HELP page doesn't appear on the page listing my purchase.
The HELP instructions list that such a button must be clicked to down load an item.
I have made 3 purchases of the same song in an attempt to download it.
Only one of those purchases appears on the page that list purchases available to down load.
I wrote out a copy of the HELP page instructions (the page can't be printed) so I could accurately follow it as I tried to do the down load.
Is there some secret to downloading a purchase or causing the down load button to appear?Hello L Swarz,
Thank you for the details of the issue you are experiencing when downloading your purchased song to your iPod nano.
I am not sure if you have tried these specific steps, but I recommend downloading the purchased song to iTunes on your computer using the steps in the following article:
iTunes 11 for Windows: Download previous purchases from the iTunes Store
http://support.apple.com/kb/PH12491
Thank you for using Apple Support Communities.
Best,
Sheila M. -
please help URGENT : Chinese handwriting doesn't seem to work on Lion OSX. the handwriting trackpad appears but anything i write in Chinese doesn't appear in word, chrome,..... HELP PLEASE
And in system prefs/language and text/input languages, simplified chinese and traditional chinese are ticked as usual with handwriting options on !!!!Please search the forum for "chinese" to find the many other earlier posts about your issue, like
https://discussions.apple.com/message/15746805#15746805 -
IPhone is plugged in to my laptop and is charging but will not sync. The phone logo doesn't appear in the right hand corner. i have updated itunes restarted both phone and laptop, changed connectors and still nothing. help?
Same thing happened to me, nothing is working. I've updated everything, restarted everything, nothing seems to work.
-
Help! How do I uninstall the Nokia I-Sync app? It doesn't appear in my applications folder and I can't drag it into trash.
Thank you. Found it in the Finder but it won't let me drag it into trash because it says it's still open. But there doesn't seem to be a way to quit out of the application...
-
Hyper draw doesn't appear unless you set Hyperdraw/Articulation ID
From the last 2 or 3 version Logic has an annoying behaviour on score window: Hyper draw doesn't appear unless you set Hyperdraw/Articulation ID/Any or None...
This procedure has 3 minus points:
1. The editing is slowed down
2. Every time you close and reopen the score window YOU HAVE TO REDO IT!!!!
3. What is it for?.....
It was better before...For Radeon 7000, you need to:
pacman -S xf86-video-ati
You need to load those modules in /etc/rc.conf:
MODULES=(agpgart via-agp)
And in xorg.conf:
Driver "radeon" -
I just bought a new macbook pro and my CS6 migrated, but now when I open existing documents, it launches a free trial version. There doesn't appear to be a way to enter my serial number or communicate that I simply have a new computer. HELP! There is no customer support for this. I can't believe what a poor service company Adobe is!!
The problem was that you migrated CS6. Unfortunately, migration doesn't work because it doesn't move all the files.
First, you'll need to use the Adobe Cleaner Tool to remove the components that were installed:
Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
Second, you should install a clean copy of CS6. Here is a link:
Other downloads -
I have a late 2012 mbpr w/ external superdrive. I inserted a disc it won't read, so it doesn't appear on my desktop and disc utility is no help until the disc is read. there is no eject button. What do i do?
a brody... you have a new fan.
Peace,
Matthew -
I've entered my reg. code for Quick Time Pro but it doesn't appear to have installed ... it's not showing in my apps folder. Anyone help me?
I've entered my reg. code for Quick Time Pro but it doesn't appear to have installed ... it's not showing in my apps folder. Anyone help me?
The QT X v10.1 app installs in your "Applications folder and QT 7 v7.6.6 (whether keyed for "Pro" use or not) is installed in the "Applications/Utilities" folder. It is recommended you keep them in these locations so they will continue to update correctly/automatically. -
How can I delete apps off of my iPhone 4? I know the apps will begin to shake, but the "X" doesn't appear like it's suppose to. Help, please!!!!
What apps are you trying to delete? Apps that come on the phones cannot be deleted in this fashion. Only apps you purchase from the app store can be deleted.
Maybe you are looking for
-
HT3702 Why does it read my apple ID has been disabled when I try to download
When I try to download an album from the iTunes store, I get a message that my apple ID has been disabled. I have a balance on my account,so I'm not sure whats going on.
-
I am looking for help! My planned workflow is as follows: Footage recorded on Canon Rebel T3i ---> Edited on Final Cut Pro 6 (sequence compression is apparently H.264 according to the browser) ---> Compressed with Compressor (ver 3.0.5) in origin
-
one of Vendor has a down payment which is a debit balance on their account, however other invoices that are due came into payment proposal to issue a check. Customer had to manually block the invoice documents so payment would not generate. Does n
-
hi I am trying to invoke OE_ORDER_PUB.PROCESS_ORDER API using OA Adapter. Its a simple BPEL process that takes data from the console and calls Order API. I am tryng to test it from em console but unable to expand TableType variables to populate data
-
PB won't automatically sleep ...
unless I do it manually. Power adapter settings are set to put the computer to sleep automatically in 15 min. and the display in 5 min. The display always sleeps correctly, but not the computer. I checked to see if anything (to my limited knowledge)