Questions tagged [bufferstrategy]

The BufferStrategy is a Java class representing the mechanism used to organize complex memory on a certain AWT Canvas or Window. Use this tag for general questions related to creating or managing a BufferStrategy.

Official Documentation:

75 questions
0
votes
1 answer

BufferStrategy drawing and updating the screen

I am trying to draw individual rectangles(non filled) side by side to make a floor and then moving the whole floor left at a constant speed. My issue here is that when they move left the screen doesn't refresh or delete the previous screen therefore…
user2853442
  • 331
  • 5
  • 15
0
votes
1 answer

Flicking Image in Java with BufferStrategy

I'm trying to render an Image with a BufferStrategy and Graphics2D. The Code works well, but the Image is flickering. Before I tested it with Graphics2D, I tried only with Graphics and the Frame was flickering crazy. Here's the Code: public Main()…
Dragonbone
  • 13
  • 4
0
votes
0 answers

Exchange BufferStrategy FrameBuffer with Custom Buffer

I wrote a Java color buffer class that contains a 2D float array, which is the buffer. Now I want to exchange the buffer from the BufferStrategy of my JFrame/Canvas with my buffer. I did this by drawing each pixel of the buffer to the screen using…
0
votes
1 answer

Java Game Image Buffering Leaves Tail

I have the following class (Snippet), and in my render() method, I am doing buffering using BufferStrategy. The issue I am having is when I move an image, it leaves a tail. What Do I need to do with my code to make it so the tail doesn't show? Here…
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
0
votes
1 answer

Better performance for Java Canvas Buffered images

I am using Java Canvas and have a draw method, which is called about 20 times a second. It iterates through an array of images and draws a scaledInstance of them depending on window size: g.drawImage(img.getScaledInstance( …
Christoph Bühler
  • 2,795
  • 2
  • 28
  • 43
0
votes
1 answer

Illegal State Exception With Creating a Buffer Stragety

Hi i was coding and this came up Exception in thread "Thread-2" java.lang.IllegalStateException: Component must have a valid peer at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source) at…
0
votes
1 answer

What is it wanting me to create a method?

I am trying to create the menu for the game I am working on but when I try and use GetBufferStrategy it Eclipse tells me to create a method. I don't want a method. I want it to get the buffer strategy. I am kinda new to java so please explain why my…
user2892875
  • 99
  • 1
  • 1
  • 9
0
votes
2 answers

java.lang.IllegalStateException when creating BufferStrategy

When I try creating a bufferstrategy with createBufferStrategy(2) for double buffering, i get this error: Exception in thread "main" java.lang.IllegalStateException: Component must have a valid peer at…
Andrew Kor
  • 154
  • 5
  • 16
0
votes
0 answers

MouseListener is "halfway working" in my Applet

So I have been researching Applets and using Canvas and BufferStrategy on the applet. I have gotten it to buffer and show correctly but I'm thinking that it is somehow interfering with the MouseListener. When I run the Applet and re-size the screen,…
tyty5949
  • 1,480
  • 5
  • 14
  • 17
0
votes
1 answer

Using Graphics2D with a BufferStrategy in a Window

I have been searching around for the answer to this problem but have come of with little information on how to solve the problem. What I am looking to do is be able to use Graphics2D to do all the graphics I need, within a window. I am not very…
user2887000
  • 3
  • 1
  • 2
0
votes
2 answers

java - BufferStrategy is not creating stategy? (nullpointerexception)

I decided to start understanding BufferStrategy for my graphics. I'm not sure if using my jframe in a static form is what's cause this, but it looks alright to me. What am I missing? Main.java package Main; import java.awt.Toolkit; public class…
Vince
  • 14,470
  • 7
  • 39
  • 84
0
votes
2 answers

what happens to the value returned by 'createBufferStrategy'?

I'm learning about BufferStrategy and I'm kind of confused with the creation of BS. my code looks like this... public class Game extends Canvas{ /*code not relevant to this topic.. */ public void…
Space Ghost
  • 765
  • 2
  • 13
  • 26
0
votes
0 answers

Setting the font in a Java Buffer Strategy

I am currently trying to create a game for a school project and I have come up with an annoying bug. When I try and set the font in a buffer strategy, it doesn't load and any drawing after the setFont doesn't get drawn... Here's my…
KeirDavis
  • 665
  • 2
  • 10
  • 32
0
votes
0 answers

Java Canvas err focus or action listener in second window

I create 2 Frames: in 1st - I make a Button which move me to 2nd Frame created by class which extends after Canvas and after the move from 1st Frame to 2nd I lose the action listener or focus 1st window here : public class Credits extends JFrame…
PDS
  • 562
  • 3
  • 13
  • 27
-1
votes
1 answer

Java: Applying BufferedImage to BufferStrategy

I am currently learning from a GameDev tutorial and what really confuses me is how a BufferedImage that you raster into an array is being updated. In my code I never specified that a certain BufferedImage is supposed to be used for the…
Petrol
  • 3
  • 3
1 2 3 4
5