• 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

adding a button

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i've made a very small code and now i want to add a button on top of it but i don't know how . Can somebody help ?

Maybe i am missing an important concept regarding what to add where . So please point me to the right direction




 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JFrame has a default BorderLayout, and a BorderLayout has 6 regions, to each of which only one component can be added.
http://download.oracle.com/javase/tutorial/uiswing/layout/border.html

If you want to add the button on top of the DaDrw, first give it an appropriate layout and then add the button to it.
http://download.oracle.com/javase/tutorial/uiswing/layout/index.html

If you want to add the button and the DaDrw to the frame, use the default BorderLayout with appropriate constraints, or set a layout of your choice.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic