I am new to swings. I am using buttons in my panels. I want to resize the button according to my requirement. I used setPreferredSize() but this method only alters buttons width and not height.Can u help me overcome this hurdle.The question may be simple but still i need a precise solution pls
What do you mean "resize the button according to my requirement".
Normally the button is as large as it needs to be to display what it needs to display.
Try, however, changing not only setPreferredSize, but setMinimumSize as well, then, of course, validate and repaint the Panel containing the button.
What layouts are you using for the container that holds your button? A small bit of formatted code with code tags would go a long way towards clarifying your question. Thanks.