File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes adding a button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "adding a button" Watch "adding a button" New topic
Author

adding a button

budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
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




Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding a button