3

I am developing a software for my university project. I am using java to develop my desktop application. For that I want to add a component like this: http://www.mediafire.com/view/?6y1183p8u6phwzg

I want to add a component which are like ones in the left side of below frame. It is a resizable component contains with heading and it's sub menus. We can also see these kind of components in the left side of the windows XP OS. I tried hard to develop this component and only could able to make a resizable component, but it does not reduces their empty spaces between them. I will put my code below and sample design of my application. I will be very much thankful if any one can give me a solution to make my component working as i hope or give a good solution to make this component.Thank you very much.:)

http://www.mediafire.com/view/?c9b8jwp4c558zae

    private void lbl1MousePressed(java.awt.event.MouseEvent evt) {                                  
    if (!(jpnTop.getSize().equals(lbl1.getSize()))) {
        try {
            Thread.sleep(100);
            jpnTop.setSize(lbl1.getSize());

        } catch (InterruptedException ex) {
        }

    } else {
        try {
            Thread.sleep(100);
            jpnTop.setSize(169, 162);


        } catch (InterruptedException ex) {
        }
    }
}  

  private void lbl2MousePressed(java.awt.event.MouseEvent evt) {                                  
    if (!(jpnLow.getSize().equals(lbl2.getSize()))) {
        try {
            Thread.sleep(100);
            jpnLow.setSize(lbl2.getSize());

        } catch (InterruptedException ex) {
        }

    } else {
        try {
            Thread.sleep(100);
            jpnLow.setSize(169, 162);

        } catch (InterruptedException ex) {
        }
    }
}

Ps: due to this site's restrictions i cannot upload my images i kindly ask u to see them using above medeafire links.thank u very much.

1 Answer 1

5

as you tagged your question with SwingX - use it instead of re-inventing the wheel :-) The components you are looking for are called JXTaskPane/Container.

BTW: sleeping on the EDT (as you do in the mouseListener methods in your snippet) is wrong - as in REALLY WRONG - simply don't. Same for manually setting sizes/locations components: that's the exclusive task of a suitable LayoutManager.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.