In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to achieve double cache Java, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Import java.awt.*;import java.applet.*;public class HelloWorld extends Applet {imgBuf=createImage (getSize (). Width,getSize (). Height); gBuf=imgBuf.getGraphics (); gBuf.setColor (Color.black); gBuf.fillRect (0Color.white). Width,getSize (). Height); gBuf.setColor (Color.white); gBuf.drawLine (0Color.white); gBuf.drawLine (). Width-1,10); gBuf.drawLine (0min30) GBuf.drawLine (0mai 50) getSize (). Width-1,50); gBuf.drawLine (0Mei 70 getSize (). Width-1,70); gBuf.drawLine (0Mei 90 getSize (). Width-1,90); gBuf.drawLine (0mai 110 getSize (). Width-1110); gBuf.drawLine (0Metro 130 getSize (). Width-1130); gBuf.setColor (Color.red); gBuf.drawRect (0pr 0pr getSize (). Width-1,getSize (). Height-1);} public void start () {if (lithread==null) {lithread=new Thread (); lithread.start () }} public void stop () {lithread=null;} public void paint (Graphics g) {g.drawImage (imgBuf,0,0,this); gBuf.setColor (Color.black); gBuf.fillRect (0meme) getSize (). Width,getSize () .height); gBuf.setColor (Color.white); gBuf.drawLine (0meme 10pint getSize (). Width-1,10); gBuf.drawLine (0meme30pint getSize (). Width-1,30); gBuf.drawLine (0mai 50pint getSize (). Width-1,50); gBuf.drawLine (0Min 70pint getSize (). Width-1,70) GBuf.drawLine (0min90 gBuf.drawLine getSize (). Width-1,90); gBuf.drawLine (0meme 110 getSize (). Width-1110); gBuf.drawLine (0mai 130 minegetSize (). Width-1130); gBuf.setColor (Color.green); gBuf.drawRect (50comm 50lim 200lim 100lim); try {lithread.sleep (1000);} catch (InterruptedException e) {} ihammer; repaint ();} public void update (Graphics g) {paint (g);}}
Dual cache technology:
The root cause of image flicker is that when one image needs to spend the next one, the screen is cleared with the background color first, and then the next one is drawn, so people can see the background color flicker.
When an image is displayed, the next image to be displayed has been written in memory, so when the next image is needed, the display area can be unique from the memory directly through the function, because the reading speed from the memory is very fast. So you can't see the flicker.
These are all the contents of the article "how to achieve double caching in Java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.