Forums Register Login

solution please

+Pie Number of slices to send: Send
hello every body this is my sample code.


Please you must run this code and give the solution to me.

if you run this code, you will get one window with menu(in my code "Home"). After click the menu item (in my code "login") that rendered another one window ("second window").

now how to add some component in my "second window"?

i tried some trix. but every component align in center only as default while i am running.

so i expect from you the detailed explanation.

please give the sample code.

[EDIT: Added code tags-MG]
[ December 19, 2008: Message edited by: Maneesh Godbole ]
+Pie Number of slices to send: Send
Hello,

Through jframe.add(component) the component is beeing added to jframe's content panel with 'null' contraints.

Container container = jframe.getContentPane();
container.setLayout(someLayout);
container.add(someComponent, someConstraints);

Using Layout Managers
+Pie Number of slices to send: Send
as a side issue, you are likely to get strange painting problems with code like this

JLabel name = new JLabel("user");//swing component
Panel p = new Panel();//awt component
p.add(name);

further reading
http://java.sun.com/products/jfc/tsc/articles/mixing/
+Pie Number of slices to send: Send
Sivakumar,
In future, while posting code, please use code tags.
I have edited your original post for the same. As you can see, the code tags make the code much more readable and easier to understand.
+Pie Number of slices to send: Send
sivakumar, please Use A Meaningful Subject Line. Everybody posting a new thread wants a solution.

You can use the edit button to change it.
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 813 times.
Similar Threads
How to add a shortkey to Menu
Add component above JFrame's menubar
Things arn't showing up...
ActionListener Help
JMenuBar hidden...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:54:33.