473,788 Members | 3,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Increasing and decreasing the size of swing component on button click

7 New Member
hi.........
i have problem in incresing and decreasing the component.

I have a one main panel (i.e. i used as _basewindowPane l) 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,JText field and table size unchanged.Plz any one help me,here is my code for increasing the size........


public void incPanel(int size)
{
ArrayList<Compo nent> allComponents = new ArrayList<Compo nent>();
Component [] abc = _basewindowPane l.getComponents ();
for(int i = 0 ; i<abc.length;i+ +)
{
if(abc[i] instanceof JPanel)
{
JPanel pn=(JPanel)abc[i];
Component [] panelComponents =pn.getComponen ts();
for(int j=0;j<panelComp onents.length;j ++)
{
if(panelCompone nts[j] instanceof JPanel)
{
JPanel pnInner=(JPanel )panelComponent s[j];
Component [] innerPanelCompo nents=pnInner.g etComponents();
for(int k=0;k<innerPane lComponents.len gth;k++)
{
int x1 = pnInner.getComp onent(k).getBou nds().x;
int y1 = pnInner.getComp onent(k).getBou nds().y;
int w1 = pnInner.getComp onent(k).getBou nds().width;
int h1 = pnInner.getComp onent(k).getBou nds().height;
pnInner.getComp onent(k).setBou nds(x1,y1,w1+si ze,h1+size);

}
int x= pnInner.getBoun ds().x;
int y=pnInner.getBo unds().y;
int w=pnInner.getBo unds().width;
int h=pnInner.getBo unds().height;

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

}

}

}

}

}

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

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

Similar topics

1
5172
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 and store the info in a file. I've found that the paramString() method for components is PROTECTED, so I can't get to it from another class. I tried declaring the component inside the class, like this: private class MyPanel extends JPanel...
6
6422
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 have a function which simply loops infinately that is part of a form, what happens when a form event (eg button click) occurs? will the event handler be executed simulatanesouly with the loop? or does the event excecute first and then the loop is...
2
3528
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 the new components if they are AWT components, but not if they're Swing components. Example import java.awt.*; import javax.swing.*; public class test extends JFrame {
3
2987
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 recourse to: 1. scroll bar. 2. configuring IE 3. decreasing the size of the font. Here is the code I used for my Drop down Menu: ______________ <select style="background-color: #FFFFFF; width:300;" size="1"
4
1861
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 outputArray()() = {{1,0,0},{2,0,0},{3,0,0},{6,0,0}} Has any body got any idea how to it.
0
1295
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 this in C++.
1
1342
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 GUI is constructed as follow: Top: a browse button, click to open a filechooser Center: a radio button group of five. Each radio button follows by a textfield and a "clear" button. Once a radio button is focus, the file that is...
1
3292
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 display if I start to highlight the text but not on the initial load. import java.awt.Color; import java.awt.GridBagLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import...
10
4650
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 for some reason i cant get it to work..i will post my code and if anyone has any insight to why my changelistener wont work correctly I would really appreciate it. Thanks. import java.awt.*; import java.awt.event.*; import javax.swing.*; import...
0
9655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.