• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I dont understand, why it wont work?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have got this code, but it wont work for me .

it is suppose to spawn random ovals and rectangels in random places in an windows white random colors. please help me!

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does 'it doesn't work' mean? Please TellTheDetails (<= link).
 
Andreas Slirig
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i start the program that is suppose to show a JPanel with spawning random items on it, i add it to a JFrame but all i get is a gray screen and nothing happens in it.

cant even push the exit button in the right corner, i have added EXIT_ON_CLOSE so it should work

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andreas Slirig wrote:When i start the program that is suppose to show a JPanel with spawning random items on it, i add it to a JFrame but all i get is a gray screen and nothing happens in it.


Well I'm no GUI expert, but I'm surprised you're not getting any message about ambiguous references, because java.util also has a Random class.

Winston
 
Andreas Slirig
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okey i take away the java.util ?

but still i'm left whit a grey window and nothings shows in it
 
Andreas Slirig
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks any way did a different version and now it works great !
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andreas Slirig wrote:Thanks any way did a different version and now it works great !


Congratulations! For the sake of other beginners, why don't you post the code that worked?

Winston
 
Andreas Slirig
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sure here it is

 
Ranch Hand
Posts: 177
Hibernate Python Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Would be better as you should only call swing methods from the event dispatch thread.
You might get weird behaviour if you don't do this.
reply
    Bookmark Topic Watch Topic
  • New Topic