473,396 Members | 2,055 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.

Repaint Manager

Hello there,

I am developing a game in java and for the options menu at the start i install a NullRepaintManager to override paint requests.
I was wondering however how to later go back to not using this RepaintManger i.e disable this NullRepaintManger and return to how repaint requests are normally handled?

Any help or advice would be greatly appreciated,

Cheers,

Ragaman

P.S The code for NullRepaintManager:

public class NullRepaintManager extends RepaintManager {


public static void install() {
RepaintManager repaintManager = new NullRepaintManager();
repaintManager.setDoubleBufferingEnabled(false);
RepaintManager.setCurrentManager(repaintManager);
}


public void addInvalidComponent(JComponent c) {
// do nothing
}

public void addDirtyRegion(JComponent c, int x, int y,
int w, int h)
{
// do nothing
}

public void markCompletelyDirty(JComponent c) {
// do nothing
}

public void paintDirtyRegions() {
// do nothing
}

}


I was wondering however how to later go back to not using this RepaintManger i.e disable this NullRepaintManger and return to how repaint requests are normally handled?

Any help or advice would be greatly appreciated,

Cheers,

Ragaman
Mar 28 '07 #1
3 2196
r035198x
13,262 8TB
Hello there,

I am developing a game in java and for the options menu at the start i install a NullRepaintManager to override paint requests.
I was wondering however how to later go back to not using this RepaintManger i.e disable this NullRepaintManger and return to how repaint requests are normally handled?

Any help or advice would be greatly appreciated,

Cheers,

Ragaman

P.S The code for NullRepaintManager:

public class NullRepaintManager extends RepaintManager {


public static void install() {
RepaintManager repaintManager = new NullRepaintManager();
repaintManager.setDoubleBufferingEnabled(false);
RepaintManager.setCurrentManager(repaintManager);
}


public void addInvalidComponent(JComponent c) {
// do nothing
}

public void addDirtyRegion(JComponent c, int x, int y,
int w, int h)
{
// do nothing
}

public void markCompletelyDirty(JComponent c) {
// do nothing
}

public void paintDirtyRegions() {
// do nothing
}

}


I was wondering however how to later go back to not using this RepaintManger i.e disable this NullRepaintManger and return to how repaint requests are normally handled?

Any help or advice would be greatly appreciated,

Cheers,

Ragaman
1.)Next time please remember the code tags when posting code.
2.)Why dont you create a new RepaintManager and set it using
Expand|Select|Wrap|Line Numbers
  1. RepaintManager.setCurrentManager(repaintManager);
Mar 29 '07 #2
Thank you for the advice, how do i go about setting the original repaint manager?
Mar 30 '07 #3
r035198x
13,262 8TB
Thank you for the advice, how do i go about setting the original repaint manager?
How about

Expand|Select|Wrap|Line Numbers
  1.  RepaintManager rM = new RepaintManager(); 
then
Expand|Select|Wrap|Line Numbers
  1.  RepaintManager.setCurrentManager(rM);
Mar 30 '07 #4

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: 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...
4
by: Bob | last post by:
Trying to repaint a form named fcon using a new filter: 'Repaint the form with the new data Forms!fcon.FilterOn = False Forms!fcon.Filter = "RecNo = " & currecno & " AND Currentvalue = -1"...
7
by: Tamir Khason | last post by:
Is there something RePaint event? I have a couple of controls where I draw using control.CreateGraphics, BUT when I lost focus or do something inside the contorl (click ,etc) all graphics are...
4
by: MLH | last post by:
Setting form's Picture property to another file from within VBA doesn't repaint the form with new bitmap - for instance... Me.Picture = "c:\pics\MyNewPic.jpg" I tried Me.Repaint afterward,...
2
by: aaron.kempf | last post by:
hey guys i have an ETL winform in VB 2005 and it's like-- off in la-la land. i know it's doing things-- it's happily crunching away. but i'm confused about what i need to do to make the main...
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...
0
by: philaphan80 | last post by:
Is there a way to force the Visual Studio IDE (Page Control at design- time) to refresh / repaint itself upon drag & drop of *any* item from the toolbox? Perhaps a method I need to override within...
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...
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
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...
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.