473,396 Members | 2,017 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,396 software developers and data experts.

How to repaint a child window?

Hi.
Please help me and sorry for my dumb question.

I use NetBeans 6.1 in development.
I have JFrame Client. In that JFrame when I click on button StartGame there appears another JFrame ChessGame. It has some Swing controls and some painting.Painting is done directly on JFrame. I am not sure,but probably this is called child window.

Now I want this child window to be repainted well. I set event listeners on all possible relevant events that Swing gives me -WindowOpened,WindowDeiconified,WindowActivated,Win dowDeactivated in all of which I included call to update(this.getGraphics()). It seems like it hasn't helped one bit.Before I added this code ChessGame window was sometimes repainted and sometimes not when deiconifing.The same is true after I added the code.
Nov 21 '08 #1
1 2020
JosAH
11,448 Expert 8TB
There should be no reason to explicitly repaint any component when the JFrame is deiconified or made visible; the AWT event thread takes care of that. What you do have to make sure is that you add your components to the content pane of the JFrame (read the API documentation of the JFrame class). It is an additional layer not present in the AWT Frame class.

Normally I add a single JPanel to that content pane and use that for all my painting operations.

kind regards,

Jos
Nov 23 '08 #2

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

Similar topics

11
by: Ike | last post by:
I changing the size of frames dynamically in a page (I am restricted in that I cannot perform a reload of the content of any of the frames). In MSIE, when I resize the frames, thinks repaint...
2
by: Bostonasian | last post by:
I am trying to append options to dropdown in parent window from option items in child window. In parent window, I have following code: <script language="javascript"> function...
2
by: Joe A | last post by:
I'm using Access 2002 on Windows XP PC, 500 megs ram, Front end/back end app. I have a simple form that draws a thermometer to indicate progress of code that is running. The thermometer form...
6
by: Nick | last post by:
I'm creating an MDI application with multiple maximized MDI child forms. When a child form is open, the title/caption is merge with the MDI's title/caption. So, if the MDI title is "Parent" and...
7
by: Paul | last post by:
I have a VB.NET form with a DataGrid. When I toggle to Excel (for example) and then back to my application the repaint of the DataGrid is really slow. You can see the repainting happening. When...
4
by: drexlin | last post by:
Hi, I hope this is the correct place to post questions about visual c++ 6.0. If not, sorry. Anyway, the program I am working on takes messages from another computer and prints them on the screen....
3
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Here is scenario Parent Form -Call Child Modal Form -Shows Mesage Box then executes Sql Statement to delete rows in table. When I execute the sql statement the Message box doesn't completely...
0
by: milkay | last post by:
<I have code that uses 2 images> the program creates a window and then when u press play, it removes all components in the container. then, i add a NewPanel object. i add mouse listeners and all...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
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...
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
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
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...
0
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,...

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.