setting component Z Order

I am trying to set ZorderComponent of a button..

I am doing something like this -- panel.setComponentZOrder(button, 0);

After adding this line .. no matter what components I add to panel they do not show up :(

and if I remove this line they do show  :(
Who is Participating?

Improve company productivity with a Business Account.Sign Up

hipalConnect With a Mentor Author Commented:
I got the problem .. I was doing a blunder .. I thought that we can assign any Zorder as it is relative .

I mean I just have 2 components and I was trying to assign Zorder 10 to one of them :P

thanks though !
could be because the button is painting over all your other components.
can't tell exactly what the problem is without seeing your code
hipalAuthor Commented:
no it is not so .. i can see button is just in left corner
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

is it a standard JButton, or a subclass?
And what is its size?

just because you see it top left doesn't mean its not painting to more of the panel
give another component in the panel a lower z order than it
hipalAuthor Commented:
I got the mistake I was doing  !
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.