Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem regarding loop in buttons  RSS feed

 
abhinav sood
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



why this program gives only two buttons in frame f

[Edit - added code tags - see UseCodeTags for details]
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One button is displayed at position (30, 100) and the rest at (65, 100).
 
Rod Singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Replacing the line:

f.setLayout(null);

with some layout; let's set it to FlowLayout

f.setLayout(new FlowLayout());
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you guys made it too easy. I was going to tell him that it is actually adding all 9 buttons.

If you move the S.o.p from line 21 down to after the setBounds call, you can see that each button after the first gets put in the same spot.
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All 10 buttons you mean fred
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!