Alright I have programmed in Java many times and made games before but I always made applets so this is my first time using JPanel/JFrame. I have gotten everything underway and have been stuck on getting this different style of drawing working for me. Usually I just create an image and use paint() drawImage to display the the buffered image. I decided to try using the BufferStrategy method but I am having the hardest time getting it to work. I know my code is gonna be pretty botched up now since I went through all kinds of different tutorials and what not trying to figure it out. Anyway I'm sure someone can help and trust me I have been working on this all day (roughly 6-8hrs). Posting on the forums is always the last thing I do but sometimes I just need someones help to make it click.
package bttg; import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.*; import java.awt.image.BufferStrategy; public class BTTG extends JPanel { BufferStrategy bufferStrat; Boolean running = true; private short screenSize = 800; public void render() { Graphics2D buffer = (Graphics2D) bufferStrat.getDrawGraphics(); buffer.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); buffer.setColor(Color.darkGray); buffer.fillRect(0,0,screenSize,screenSize); Font monospaced = new Font("MONOSPACED", Font.BOLD, 15); buffer.setFont(monospaced); buffer.setColor(Color.BLACK); buffer.fillRect(0,0,screenSize,19); buffer.setColor(Color.WHITE); buffer.drawString("BTTG",5,13); buffer.dispose(); bufferStrat.show(); } public BTTG() { JFrame container = new JFrame("BTTG"); JPanel panel = (JPanel) container.getContentPane(); panel.setPreferredSize(new Dimension(screenSize,screenSize)); panel.setLayout(null); setBounds(0,0,screenSize,screenSize); panel.add(this); container.pack(); container.setResizable(false); container.setVisible(true); setIgnoreRepaint(true); container.createBufferStrategy(2); bufferStrat = container.getBufferStrategy(); while(running) { render(); try { Thread.sleep(10); } catch (Exception e) {} } } public static void main(String[] args) { new BTTG(); } }