+ // ------------------------------------------------------------------------
+ // SwingComponent ---------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the BufferStrategy object needed for triple-buffering.
+ *
+ * @return the BufferStrategy
+ * @throws IllegalArgumentException if this function is called when
+ * not rendering to a JFrame
+ */
+ public BufferStrategy getBufferStrategy() {
+ if (frame != null) {
+ return frame.getBufferStrategy();
+ } else {
+ throw new IllegalArgumentException("BufferStrategy not used " +
+ "for JComponent access");
+ }
+ }
+
+ /**
+ * Get the JFrame reference.
+ *
+ * @return the frame, or null if this is drawing to a JComponent
+ */
+ public JFrame getFrame() {
+ return frame;
+ }
+
+ /**
+ * Get the JComponent reference.
+ *
+ * @return the component, or null if this is drawing to a JFrame
+ */
+ public JComponent getComponent() {
+ return component;
+ }
+