Package javax.swing

Examples of javax.swing.JLayeredPane$AccessibleJLayeredPane


        URL url = cl.getResource(Resources.getString(ICON_BATIK_SPLASH));
        ImageIcon icon = new ImageIcon(url);
        int w = icon.getIconWidth();
        int h = icon.getIconHeight();

        JLayeredPane p = new JLayeredPane();
        p.setSize(600, 425);
        getContentPane().add(p);

        JLabel l = new JLabel(icon);
        l.setBounds(0, 0, w, h);
        p.add(l, new Integer(0));

        JLabel l2 = new JLabel("Batik " + Version.getVersion());
        l2.setForeground(new Color(232, 232, 232, 255));
        l2.setOpaque(false);
        l2.setBackground(new Color(0, 0, 0, 0));
        l2.setHorizontalAlignment(JLabel.RIGHT);
        l2.setVerticalAlignment(JLabel.BOTTOM);
        l2.setBounds(w - 320, h - 117, 300, 100);
        p.add(l2, new Integer(2));

        ((JComponent)getContentPane()).setBorder
            (BorderFactory.createCompoundBorder
             (BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.gray, Color.black),
              BorderFactory.createCompoundBorder
View Full Code Here


    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
    setTitle("Mon CTT � moi");
    setIconImage(new ImageIcon(ClassLoader.getSystemResource("Images/abstraction.gif")).getImage());
       
    container = new JLayeredPane();
    container.setBounds(0, 0, getWidth(), getHeight());
    container.setOpaque(true);
    container.setBackground(Color.DARK_GRAY);
    container.setLayout(new BorderLayout());
    menuBar = new MenuBar();
View Full Code Here

    parent = arg0;
    items = new LinkedList<PieItem>();
    setPopupSize(200, 200);
    setBorderPainted(false);
    setOpaque(false);
    container = new JLayeredPane();
    container.setSize(getSize())
    container.setOpaque(false);;
    container.setBounds(0, 0, 200, 200);
   
    addMouseListener(this);
View Full Code Here

      throw new RuntimeException("Error: jScrollPane has wrong type.");
    if (!(component instanceof JScrollPane))
      throw new RuntimeException("Error: battlefieldPanel is missing");
   
    JScrollPane jScrollPane = (JScrollPane)component;
    JLayeredPane battlefieldPanel = (JLayeredPane)component2;
   
    Row allLands = new Row();

    outerLoop: //
    for (MagePermanent permanent : permanents) {
      if (!CardUtil.isLand(permanent) || CardUtil.isCreature(permanent))
        continue;

      int insertIndex = -1;

      // Find lands with the same name.
      for (int i = 0, n = allLands.size(); i < n; i++) {
        Stack stack = allLands.get(i);
        MagePermanent firstPanel = stack.get(0);
        if (firstPanel.getOriginal().getName().equals(permanent.getOriginal().getName())) {
          if (!empty(firstPanel.getLinks())) {
            // Put this land to the left of lands with the same name and attachments.
            insertIndex = i;
            break;
          }
          if (!empty(permanent.getLinks()) || stack.size() == landStackMax) {
            // If this land has attachments or the stack is full, put it to the right.
            insertIndex = i + 1;
            continue;
          }
          // Add to stack.
          stack.add(0, permanent);
          continue outerLoop;
        }
        if (insertIndex != -1)
          break;
      }

      Stack stack = new Stack();
      stack.add(permanent);
      allLands.add(insertIndex == -1 ? allLands.size() : insertIndex, stack);
    }

    Row allCreatures = new Row(permanents, RowType.creature);
    Row allOthers = new Row(permanents, RowType.other);

    cardWidth = cardWidthMax;
    Rectangle rect = jScrollPane.getVisibleRect();
    playAreaWidth = rect.width;
    playAreaHeight = rect.height - MW_GUIDE_HEIGHT;
    while (true) {
      rows.clear();
      cardHeight = Math.round(cardWidth * CardPanel.ASPECT_RATIO);
      extraCardSpacingX = (int) Math.round(cardWidth * EXTRA_CARD_SPACING_X);
      cardSpacingX = cardHeight - cardWidth + extraCardSpacingX;
      cardSpacingY = (int) Math.round(cardHeight * CARD_SPACING_Y);
      stackSpacingX = stackVertical ? 0 : (int) Math.round(cardWidth * STACK_SPACING_X);
      stackSpacingY = (int) Math.round(cardHeight * STACK_SPACING_Y);
      Row creatures = (Row) allCreatures.clone();
      Row lands = (Row) allLands.clone();
      Row others = (Row) allOthers.clone();
      // Wrap all creatures and lands.
      wrap(creatures, rows, -1);
      int afterCreaturesIndex = rows.size();
      wrap(lands, rows, afterCreaturesIndex);
      // Store the current rows and others.
      List<Row> storedRows = new ArrayList<Row>(rows.size());
      for (Row row : rows)
        storedRows.add((Row) row.clone());
      Row storedOthers = (Row) others.clone();
      // Fill in all rows with others.
      for (Row row : rows)
        fillRow(others, rows, row);

      // Stop if everything fits, otherwise revert back to the stored values.
      if (creatures.isEmpty() && lands.isEmpty() && others.isEmpty())
        break;
      rows = storedRows;
      others = storedOthers;
      // Try to put others on their own row(s) and fill in the rest.
      wrap(others, rows, afterCreaturesIndex);
      for (Row row : rows)
        fillRow(others, rows, row);
      // If that still doesn't fit, scale down.
      if (creatures.isEmpty() && lands.isEmpty() && others.isEmpty())
        break;
      //cardWidth = (int)(cardWidth / 1.2);
      cardWidth--;
    }

    // Get size of all the rows.
    int x, y = GUTTER_Y;
    int maxRowWidth = 0;
    for (Row row : rows) {
      int rowBottom = 0;
      x = GUTTER_X;
      for (int stackIndex = 0, stackCount = row.size(); stackIndex < stackCount; stackIndex++) {
        Stack stack = row.get(stackIndex);
        rowBottom = Math.max(rowBottom, y + stack.getHeight());
        x += stack.getWidth();
      }
      y = rowBottom;
      maxRowWidth = Math.max(maxRowWidth, x);
    }
    //setPreferredSize(new Dimension(maxRowWidth - cardSpacingX, y - cardSpacingY));
    //revalidate();

    // Position all card panels.
    x = 0;
    y = GUTTER_Y;
    for (Row row : rows) {
      int rowBottom = 0;
      x = GUTTER_X;
      for (int stackIndex = 0, stackCount = row.size(); stackIndex < stackCount; stackIndex++) {
        Stack stack = row.get(stackIndex);
        // Align others to the right.
        if (RowType.other.isType(stack.get(0))) {
          x = playAreaWidth - GUTTER_X + extraCardSpacingX;
          for (int i = stackIndex, n = row.size(); i < n; i++)
            x -= row.get(i).getWidth();
        }
        for (int panelIndex = 0, panelCount = stack.size(); panelIndex < panelCount; panelIndex++) {
          MagePermanent panel = stack.get(panelIndex);
          int stackPosition = panelCount - panelIndex - 1;
          ///setComponentZOrder((Component)panel, panelIndex);
          int panelX = x + (stackPosition * stackSpacingX);
          int panelY = y + (stackPosition * stackSpacingY);
          //panel.setLocation(panelX, panelY);
          battlefieldPanel.moveToBack(panel);
          panel.setCardBounds(panelX, panelY, cardWidth, cardHeight);
        }
        rowBottom = Math.max(rowBottom, y + stack.getHeight());
        x += stack.getWidth();
      }
View Full Code Here

    }

    final CardPanel overPanel = enlargedCardPanel, animationPanel = enlargedAnimationPanel;

    animationPanel.setAnimationPanel(true);
    final JLayeredPane layeredPane = SwingUtilities.getRootPane(overPanel).getLayeredPane();
    layeredPane.setLayer(animationPanel, JLayeredPane.MODAL_LAYER);

    final int startWidth = animationPanel.getCardWidth();
    final int startHeight = Math.round(startWidth * CardPanel.ASPECT_RATIO);
    final int endWidth = overPanel.getCardWidth();
    final int endHeight = Math.round(endWidth * CardPanel.ASPECT_RATIO);

    new Animation(200) {
      protected void update (float percentage) {
        int currentWidth = startWidth + Math.round((endWidth - startWidth) * percentage);
        int currentHeight = startHeight + Math.round((endHeight - startHeight) * percentage);
        Point startPos = SwingUtilities.convertPoint(overPanel.getParent(), overPanel.getCardLocation(), layeredPane);
        int centerX = startPos.x + Math.round(endWidth / 2f);
        int centerY = startPos.y + Math.round(endHeight / 2f);
        int currentX = Math.max(0, centerX - Math.round(currentWidth / 2f));
        currentX = Math.min(currentX, layeredPane.getWidth() - currentWidth);
        int currentY = Math.max(0, centerY - Math.round(currentHeight / 2f));
        currentY = Math.min(currentY, layeredPane.getHeight() - currentHeight);
        animationPanel.tappedAngle = overPanel.tappedAngle * percentage;
        animationPanel.setCardBounds(currentX, currentY, currentWidth, currentHeight);
      }

      protected void end () {
        animationPanel.setVisible(false);
        animationPanel.repaint();
        EventQueue.invokeLater(new Runnable() {
          public void run () {
            layeredPane.remove(animationPanel);
          }
        });
      }
    };
  }
View Full Code Here

       
        //FIXME: remove from here
    try {
          // Override layout (I can't edit generated code)
          this.setLayout(new BorderLayout());
      final JLayeredPane j = new JLayeredPane();
      j.setSize(1024,768);
      this.add(j);
      j.add(jSplitPane1, JLayeredPane.DEFAULT_LAYER);
     
      Map<String, JComponent> ui = getUIComponents(j);
      Plugins.getInstance().updateGamePanel(ui);

      // Enlarge jlayeredpane on resize
      addComponentListener(new ComponentAdapter(){
        @Override
        public void componentResized(ComponentEvent e) {
          int width = ((JComponent)e.getSource()).getWidth();
          int height = ((JComponent)e.getSource()).getHeight();
          j.setSize(width, height);
          jSplitPane1.setSize(width, height);
        }
          });
     
    } catch (Exception e) {
View Full Code Here

   * @param component
   *            the overlay component to display, null to remove any displayed
   *            component
   */
  public void setOverlay(Component component) {
    JLayeredPane layeredPane = getLayeredPane();
    if (overlayComponent != null) {
      layeredPane.remove(overlayComponent);
    }
    overlayComponent = component;
    if (overlayComponent != null) {
      layeredPane.add(overlayComponent, JLayeredPane.PALETTE_LAYER);
      resizeOverlayComponent();
    }
  }
View Full Code Here

        // substract insets
        int w = bounds.width - insets.right - insets.left;
        int h = bounds.height - insets.top - insets.bottom;

        JLayeredPane layeredPane = pane.getLayeredPane();
        if (layeredPane != null)
            layeredPane.setBounds(insets.left, insets.top, w, h); // x, y, w, h

        Component glassPane = pane.getGlassPane();
        if (glassPane != null)
            glassPane.setBounds(insets.left, insets.top, w, h);
View Full Code Here

        Rectangle rect = new Rectangle();
        RootWindow window = mgr==null? null: mgr.getWindow();
        if(window==null)
            return rect;

        JLayeredPane layeredPane = window.getLayeredPane();

        Component leftEdge = getEdgeGuide(mgr, MinimizationManager.LEFT);
        Component rightEdge = getEdgeGuide(mgr, MinimizationManager.RIGHT);
        Component bottomEdge = getEdgeGuide(mgr, MinimizationManager.BOTTOM);
        Component topEdge = getEdgeGuide(mgr, MinimizationManager.TOP);
View Full Code Here

    protected void install() {
        RootWindow window = getWindow();
        if(window==null)
            return;

        JLayeredPane layerPane = window.getLayeredPane();
        boolean changed = install(leftBar, layerPane);
        changed = install(rightBar, layerPane) || changed;
        changed = install(bottomBar, layerPane) || changed;
        changed = install(viewPane, layerPane) || changed;

        if(changed) {
            layerPane.addComponentListener(new ComponentAdapter() {
                public void componentResized(ComponentEvent evt) {
                    if(evt.getSource() instanceof JLayeredPane)
                        revalidate();
                }
            });
View Full Code Here

TOP

Related Classes of javax.swing.JLayeredPane$AccessibleJLayeredPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.