473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Increasing and decreasing the size of swing component on button click

hi.........
i have problem in incresing and decreasing the component.

I have a one main panel (i.e. i used as _basewindowPanel) in that again two panel in that two panel like wise....
now when i m increasing the size of component only button and label size get increase.But Jcombobox,JTextfield and table size unchanged.Plz any one help me,here is my code for increasing the size........


public void incPanel(int size)
{
ArrayList<Component> allComponents = new ArrayList<Component>();
Component [] abc = _basewindowPanel.getComponents();
for(int i = 0 ; i<abc.length;i++)
{
if(abc[i] instanceof JPanel)
{
JPanel pn=(JPanel)abc[i];
Component [] panelComponents=pn.getComponents();
for(int j=0;j<panelComponents.length;j++)
{
if(panelComponents[j] instanceof JPanel)
{
JPanel pnInner=(JPanel)panelComponents[j];
Component [] innerPanelComponents=pnInner.getComponents();
for(int k=0;k<innerPanelComponents.length;k++)
{
int x1 = pnInner.getComponent(k).getBounds().x;
int y1 = pnInner.getComponent(k).getBounds().y;
int w1 = pnInner.getComponent(k).getBounds().width;
int h1 = pnInner.getComponent(k).getBounds().height;
pnInner.getComponent(k).setBounds(x1,y1,w1+size,h1 +size);

}
int x= pnInner.getBounds().x;
int y=pnInner.getBounds().y;
int w=pnInner.getBounds().width;
int h=pnInner.getBounds().height;

pnInner.setBounds(x,y,w+size,h+size);

}

}

}

}

}

value of size is 1.
Jan 9 '08 #1
0 1372

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hal Vaughan | last post by:
I have a panel in a GUI that has three components: A JTextArea, a JCheckBox and a JButton. When the button is pressed, I want to check the value of the checkbox and get the text of the textarea...
6
by: Joseph | last post by:
hi 1) i plan on having an awt canvas component (to draw graphs) on a JFrame with other swing components..will this be okay? i've read that swing and awt aren't compatible.. 2)Also, if i...
2
by: Leo P. | last post by:
I haven't used Swing too much, but I've recently run into a problem that I'm not sure how to fix. When I remove all components from a JPanel and then add new components to it, the panel displays...
3
by: Bilal | last post by:
Hi, I've been looking all over the net for a way to increase the size of a drop down menu without any success. Does anyone perhaps have a way to display 11-15 items on a menu without having...
4
by: nafri | last post by:
I have array of arrays. I need to arrange them in an increased order of their element 0 Here is what i want. dim InputArray()() = {{2,0,0},{1,0,0},{6,0,0},{3,0,0}} and this is the output...
0
by: Gaara | last post by:
I need to put numbers in increasing order and then on the next line put the numbers to decreasing order. This needs to be repeated several times (for function). Any help/suggestions? I need to do...
1
by: casybay | last post by:
Hi all, I am writing a Java GUI for my c like program. The GUI allows a user to select a txt file a time from local. The content of the file will be displayed in its respective textfield. The...
1
by: chanshaw | last post by:
Ok my problem is that when it loads the JTextArea, it does not show the full component's width and height. I've tried specifying it with setrow, setcolumn, setprefferedsize, all of that. It does...
10
by: yeshello54 | last post by:
Hey guys i am pretty new to java swing and need some help. I am developing a simple color chooser program in swing. I have a color panel that is connected to three sliders. red green and blue. but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.