473,385 Members | 1,673 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,385 software developers and data experts.

Painting components on Panel Picture ?/?

I have been searching all over the sites, but i couldn't manage to get button or any other component on a image panel. There are some codes that says while painting the picture you can show components. Basically they are overriding the paint method of the panel. But i need to make my frame background image while not having the diffuculties of overriding the paint method of panel because i have many components . Netbeans offers me to change background color , but i need to change the background image, So, is there any concrete solution to that problem . Thanks in advance.
Dec 18 '09 #1

✓ answered by pbrockway2

Override paintComponent() in the panel to draw the background. This has nothing to do with whether you have child components or how many you have. Basically you have to paint the background somewhere, and paintComponent() is the place.

See A closer look at the painting mechanism in Sun's Tutorial. (The Tutorial, by the way, is a better source of factually accurate material than "some codes" on teh internet, or random responses - including this one - from forums.)

As far as the child components are concerned, just add them. They get painted along with the background as explained in the link above.

[Edit] I have no clue about how this is done in NB. It's (yet another) case of the GUI builder facilitating the use, but obscuring the understanding of the technology. Perhaps you could put the IDE aside for a bit.

1 2136
pbrockway2
151 Expert 100+
Override paintComponent() in the panel to draw the background. This has nothing to do with whether you have child components or how many you have. Basically you have to paint the background somewhere, and paintComponent() is the place.

See A closer look at the painting mechanism in Sun's Tutorial. (The Tutorial, by the way, is a better source of factually accurate material than "some codes" on teh internet, or random responses - including this one - from forums.)

As far as the child components are concerned, just add them. They get painted along with the background as explained in the link above.

[Edit] I have no clue about how this is done in NB. It's (yet another) case of the GUI builder facilitating the use, but obscuring the understanding of the technology. Perhaps you could put the IDE aside for a bit.
Dec 18 '09 #2

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

Similar topics

6
by: Wayne Wengert | last post by:
I have installed VS.NET 2002 on a Win XP Pro system. When I create a new Windows Forms project I cannot add the Crystal Reports components. The Help says to Right Click the project and then select...
0
by: crwng | last post by:
I'm trying to make a picture scroll within a panel on a Windows CE device. However, when I add a panel and try to set its autoscroll property to "true", the property seems to be missing. All the...
3
by: Raymond Dynowski | last post by:
How do you force a panel to scroll in code. I have a large picture box inside my panel. I would like the panel to default to the centre of the screen, rather than the scrollbars showing the top...
0
by: objectref | last post by:
hi to all, i have a picture box in a scrollable panel control. I can drag and drop the picture box inside the panel to the correct position by taking the MousePosition point and evauatint the...
1
by: Larry | last post by:
Dear friends, I am a novice vb.net user and I am seeking some experts advice. I placed a panel control onto a form, set the autoscroll property (of the panel control) to true. Let's say The...
4
by: Thiru .Net | last post by:
hi wagner, i have a doubt in panel control in windows application. i have a panel control wherein i have put a picturebox control. i show picture into picturbox control. now i need to zoom in...
2
by: Peteroid | last post by:
When the application I'm working on is run it creates a panel with a Paint event customized to draw primitives (circles, rectangles, etc.), places the panel on a form, and then launches the form....
12
by: Peter | last post by:
Using .NET 1.1 Window Forms I would like to place over 400 pictures on a panel control one after another one so user can scroll through them, but each picture is up to 200 pixels in height...
1
by: radhikabista | last post by:
my windows application form is divided into 3 split containers or split panels now what is my problem is i need to print the contents of the middle one container even if it is not seen full. but i...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.