private static boolean fitsLayeredPane(
      JLayeredPane pane, JComponent component, RelativePoint desiredLocation, HintHint hintHint) {
    if (hintHint.isAwtTooltip()) {
      Dimension size = component.getPreferredSize();
      Dimension paneSize = pane.getSize();

      Point target = desiredLocation.getPointOn(pane).getPoint();
      Balloon.Position pos = hintHint.getPreferredPosition();
      int pointer = BalloonImpl.getPointerLength(pos, false) + BalloonImpl.getNormalInset();
      if (pos == Balloon.Position.above || pos == Balloon.Position.below) {
        boolean heightFit =
            target.y - size.height - pointer > 0
                || target.y + size.height + pointer < paneSize.height;
        return heightFit && size.width + pointer < paneSize.width;
      } else {
        boolean widthFit =
            target.x - size.width - pointer > 0 || target.x + size.width + pointer < paneSize.width;
        return widthFit && size.height + pointer < paneSize.height;
      }
    } else {
      final Rectangle lpRect =
          new Rectangle(
              pane.getLocationOnScreen().x,
              pane.getLocationOnScreen().y,
              pane.getWidth(),
              pane.getHeight());
      Rectangle componentRect =
          new Rectangle(
              desiredLocation.getScreenPoint().x,
              desiredLocation.getScreenPoint().y,
              component.getPreferredSize().width,
              component.getPreferredSize().height);
      return lpRect.contains(componentRect);
    }
  }
  public FenetrePrincipale(PlanSalle modele) {
    super();
    this.modele = modele;
    this.setTitle(modele.getNom() + " - OSE");
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.creerBarreMenus();
    this.creerMenuContextuel();
    JLayeredPane lp = new JLayeredPane();
    lp.setPreferredSize(
        new Dimension(
            Parametres.NB_TRAVEES * Parametres.LARGEUR_TRAVEE,
            Parametres.NB_RANGEES * Parametres.HAUTEUR_RANGEE));
    lePlan = new Plan(modele);
    lePlan.setBounds(
        0,
        0,
        Parametres.NB_TRAVEES * Parametres.LARGEUR_TRAVEE,
        Parametres.NB_RANGEES * Parametres.HAUTEUR_RANGEE);
    lp.add(lePlan, new Integer(0));
    Container conteneur = this.getContentPane();
    conteneur.setLayout(new FlowLayout());

    conteneur.add(lp);
    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
  }
 void eliminarDelContenedor() {
   for (int r = 0; r < layer.getComponentCount(); r++) {
     if (((Component) layer.getComponent(r)).hashCode() == this.glass.hashCode()) {
       layer.remove(r);
     }
   }
 }
Beispiel #4
0
  /**
   * Specifies the menu bar value.
   *
   * @deprecated As of Swing version 1.0.3 replaced by <code>setJMenuBar(JMenuBar menu)</code>.
   * @param menu the <code>JMenuBar</code> to add.
   */
  @Deprecated
  public void setMenuBar(JMenuBar menu) {
    if (menuBar != null && menuBar.getParent() == layeredPane) layeredPane.remove(menuBar);
    menuBar = menu;

    if (menuBar != null) layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  }
Beispiel #5
0
  /**
   * Sets the content pane -- the container that holds the components parented by the root pane.
   *
   * <p>Swing's painting architecture requires an opaque <code>JComponent</code> in the containment
   * hierarchy. This is typically provided by the content pane. If you replace the content pane it
   * is recommended you replace it with an opaque <code>JComponent</code>.
   *
   * @param content the <code>Container</code> to use for component-contents
   * @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane
   *     parameter is <code>null</code>
   */
  public void setContentPane(Container content) {
    if (content == null)
      throw new IllegalComponentStateException("contentPane cannot be set to null.");
    if (contentPane != null && contentPane.getParent() == layeredPane)
      layeredPane.remove(contentPane);
    contentPane = content;

    layeredPane.add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
  }
 protected final void showProgress(String message) {
   myProgressMessage.setText(message);
   if (myProgressPanel.getParent() == null) {
     myGlassLayer.setEnabled(false);
     myProgressIcon.resume();
     myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
     myLayeredPane.repaint();
   }
 }
  /** @return Point in layered pane coordinate system */
  static Pair<Point, Short> chooseBestHintPosition(
      Project project,
      Editor editor,
      int line,
      int col,
      LightweightHint hint,
      boolean awtTooltip,
      short preferredPosition) {
    HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
    Dimension hintSize = hint.getComponent().getPreferredSize();
    JComponent editorComponent = editor.getComponent();
    JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();

    Point p1;
    Point p2;
    boolean isLookupShown = LookupManager.getInstance(project).getActiveLookup() != null;
    if (isLookupShown) {
      p1 = hintManager.getHintPosition(hint, editor, HintManager.UNDER);
      p2 = hintManager.getHintPosition(hint, editor, HintManager.ABOVE);
    } else {
      LogicalPosition pos = new LogicalPosition(line, col);
      p1 = HintManagerImpl.getHintPosition(hint, editor, pos, HintManager.UNDER);
      p2 = HintManagerImpl.getHintPosition(hint, editor, pos, HintManager.ABOVE);
    }

    if (!awtTooltip) {
      p1.x = Math.min(p1.x, layeredPane.getWidth() - hintSize.width);
      p1.x = Math.max(p1.x, 0);
      p2.x = Math.min(p2.x, layeredPane.getWidth() - hintSize.width);
      p2.x = Math.max(p2.x, 0);
    }

    boolean p1Ok = p1.y + hintSize.height < layeredPane.getHeight();
    boolean p2Ok = p2.y >= 0;

    if (isLookupShown) {
      if (p1Ok) return new Pair<Point, Short>(p1, HintManager.UNDER);
      if (p2Ok) return new Pair<Point, Short>(p2, HintManager.ABOVE);
    } else {
      if (preferredPosition != HintManager.DEFAULT) {
        if (preferredPosition == HintManager.ABOVE) {
          if (p2Ok) return new Pair<Point, Short>(p2, HintManager.ABOVE);
        } else if (preferredPosition == HintManager.UNDER) {
          if (p1Ok) return new Pair<Point, Short>(p1, HintManager.UNDER);
        }
      }

      if (p1Ok) return new Pair<Point, Short>(p1, HintManager.UNDER);
      if (p2Ok) return new Pair<Point, Short>(p2, HintManager.ABOVE);
    }

    int underSpace = layeredPane.getHeight() - p1.y;
    int aboveSpace = p2.y;
    return aboveSpace > underSpace
        ? new Pair<Point, Short>(new Point(p2.x, 0), HintManager.UNDER)
        : new Pair<Point, Short>(p1, HintManager.ABOVE);
  }
  ParameterInfoComponent(
      Object[] objects,
      Editor editor,
      @NotNull ParameterInfoHandler handler,
      boolean requestFocus) {
    super(new BorderLayout());
    myRequestFocus = requestFocus;

    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      JComponent editorComponent = editor.getComponent();
      JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();
      myWidthLimit = layeredPane.getWidth();
    }

    NORMAL_FONT = UIUtil.getLabelFont();
    BOLD_FONT = NORMAL_FONT.deriveFont(Font.BOLD);

    myObjects = objects;

    setBackground(BACKGROUND_COLOR);

    myHandler = handler;
    myPanels = new OneElementComponent[myObjects.length];
    final JPanel panel = new JPanel(new GridBagLayout());
    for (int i = 0; i < myObjects.length; i++) {
      myPanels[i] = new OneElementComponent();
      panel.add(
          myPanels[i],
          new GridBagConstraints(
              0,
              i,
              1,
              1,
              1,
              0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(0, 0, 0, 0),
              0,
              0));
    }
    if (myRequestFocus) {
      AccessibleContextUtil.setName(
          this, "Parameter Info. Press TAB to navigate through each element. Press ESC to close.");
    }

    final JScrollPane pane = ScrollPaneFactory.createScrollPane(panel);
    pane.setBorder(null);
    pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add(pane, BorderLayout.CENTER);

    myCurrentParameterIndex = -1;
  }
 private static boolean hasMnemonicInBalloons(Container container, int code) {
   final Component parent = UIUtil.findUltimateParent(container);
   if (parent instanceof RootPaneContainer) {
     final JLayeredPane pane = ((RootPaneContainer) parent).getLayeredPane();
     for (Component component : pane.getComponents()) {
       if (component instanceof ComponentWithMnemonics
           && component instanceof Container
           && hasMnemonic((Container) component, code)) {
         return true;
       }
     }
   }
   return false;
 }
  /**
   * Sets the window title pane -- the JComponent used to provide a plaf a way to override the
   * native operating system's window title pane with one whose look and feel are controlled by the
   * plaf. The plaf creates and sets this value; the default is null, implying a native operating
   * system window title pane.
   *
   * @param content the <code>JComponent</code> to use for the window title pane.
   */
  private void setTitlePane(JRootPane root, JComponent titlePane) {
    JLayeredPane layeredPane = root.getLayeredPane();
    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null) {
      oldTitlePane.setVisible(false);
      layeredPane.remove(oldTitlePane);
    }
    if (titlePane != null) {
      layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
      titlePane.setVisible(true);
    }
    this.titlePane = titlePane;
  }
 private void finishDragging() {
   if (!isDraggingNow()) return;
   myDragPane.remove(myDragButtonImage);
   myDragButtonImage = null;
   myPane.stopDrag();
   myDragPane.repaint();
   setVisible(true);
   if (myLastStripe != null) {
     myLastStripe.finishDrop();
     myLastStripe = null;
   }
   if (myDragKeyEventDispatcher != null) {
     KeyboardFocusManager.getCurrentKeyboardFocusManager()
         .removeKeyEventDispatcher(myDragKeyEventDispatcher);
     myDragKeyEventDispatcher = null;
   }
 }
 protected final void showDesignerCard() {
   myErrorMessages.removeAll();
   myErrorStack.setText(null);
   myLayeredPane.revalidate();
   myHorizontalCaption.update();
   myVerticalCaption.update();
   myLayout.show(this, DESIGNER_CARD);
 }
Beispiel #13
0
  /**
   * Sets the layered pane for the root pane. The layered pane typically holds a content pane and an
   * optional <code>JMenuBar</code>.
   *
   * @param layered the <code>JLayeredPane</code> to use
   * @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane
   *     parameter is <code>null</code>
   */
  public void setLayeredPane(JLayeredPane layered) {
    if (layered == null)
      throw new IllegalComponentStateException("layeredPane cannot be set to null.");
    if (layeredPane != null && layeredPane.getParent() == this) this.remove(layeredPane);
    layeredPane = layered;

    this.add(layeredPane, -1);
  }
  public void hide(boolean ok) {
    if (isVisible()) {
      if (myIsRealPopup) {
        if (ok) {
          myPopup.closeOk(null);
        } else {
          myPopup.cancel();
        }
        myPopup = null;
      } else {
        if (myCurrentIdeTooltip != null) {
          IdeTooltip tooltip = myCurrentIdeTooltip;
          myCurrentIdeTooltip = null;
          tooltip.hide();
        } else {
          final JRootPane rootPane = myComponent.getRootPane();
          if (rootPane != null) {
            final Rectangle bounds = myComponent.getBounds();
            final JLayeredPane layeredPane = rootPane.getLayeredPane();

            try {
              if (myFocusBackComponent != null) {
                LayoutFocusTraversalPolicyExt.setOverridenDefaultComponent(myFocusBackComponent);
              }
              layeredPane.remove(myComponent);
            } finally {
              LayoutFocusTraversalPolicyExt.setOverridenDefaultComponent(null);
            }

            layeredPane.paintImmediately(bounds.x, bounds.y, bounds.width, bounds.height);
          }
        }
      }
    }
    if (myEscListener != null) {
      myComponent.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    }

    TooltipController.getInstance().hide(this);

    fireHintHidden();
  }
Beispiel #15
0
  private void construct() {
    setTitle("JPokemon (ver 0.1)");
    setIconImage(Tools.findImage("main-icon"));
    setSize(720, 457); // WIDTH, HEIGHT
    setUndecorated(true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    // Using JLayeredPane so my buttons can sit on the picture
    p = new JLayeredPane();
    ImageIcon bg;
    // Add Splash
    if (pref.getBoolean("beat", false)) bg = new ImageIcon(Tools.findImage("splashalt"));
    else bg = new ImageIcon(Tools.findImage("splash"));
    s.setIcon(bg);
    s.setBounds(10, 10, 700, 437);
    p.add(s, new Integer(-1));

    // Load Button
    LoadButton l = new LoadButton(this);
    l.setBounds(550, 100, 110, 30); // 10px border on all sides
    p.add(l, new Integer(0));

    // New Game Button
    NewButton n = new NewButton(this);
    n.setBounds(550, 60, 110, 30);
    p.add(n, new Integer(0));

    // Exit Game Button
    QuitButton q = new QuitButton(this);
    q.setBounds(550, 140, 110, 30);
    p.add(q, new Integer(0));

    // OPTIONAL: Reset Splash logon
    if (pref.getBoolean("beat", false)) {
      r = new ResetButton();
      r.setBounds(550, 180, 110, 30);
      p.add(r, new Integer(0));
    }
    add(p);

    setLocationRelativeTo(null);
  }
 public void setVisible(boolean visible) {
   if (!visible && myView != null) {
     disposeAndUpdate(false);
   } else if (visible && myView == null) {
     Window owner = UIUtil.getWindow(myOwner);
     if (owner != null) {
       if (myHeavyWeight) {
         Window view = pop(owner);
         if (view == null) {
           view = new JWindow(owner);
           setPopupType(view);
         }
         setAlwaysOnTop(view, myAlwaysOnTop);
         setWindowFocusable(view, myWindowFocusable);
         setWindowShadow(view, myWindowShadow);
         myView = view;
       } else if (owner instanceof RootPaneContainer) {
         JLayeredPane parent = ((RootPaneContainer) owner).getLayeredPane();
         if (parent != null) {
           JPanel view = new JPanel(new BorderLayout());
           view.setVisible(false);
           parent.add(view, JLayeredPane.POPUP_LAYER, 0);
           myView = view;
         }
       }
     }
     if (myView != null) {
       myView.add(myContent);
       Component parent = myView instanceof Window ? null : myView.getParent();
       if (parent != null) {
         Point location = myViewBounds.getLocation();
         SwingUtilities.convertPointFromScreen(location, parent);
         myViewBounds.setLocation(location);
       }
       myView.setBackground(UIUtil.getLabelBackground());
       myView.setBounds(myViewBounds);
       myView.setVisible(true);
       myViewBounds = null;
     }
   }
 }
  /**
   * Removes the frame from its parent and adds its <code>desktopIcon</code> to the parent.
   *
   * @param f the <code>JInternalFrame</code> to be iconified
   */
  public void iconifyFrame(JInternalFrame f) {
    JInternalFrame.JDesktopIcon desktopIcon;
    Container c = f.getParent();
    JDesktopPane d = f.getDesktopPane();
    boolean findNext = f.isSelected();
    desktopIcon = f.getDesktopIcon();
    if (!wasIcon(f)) {
      Rectangle r = getBoundsForIconOf(f);
      desktopIcon.setBounds(r.x, r.y, r.width, r.height);
      setWasIcon(f, Boolean.TRUE);
    }

    if (c == null || d == null) {
      return;
    }

    if (c instanceof JLayeredPane) {
      JLayeredPane lp = (JLayeredPane) c;
      int layer = lp.getLayer(f);
      lp.putLayer(desktopIcon, layer);
    }

    // If we are maximized we already have the normal bounds recorded
    // don't try to re-record them, otherwise we incorrectly set the
    // normal bounds to maximized state.
    if (!f.isMaximum()) {
      f.setNormalBounds(f.getBounds());
    }
    d.setComponentOrderCheckingEnabled(false);
    c.remove(f);
    c.add(desktopIcon);
    d.setComponentOrderCheckingEnabled(true);
    c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
    if (findNext) {
      if (d.selectFrame(true) == null) {
        // The icon is the last frame.
        f.restoreSubcomponentFocus();
      }
    }
  }
  private void processDrag(final MouseEvent e) {
    if (myDragCancelled) return;
    if (!isDraggingNow()) {
      if (myPressedPoint == null) return;
      if (isWithinDeadZone(e)) return;

      myDragPane = findLayeredPane(e);
      if (myDragPane == null) return;
      final BufferedImage image =
          new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
      paint(image.getGraphics());
      myDragButtonImage =
          new JLabel(new ImageIcon(image)) {

            public String toString() {
              return "Image for: " + StripeButton.this.toString();
            }
          };
      myDragPane.add(myDragButtonImage, JLayeredPane.POPUP_LAYER);
      myDragButtonImage.setSize(myDragButtonImage.getPreferredSize());
      setVisible(false);
      myPane.startDrag();
      myDragKeyEventDispatcher = new DragKeyEventDispatcher();
      KeyboardFocusManager.getCurrentKeyboardFocusManager()
          .addKeyEventDispatcher(myDragKeyEventDispatcher);
    }
    if (!isDraggingNow()) return;

    Point xy = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), myDragPane);
    if (myPressedPoint != null) {
      xy.x -= myPressedPoint.x;
      xy.y -= myPressedPoint.y;
    }
    myDragButtonImage.setLocation(xy);

    SwingUtilities.convertPointToScreen(xy, myDragPane);

    final Stripe stripe =
        myPane.getStripeFor(new Rectangle(xy, myDragButtonImage.getSize()), (Stripe) getParent());
    if (stripe == null) {
      if (myLastStripe != null) {
        myLastStripe.resetDrop();
      }
    } else {
      if (myLastStripe != null && myLastStripe != stripe) {
        myLastStripe.resetDrop();
      }
      stripe.processDropButton(this, myDragButtonImage, xy);
    }

    myLastStripe = stripe;
  }
  public void init(Object parent) {

    glass = new BlurGlass();
    glass.setLayout(null);

    this.setLayout(null);

    setOpaque(false);
    // getContentPane().setOpaque(false);
    this.getLayeredPane().setOpaque(false);
    this.getRootPane().setOpaque(false);
    // putClientProperty("Synthetica.opaque", Boolean.FALSE);

    JParent = parent;
    glass.setOpaque(false);

    MouseInputAdapter adapter = new MouseInputAdapter() {};
    glass.addMouseListener(adapter);
    glass.addMouseMotionListener(adapter);

    try {
      if (parent instanceof JFrame) {
        layer = ((JFrame) parent).getLayeredPane();
      } else if (parent instanceof JInternalFrame) {
        layer = ((JInternalFrame) parent).getLayeredPane();
      }
      glass.setBounds(layer.getBounds());

    } catch (NullPointerException err) {
      Dialogos.error("Error interno en Dialogo interno modal", err);
    }

    try {
      glass.add(this);
      layer.add(glass, JLayeredPane.DEFAULT_LAYER);
    } catch (NullPointerException err) {
      Dialogos.error("Error interno en dialogo modal interno", err);
    }
  }
  public ifAccountTool(ImageIcon head, String name, int usingsp, int totalsp) {
    super("AccountTool", false, false, false, false);
    setLayout(null);
    lp_layer = this.getLayeredPane();

    head = ImageProcess.scaleImage(head, 230, ImageProcess.Auto);
    head = ImageProcess.cutImage(head, 0, 0, 230, 230);

    ifAT_iclblHead = new JLabel(head);
    ifAT_iclblHead.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    ifAT_iclblHead.setBounds(20, 20, 230, 230);
    ifAT_iclblHead.setBackground(Color.BLACK);
    getContentPane().add(ifAT_iclblHead);

    lblName_ftName = new Font("微軟正黑體", Font.BOLD, 20);
    ifAT_lblName = new JLabel(name, JLabel.CENTER);
    ifAT_lblName.setFont(lblName_ftName);
    ifAT_lblName.setBounds(20, 210, 230, 130);
    getContentPane().add(ifAT_lblName);

    ifAT_pbSpace = new JProgressBar();
    ifAT_pbSpace.setMaximum(totalsp);
    ifAT_pbSpace.setMinimum(0);
    ifAT_pbSpace.setValue(usingsp);
    ifAT_pbSpace.setBorderPainted(true);
    ifAT_pbSpace.setStringPainted(true);
    ifAT_pbSpace.setBounds(20, 300, 230, 20);
    getContentPane().add(ifAT_pbSpace);

    ifAT_toolbar = new ToolBar();
    ifAT_toolbar.AddTool("aEdit", null);
    ifAT_toolbar.AddTool("Plus", null);
    ifAT_toolbar.AddTool("Logout", null);
    lp_layer.setLayout(new BorderLayout());
    lp_layer.add(ifAT_toolbar, BorderLayout.SOUTH, new Integer(2550));

    setVisible(true);
    getContentPane().setBackground(Color.WHITE);
  }
 /**
  * This method adds the panels to the window and organises them using a GridBagLayout and a
  * JLayeredPane.
  */
 private void populateFrame(Container frame) {
   frame.setLayout(new GridBagLayout());
   GridBagConstraints layoutConstraints = new GridBagConstraints();
   JLayeredPane dungeonArea = new JLayeredPane();
   dungeonArea.setPreferredSize(new Dimension(448, 448));
   dungeonArea.add(dungeonPanel, JLayeredPane.DEFAULT_LAYER);
   // the DungeonPanel is added underneath
   dungeonArea.add(dungeonPanelOverlay, JLayeredPane.PALETTE_LAYER);
   // the mostly transparent DungeonPanelOverlay is added on top in the same position
   layoutConstraints.gridx = 0;
   layoutConstraints.gridy = 0;
   layoutConstraints.gridwidth = 7;
   layoutConstraints.gridheight = 7;
   frame.add(dungeonArea, layoutConstraints);
   layoutConstraints.gridx = 7;
   layoutConstraints.gridwidth = 1;
   frame.add(serverSettings, layoutConstraints);
   layoutConstraints.gridx = 0;
   layoutConstraints.gridy = 7;
   layoutConstraints.gridwidth = 8;
   layoutConstraints.gridheight = 1;
   frame.add(chatPanel, layoutConstraints);
 }
Beispiel #22
0
  /**
   * The constructor for the class It's going to set the dimension of the program to 600x600, the
   * background is going to be white (in order to blend in with the vor image), and it is going to
   * add in the VOR radar and a radial indicator that will let the user know which radial he/she is
   * on
   */
  public finalVORGUI(int r) {
    deg = r;
    this.vor = new VorReceiver(deg, ".- -... -.-.");
    this.vor.setOBS(90); // set the OBS to 30
    JLayeredPane lp = new JLayeredPane();
    lp.setPreferredSize(new Dimension(WIDTH, HEIGHT));
    setBackground(Color.white);
    lp.setLayout(null);
    lp.setFocusable(true);
    degrees = deg; // r is intended radial
    CurrentRadial =
        new JLabel(
            "Intended Radial: "
                + deg); // A string that is always going to be above the radar. it's going to let
    // the user know the current radial
    CurrentRadial.setBounds(220, 18, 200, 200);
    MorseCode = new JLabel("Station: TO ENTER HERE");
    MorseCode.setBounds(200, 500, 200, 50);
    MorseCode.setText("Station: " + this.vor.getMorse());

    // vor.printVorStatus_v1();
    rotationPanel = new JPanel();
    rotationPanel = new TurningCanvas();
    rotationPanel.setBounds(
        157, 125, rotationPanel.getPreferredSize().width, rotationPanel.getPreferredSize().height);
    needle = new JPanel();
    needle = new DrawAttributes();
    needle.setBounds(100, 0, needle.getPreferredSize().width, needle.getPreferredSize().height);
    OBS = new JPanel();
    OBS = new AddButtons();
    OBS.setBounds(110, 350, 200, 100);
    lp.add(rotationPanel, Integer.valueOf(1));
    lp.add(needle, Integer.valueOf(2));
    lp.add(OBS, Integer.valueOf(3));
    lp.add(CurrentRadial, Integer.valueOf(4));
    lp.add(MorseCode, Integer.valueOf(5));
    add(lp);

    x = 172; // x is the location of the needle
    y1 = 155;
    y2 = 330;
  }
  public void setActivo(boolean val) {
    glass.setVisible(val);
    setVisible(val);
    JLayeredPane.getLayeredPaneAbove(glass).moveToFront(glass);

    if (val) {
      synchronized (syncMonitor) {
        try {
          if (SwingUtilities.isEventDispatchThread()) {
            EventQueue theQueue = getToolkit().getSystemEventQueue();
            while (isVisible()) {
              AWTEvent event = theQueue.getNextEvent();
              Object source = event.getSource();

              if (event instanceof ActiveEvent) {
                ((ActiveEvent) event).dispatch();
              } else if (source instanceof Component) {
                ((Component) source).dispatchEvent(event);
              } else if (source instanceof MenuComponent) {
                ((MenuComponent) source).dispatchEvent(event);
              } else {
                System.out.println("No se puede despachar: " + event);
              }
            }
          } else {
            while (isVisible()) {
              syncMonitor.wait();
            }
          }
        } catch (InterruptedException ignored) {
          System.out.println("Excepción de interrupción: " + ignored.getMessage());
        }
      }
    } else {
      synchronized (syncMonitor) {
        setVisible(false);
        glass.setVisible(false);
        syncMonitor.notifyAll();

        eliminarDelContenedor();
      }
    }
  }
  private void manageSearchPopup(@Nullable SearchPopup searchPopup) {
    final Project project;
    if (ApplicationManager.getApplication() != null
        && !ApplicationManager.getApplication().isDisposed()) {
      project =
          PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent));
    } else {
      project = null;
    }

    if (mySearchPopup != null) {
      myPopupLayeredPane.remove(mySearchPopup);
      myPopupLayeredPane.validate();
      myPopupLayeredPane.repaint();
      myPopupLayeredPane = null;

      if (project != null) {
        ((ToolWindowManagerEx) ToolWindowManager.getInstance(project))
            .removeToolWindowManagerListener(myWindowManagerListener);
      }
    } else if (searchPopup != null) {
      FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.tree.speedsearch");
    }

    if (!myComponent.isShowing()) {
      mySearchPopup = null;
    } else {
      mySearchPopup = searchPopup;
    }

    fireStateChanged();

    if (mySearchPopup == null || !myComponent.isDisplayable()) return;

    if (project != null) {
      ((ToolWindowManagerEx) ToolWindowManager.getInstance(project))
          .addToolWindowManagerListener(myWindowManagerListener);
    }
    JRootPane rootPane = myComponent.getRootPane();
    if (rootPane != null) {
      myPopupLayeredPane = rootPane.getLayeredPane();
    } else {
      myPopupLayeredPane = null;
    }
    if (myPopupLayeredPane == null) {
      LOG.error(toString() + " in " + String.valueOf(myComponent));
      return;
    }
    myPopupLayeredPane.add(mySearchPopup, JLayeredPane.POPUP_LAYER);
    if (myPopupLayeredPane == null) return; // See # 27482. Somewho it does happen...
    Point lPaneP = myPopupLayeredPane.getLocationOnScreen();
    Point componentP = getComponentLocationOnScreen();
    Rectangle r = getComponentVisibleRect();
    Dimension prefSize = mySearchPopup.getPreferredSize();
    Window window = (Window) SwingUtilities.getAncestorOfClass(Window.class, myComponent);
    Point windowP;
    if (window instanceof JDialog) {
      windowP = ((JDialog) window).getContentPane().getLocationOnScreen();
    } else if (window instanceof JFrame) {
      windowP = ((JFrame) window).getContentPane().getLocationOnScreen();
    } else {
      windowP = window.getLocationOnScreen();
    }
    int y = r.y + componentP.y - lPaneP.y - prefSize.height;
    y = Math.max(y, windowP.y - lPaneP.y);
    mySearchPopup.setLocation(componentP.x - lPaneP.x + r.x, y);
    mySearchPopup.setSize(prefSize);
    mySearchPopup.setVisible(true);
    mySearchPopup.validate();
  }
Beispiel #25
0
 /**
  * Called by the constructor methods to create the default <code>layeredPane</code>. Bt default it
  * creates a new <code>JLayeredPane</code>.
  *
  * @return the default <code>layeredPane</code>
  */
 protected JLayeredPane createLayeredPane() {
   JLayeredPane p = new JLayeredPane();
   p.setName(this.getName() + ".layeredPane");
   return p;
 }
  public DocumentationComponent(
      final DocumentationManager manager, final AnAction[] additionalActions) {
    myManager = manager;
    myIsEmpty = true;
    myIsShown = false;

    myEditorPane =
        new JEditorPane(UIUtil.HTML_MIME, "") {
          @Override
          public Dimension getPreferredScrollableViewportSize() {
            if (getWidth() == 0 || getHeight() == 0) {
              setSize(MAX_WIDTH, MAX_HEIGHT);
            }
            Insets ins = myEditorPane.getInsets();
            View rootView = myEditorPane.getUI().getRootView(myEditorPane);
            rootView.setSize(
                MAX_WIDTH,
                MAX_HEIGHT); // Necessary! Without this line, size will not increase then you go
            // from small page to bigger one
            int prefHeight = (int) rootView.getPreferredSpan(View.Y_AXIS);
            prefHeight +=
                ins.bottom
                    + ins.top
                    + myScrollPane.getHorizontalScrollBar().getMaximumSize().height;
            return new Dimension(MAX_WIDTH, Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, prefHeight)));
          }

          {
            enableEvents(AWTEvent.KEY_EVENT_MASK);
          }

          @Override
          protected void processKeyEvent(KeyEvent e) {
            KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e);
            ActionListener listener = myKeyboardActions.get(keyStroke);
            if (listener != null) {
              listener.actionPerformed(new ActionEvent(DocumentationComponent.this, 0, ""));
              e.consume();
              return;
            }
            super.processKeyEvent(e);
          }

          @Override
          protected void paintComponent(Graphics g) {
            GraphicsUtil.setupAntialiasing(g);
            super.paintComponent(g);
          }
        };
    DataProvider helpDataProvider =
        new DataProvider() {
          @Override
          public Object getData(@NonNls String dataId) {
            return PlatformDataKeys.HELP_ID.is(dataId) ? DOCUMENTATION_TOPIC_ID : null;
          }
        };
    myEditorPane.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, helpDataProvider);
    myText = "";
    myEditorPane.setEditable(false);
    myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
    myEditorPane.setEditorKit(UIUtil.getHTMLEditorKit());
    myScrollPane =
        new JBScrollPane(myEditorPane) {
          @Override
          protected void processMouseWheelEvent(MouseWheelEvent e) {
            if (!EditorSettingsExternalizable.getInstance().isWheelFontChangeEnabled()
                || !EditorUtil.isChangeFontSize(e)) {
              super.processMouseWheelEvent(e);
              return;
            }

            int change = Math.abs(e.getWheelRotation());
            boolean increase = e.getWheelRotation() <= 0;
            EditorColorsManager colorsManager = EditorColorsManager.getInstance();
            EditorColorsScheme scheme = colorsManager.getGlobalScheme();
            FontSize newFontSize = scheme.getQuickDocFontSize();
            for (; change > 0; change--) {
              if (increase) {
                newFontSize = newFontSize.larger();
              } else {
                newFontSize = newFontSize.smaller();
              }
            }

            if (newFontSize == scheme.getQuickDocFontSize()) {
              return;
            }

            scheme.setQuickDocFontSize(newFontSize);
            applyFontSize();
            setFontSizeSliderSize(newFontSize);
          }
        };
    myScrollPane.setBorder(null);
    myScrollPane.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, helpDataProvider);

    final MouseAdapter mouseAdapter =
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            myManager.requestFocus();
            myShowSettingsButton.hideSettings();
          }
        };
    myEditorPane.addMouseListener(mouseAdapter);
    Disposer.register(
        this,
        new Disposable() {
          @Override
          public void dispose() {
            myEditorPane.removeMouseListener(mouseAdapter);
          }
        });

    final FocusAdapter focusAdapter =
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            Component previouslyFocused =
                WindowManagerEx.getInstanceEx()
                    .getFocusedComponent(manager.getProject(getElement()));

            if (!(previouslyFocused == myEditorPane)) {
              if (myHint != null && !myHint.isDisposed()) myHint.cancel();
            }
          }
        };
    myEditorPane.addFocusListener(focusAdapter);

    Disposer.register(
        this,
        new Disposable() {
          @Override
          public void dispose() {
            myEditorPane.removeFocusListener(focusAdapter);
          }
        });

    setLayout(new BorderLayout());
    JLayeredPane layeredPane =
        new JBLayeredPane() {
          @Override
          public void doLayout() {
            final Rectangle r = getBounds();
            for (Component component : getComponents()) {
              if (component instanceof JScrollPane) {
                component.setBounds(0, 0, r.width, r.height);
              } else {
                int insets = 2;
                Dimension d = component.getPreferredSize();
                component.setBounds(r.width - d.width - insets, insets, d.width, d.height);
              }
            }
          }

          @Override
          public Dimension getPreferredSize() {
            Dimension editorPaneSize = myEditorPane.getPreferredScrollableViewportSize();
            Dimension controlPanelSize = myControlPanel.getPreferredSize();
            return new Dimension(
                Math.max(editorPaneSize.width, controlPanelSize.width),
                editorPaneSize.height + controlPanelSize.height);
          }
        };
    layeredPane.add(myScrollPane);
    layeredPane.setLayer(myScrollPane, 0);

    mySettingsPanel = createSettingsPanel();
    layeredPane.add(mySettingsPanel);
    layeredPane.setLayer(mySettingsPanel, JLayeredPane.POPUP_LAYER);
    add(layeredPane, BorderLayout.CENTER);
    setOpaque(true);
    myScrollPane.setViewportBorder(JBScrollPane.createIndentBorder());

    final DefaultActionGroup actions = new DefaultActionGroup();
    final BackAction back = new BackAction();
    final ForwardAction forward = new ForwardAction();
    actions.add(back);
    actions.add(forward);
    actions.add(myExternalDocAction = new ExternalDocAction());
    back.registerCustomShortcutSet(CustomShortcutSet.fromString("LEFT"), this);
    forward.registerCustomShortcutSet(CustomShortcutSet.fromString("RIGHT"), this);
    myExternalDocAction.registerCustomShortcutSet(CustomShortcutSet.fromString("UP"), this);
    if (additionalActions != null) {
      for (final AnAction action : additionalActions) {
        actions.add(action);
      }
    }

    myToolBar =
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.JAVADOC_TOOLBAR, actions, true);

    myControlPanel = new JPanel();
    myControlPanel.setLayout(new BorderLayout());
    myControlPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
    JPanel dummyPanel = new JPanel();

    myElementLabel = new JLabel();

    dummyPanel.setLayout(new BorderLayout());
    dummyPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

    dummyPanel.add(myElementLabel, BorderLayout.EAST);

    myControlPanel.add(myToolBar.getComponent(), BorderLayout.WEST);
    myControlPanel.add(dummyPanel, BorderLayout.CENTER);
    myControlPanel.add(myShowSettingsButton = new MyShowSettingsButton(), BorderLayout.EAST);
    myControlPanelVisible = false;

    final HyperlinkListener hyperlinkListener =
        new HyperlinkListener() {
          @Override
          public void hyperlinkUpdate(HyperlinkEvent e) {
            HyperlinkEvent.EventType type = e.getEventType();
            if (type == HyperlinkEvent.EventType.ACTIVATED) {
              manager.navigateByLink(DocumentationComponent.this, e.getDescription());
            }
          }
        };
    myEditorPane.addHyperlinkListener(hyperlinkListener);
    Disposer.register(
        this,
        new Disposable() {
          @Override
          public void dispose() {
            myEditorPane.removeHyperlinkListener(hyperlinkListener);
          }
        });

    registerActions();

    updateControlState();
  }
 protected final void hideProgress() {
   myGlassLayer.setEnabled(true);
   myProgressIcon.suspend();
   myLayeredPane.remove(myProgressPanel);
 }
  /**
   * Shows the hint in the layered pane. Coordinates <code>x</code> and <code>y</code> are in <code>
   * parentComponent</code> coordinate system. Note that the component appears on 250 layer.
   */
  @Override
  public void show(
      @NotNull final JComponent parentComponent,
      final int x,
      final int y,
      final JComponent focusBackComponent,
      @NotNull final HintHint hintHint) {
    myParentComponent = parentComponent;
    myHintHint = hintHint;

    myFocusBackComponent = focusBackComponent;

    LOG.assertTrue(myParentComponent.isShowing());
    myEscListener = new MyEscListener();
    myComponent.registerKeyboardAction(
        myEscListener,
        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
        JComponent.WHEN_IN_FOCUSED_WINDOW);
    myComponent.registerKeyboardAction(
        myEscListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED);
    final JLayeredPane layeredPane = parentComponent.getRootPane().getLayeredPane();

    myComponent.validate();

    if (!myForceShowAsPopup
        && (myForceLightweightPopup
            || fitsLayeredPane(
                layeredPane,
                myComponent,
                new RelativePoint(parentComponent, new Point(x, y)),
                hintHint))) {
      beforeShow();
      final Dimension preferredSize = myComponent.getPreferredSize();

      if (hintHint.isAwtTooltip()) {
        IdeTooltip tooltip =
            new IdeTooltip(
                hintHint.getOriginalComponent(),
                hintHint.getOriginalPoint(),
                myComponent,
                hintHint,
                myComponent) {
              @Override
              protected boolean canAutohideOn(TooltipEvent event) {
                if (event.getInputEvent() instanceof MouseEvent) {
                  return !(hintHint.isContentActive() && event.isIsEventInsideBalloon());
                } else if (event.getAction() != null) {
                  return false;
                } else {
                  return true;
                }
              }

              @Override
              protected void onHidden() {
                fireHintHidden();
                TooltipController.getInstance().resetCurrent();
              }

              @Override
              public boolean canBeDismissedOnTimeout() {
                return false;
              }
            }.setToCenterIfSmall(hintHint.isMayCenterTooltip())
                .setPreferredPosition(hintHint.getPreferredPosition())
                .setHighlighterType(hintHint.isHighlighterType())
                .setTextForeground(hintHint.getTextForeground())
                .setTextBackground(hintHint.getTextBackground())
                .setBorderColor(hintHint.getBorderColor())
                .setBorderInsets(hintHint.getBorderInsets())
                .setFont(hintHint.getTextFont())
                .setCalloutShift(hintHint.getCalloutShift())
                .setPositionChangeShift(
                    hintHint.getPositionChangeX(), hintHint.getPositionChangeY())
                .setExplicitClose(hintHint.isExplicitClose())
                .setHint(true);
        myComponent.validate();
        myCurrentIdeTooltip =
            IdeTooltipManager.getInstance()
                .show(tooltip, hintHint.isShowImmediately(), hintHint.isAnimationEnabled());
      } else {
        final Point layeredPanePoint =
            SwingUtilities.convertPoint(parentComponent, x, y, layeredPane);
        myComponent.setBounds(
            layeredPanePoint.x, layeredPanePoint.y, preferredSize.width, preferredSize.height);
        layeredPane.add(myComponent, JLayeredPane.POPUP_LAYER);

        myComponent.validate();
        myComponent.repaint();
      }
    } else {
      myIsRealPopup = true;
      Point actualPoint = new Point(x, y);
      JComponent actualComponent = new OpaquePanel(new BorderLayout());
      actualComponent.add(myComponent, BorderLayout.CENTER);
      if (isAwtTooltip()) {
        fixActualPoint(actualPoint);

        int inset = BalloonImpl.getNormalInset();
        actualComponent.setBorder(new LineBorder(hintHint.getTextBackground(), inset));
        actualComponent.setBackground(hintHint.getTextBackground());
        actualComponent.validate();
      }

      myPopup =
          JBPopupFactory.getInstance()
              .createComponentPopupBuilder(actualComponent, myFocusRequestor)
              .setRequestFocus(myFocusRequestor != null)
              .setFocusable(myFocusRequestor != null)
              .setResizable(myResizable)
              .setMovable(myTitle != null)
              .setTitle(myTitle)
              .setModalContext(false)
              .setShowShadow(isRealPopup() && !isForceHideShadow())
              .setCancelKeyEnabled(false)
              .setCancelOnClickOutside(myCancelOnClickOutside)
              .setCancelCallback(
                  new Computable<Boolean>() {
                    @Override
                    public Boolean compute() {
                      onPopupCancel();
                      return true;
                    }
                  })
              .setCancelOnOtherWindowOpen(myCancelOnOtherWindowOpen)
              .createPopup();

      beforeShow();
      myPopup.show(new RelativePoint(myParentComponent, new Point(actualPoint.x, actualPoint.y)));
    }
  }
Beispiel #29
0
  public TestPanel(Player p) {
    super();
    player = p;
    layeredPane.setPreferredSize(new Dimension(300, 300));

    money = new JLabel("Money: $" + player.getMoney());
    product = new JLabel("Product: " + player.getProduct());
    risk = new JLabel("Risk: " + getRisk() + "%");

    JButton buy = new JButton("Buy RV");
    buy.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            buy();
          }
        });

    JButton sell = new JButton("Sell RV");
    sell.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            sell();
          }
        });

    JButton collect = new JButton("Collect");
    collect.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            collect();
          }
        });

    JButton cook = new JButton("cook");
    cook.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cook();
          }
        });

    layeredPane.add(money, new Integer(0));
    money.setBounds(0, 0, 100, 20);

    layeredPane.add(product, new Integer(0));
    product.setBounds(0, 20, 100, 20);

    layeredPane.add(risk, new Integer(0));
    risk.setBounds(0, 40, 100, 20);

    layeredPane.add(buy, new Integer(0));
    buy.setBounds(100, 0, 101, 30);

    layeredPane.add(sell, new Integer(0));
    sell.setBounds(100, 30, 101, 30);

    layeredPane.add(collect, new Integer(0));
    collect.setBounds(100, 60, 101, 30);

    layeredPane.add(cook, new Integer(0));
    cook.setBounds(100, 90, 101, 30);

    add(layeredPane);
    (new Thread(new StartGame())).start();
  }
  private void createDesignerCard() {
    myLayeredPane = new MyLayeredPane();

    mySurfaceArea =
        new ComponentEditableArea(myLayeredPane) {
          @Override
          protected void fireSelectionChanged() {
            super.fireSelectionChanged();
            myLayeredPane.revalidate();
            myLayeredPane.repaint();
          }

          @Override
          public RadComponent findTarget(int x, int y, @Nullable ComponentTargetFilter filter) {
            if (myRootComponent != null) {
              FindComponentVisitor visitor = new FindComponentVisitor(myLayeredPane, filter, x, y);
              myRootComponent.accept(visitor, false);
              return visitor.getResult();
            }
            return null;
          }

          @Override
          public InputTool findTargetTool(int x, int y) {
            return myDecorationLayer.findTargetTool(x, y);
          }

          @Override
          public void showSelection(boolean value) {
            myDecorationLayer.showSelection(value);
          }

          @Override
          public ComponentDecorator getRootSelectionDecorator() {
            return DesignerEditorPanel.this.getRootSelectionDecorator();
          }

          @Nullable
          public EditOperation processRootOperation(OperationContext context) {
            return DesignerEditorPanel.this.processRootOperation(context);
          }

          @Override
          public FeedbackLayer getFeedbackLayer() {
            return myFeedbackLayer;
          }

          @Override
          public RadComponent getRootComponent() {
            return myRootComponent;
          }
        };

    myPaletteListener =
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (DesignerToolWindowManager.getInstance(getProject()).getActiveDesigner()
                == DesignerEditorPanel.this) {
              Item paletteItem = (Item) PaletteManager.getInstance(getProject()).getActiveItem();
              if (paletteItem != null) {
                myToolProvider.setActiveTool(
                    new CreationTool(true, createCreationFactory(paletteItem)));
              } else if (myToolProvider.getActiveTool() instanceof CreationTool) {
                myToolProvider.loadDefaultTool();
              }
            }
          }
        };

    myToolProvider =
        new ToolProvider() {
          @Override
          public void loadDefaultTool() {
            setActiveTool(new SelectionTool());
          }

          @Override
          public void setActiveTool(InputTool tool) {
            if (getActiveTool() instanceof CreationTool && !(tool instanceof CreationTool)) {
              PaletteManager.getInstance(getProject()).clearActiveItem();
            }
            super.setActiveTool(tool);
          }

          @Override
          public boolean execute(
              final ThrowableRunnable<Exception> operation,
              String command,
              final boolean updateProperties) {
            final boolean[] is = {true};
            CommandProcessor.getInstance()
                .executeCommand(
                    getProject(),
                    new Runnable() {
                      public void run() {
                        is[0] = DesignerEditorPanel.this.execute(operation, updateProperties);
                      }
                    },
                    command,
                    null);
            return is[0];
          }

          @Override
          public void execute(final List<EditOperation> operations, String command) {
            CommandProcessor.getInstance()
                .executeCommand(
                    getProject(),
                    new Runnable() {
                      public void run() {
                        DesignerEditorPanel.this.execute(operations);
                      }
                    },
                    command,
                    null);
          }

          @Override
          public void showError(@NonNls String message, Throwable e) {
            DesignerEditorPanel.this.showError(message, e);
          }
        };

    myGlassLayer = new GlassLayer(myToolProvider, mySurfaceArea);
    myLayeredPane.add(myGlassLayer, LAYER_GLASS);

    myDecorationLayer = new DecorationLayer(mySurfaceArea);
    myLayeredPane.add(myDecorationLayer, LAYER_DECORATION);

    myFeedbackLayer = new FeedbackLayer();
    myLayeredPane.add(myFeedbackLayer, LAYER_FEEDBACK);

    JPanel content = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.VERTICAL;

    myVerticalCaption = new CaptionPanel(this, false);
    content.add(myVerticalCaption, gbc);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    myHorizontalCaption = new CaptionPanel(this, true);
    content.add(myHorizontalCaption, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;

    myScrollPane = ScrollPaneFactory.createScrollPane(myLayeredPane);
    myScrollPane.setBackground(Color.WHITE);
    content.add(myScrollPane, gbc);

    myHorizontalCaption.attachToScrollPane(myScrollPane);
    myVerticalCaption.attachToScrollPane(myScrollPane);

    myActionPanel = new DesignerActionPanel(this, myGlassLayer);

    myDesignerCard = new JPanel(new FillLayout());
    myDesignerCard.add(myActionPanel.getToolbarComponent());
    myDesignerCard.add(content);
    add(myDesignerCard, DESIGNER_CARD);

    PaletteManager.getInstance(getProject()).addSelectionListener(myPaletteListener);

    mySourceSelectionListener =
        new ComponentSelectionListener() {
          @Override
          public void selectionChanged(EditableArea area) {
            storeSourceSelectionState();
          }
        };
    mySurfaceArea.addSelectionListener(mySourceSelectionListener);
  }