/** Factory method to get the canvas singleton object. */
 public static Canvas getCanvas() {
   if (canvasSingleton == null) {
     canvasSingleton = new Canvas("BlueJ Picture Demo", 500, 300, Color.white);
   }
   canvasSingleton.setVisible(true);
   return canvasSingleton;
 }
示例#2
0
 /** Factory method to get the canvas singleton object. */
 public static Canvas getCanvas() {
   if (canvasSingleton == null) {
     canvasSingleton = new Canvas("BlueJ Shapes Demo", 1400, 600, Color.gray);
   }
   canvasSingleton.setVisible(true);
   return canvasSingleton;
 }
示例#3
0
 /** Factory method to get the canvas singleton object. */
 public static Canvas getCanvas() {
   if (canvasSingleton == null) {
     canvasSingleton = new Canvas(Constants.TITLE, Constants.SIZE, Constants.SIZE, Color.white);
   }
   canvasSingleton.setVisible(true);
   return canvasSingleton;
 }
示例#4
0
  /**
   * Called to change the visibility of the outline.
   *
   * @param value true if visible.
   */
  public void setVisible(final boolean value) {
    if (value != isVisible()) {
      super.setVisible(value);

      Container parent = getParent();

      if ((parent != null) && (parent.getComponentCount() == 1)) {
        parent.setVisible(value);
      }

      invalidate();

      try {
        for (; parent != null; parent = parent.getParent()) {
          try {
            parent.getClass().getMethod("resetToPreferredSizes", null).invoke(parent, null);
            visibleArgs[0] = new Integer(value ? 10 : 0);
            parent.getClass().getMethod("setDividerSize", visibleParms).invoke(parent, visibleArgs);

            break;
          } catch (final Throwable ignored) {
          }
        }
      } catch (final Throwable ignored) {
      }

      djvuBean.recursiveRevalidate();
    }
  }
示例#5
0
  public static void main(String[] args) {
    Canvas canvas = new Canvas();

    canvas.setTitle("canvas sample");
    canvas.setSize(600, 200);
    canvas.setLocationRelativeTo(null);
    canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    CanvasData dd = new CanvasData(300);

    NewPanel p = new NewPanel(dd);
    canvas.add(p);

    canvas.setVisible(true);
  }
 private void initCanvas() {
   canvas = new Canvas();
   canvas.setVisible(true);
   canvas = buffer.enableGLCanvasRenderer();
   this.add(canvas);
 }
 public void togglePause() {
   toggleCursor();
   paused = !paused;
   canvas.setVisible(!canvas.isVisible());
 }
示例#8
0
 public synchronized void setVisible(boolean b) {
   if (b == isVisible()) return;
   super.setVisible(b);
   if (!b) clearlines();
 }