當前位置: 首頁>>代碼示例>>Java>>正文


Java JLayeredPane類代碼示例

本文整理匯總了Java中javax.swing.JLayeredPane的典型用法代碼示例。如果您正苦於以下問題:Java JLayeredPane類的具體用法?Java JLayeredPane怎麽用?Java JLayeredPane使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JLayeredPane類屬於javax.swing包,在下文中一共展示了JLayeredPane類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javax.swing.JLayeredPane; //導入依賴的package包/類
void start(PaletteItem item, Point pt) {
    // clean up prev is necessary
    if(dragComponent != null) {
        menuEditLayer.layers.remove(dragComponent);
        dragComponent = null;
    }
    
    if(!menuEditLayer.doesFormContainMenuBar()) {
        //op = Op.NO_MENUBAR;
        menuEditLayer.showMenubarWarning = true;
        FormEditor.getAssistantModel(menuEditLayer.formDesigner.getFormModel()).setContext("missingMenubar"); // NOI18N
        menuEditLayer.repaint();
    }
    
    op = Op.PICK_AND_PLOP_FROM_PALETTE;
    started = true;
    dragComponent = createDragFeedbackComponent(null, item.getComponentClass());
    dragComponent.setSize(dragComponent.getPreferredSize());
    dragComponent.setLocation(pt);
    menuEditLayer.layers.add(dragComponent, JLayeredPane.DRAG_LAYER);
    menuEditLayer.repaint();
    currentItem = item;
    menuEditLayer.glassLayer.requestFocusInWindow();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:DragOperation.java

示例2: computeVisibleSpan

import javax.swing.JLayeredPane; //導入依賴的package包/類
private int[] computeVisibleSpan() {
    Component parent = pane.getParent();
    
    if (parent instanceof JLayeredPane) {
        parent = parent.getParent();
    }

    if (parent instanceof JViewport) {
        JViewport vp = (JViewport) parent;

        Point start = vp.getViewPosition();
        Dimension size = vp.getExtentSize();
        Point end = new Point((int) (start.getX() + size.getWidth()), (int) (start.getY() + size.getHeight()));

        int startPosition = pane.viewToModel(start);
        int endPosition = pane.viewToModel(end);

        if (parentWithListener != vp) {
            vp.addChangeListener(WeakListeners.change(this, vp));
            parentWithListener = vp;
        }
        return new int[] {startPosition, endPosition};
    }

    return new int[] {0, pane.getDocument().getLength()};
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:ComponentPeer.java

示例3: getUsableHeight

import javax.swing.JLayeredPane; //導入依賴的package包/類
double getUsableHeight() {
    //fix for issue #54080:
    //find the scrollpane which contains the pane:
    Component scrollPaneCandidade = pane.getParent();
    
    if (scrollPaneCandidade instanceof JLayeredPane) {
        scrollPaneCandidade = scrollPaneCandidade.getParent();
    }
    
    if (scrollPaneCandidade != null && !(scrollPaneCandidade instanceof JScrollPane)) {
        scrollPaneCandidade = scrollPaneCandidade.getParent();
    }
    
    if (scrollPaneCandidade == null || !(scrollPaneCandidade instanceof JScrollPane) || scrollBar == null) {
        //no help for #54080:
        return getHeight() - HEIGHT_OFFSET;
    }
    
    JScrollPane scrollPane = (JScrollPane) scrollPaneCandidade;
    int visibleHeight = scrollPane.getViewport().getExtentSize().height;
    
    int topButton = topOffset();
    int bottomButton = scrollBar.bottom;
    
    return visibleHeight - topButton - bottomButton;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:AnnotationView.java

示例4: performOperation

import javax.swing.JLayeredPane; //導入依賴的package包/類
private void performOperation(JLayeredPane pane, Integer layer) {
    // XXX - TBD
    switch (type) {
        case SLIDE_IN:
            component.setBounds(finishBounds);
            pane.add(component, layer);
            if( isHeavyWeightShowing() ) {
                repaintLayeredPane();
            }
            break;
        case SLIDE_OUT:
            pane.remove(component);
            break;
        case SLIDE_RESIZE:
            component.setBounds(finishBounds);
            ((JComponent)component).revalidate();
            if( isHeavyWeightShowing() ) {
                repaintLayeredPane();
            }
            break;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:SlideOperationImpl.java

示例5: computePopupBounds

import javax.swing.JLayeredPane; //導入依賴的package包/類
private void computePopupBounds (Rectangle result, JLayeredPane lPane, int modelSize) {
    Dimension cSize = comboBar.getSize();
    int width = getPopupWidth();
    Point location = new Point(cSize.width - width - 1, comboBar.getBottomLineY() - 1);
    if (SwingUtilities.getWindowAncestor(comboBar) != null) {
        location = SwingUtilities.convertPoint(comboBar, location, lPane);
    }
    result.setLocation(location);

    // hack to make jList.getpreferredSize work correctly
    // JList is listening on ResultsModel same as us and order of listeners
    // is undefined, so we have to force update of JList's layout data
    jList1.setFixedCellHeight(15);
    jList1.setFixedCellHeight(-1);
    // end of hack

    jList1.setVisibleRowCount(modelSize);
    Dimension preferredSize = jList1.getPreferredSize();

    preferredSize.width = width;
    preferredSize.height += statusPanel.getPreferredSize().height + 3;

    result.setSize(preferredSize);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:QuickSearchPopup.java

示例6: computePopupBounds

import javax.swing.JLayeredPane; //導入依賴的package包/類
private void computePopupBounds (Rectangle result, JLayeredPane lPane, int modelSize) {
    Point location =
            new Point(
                comboBar.getIssueComponent().getX(),
                comboBar.getIssueComponent().getY() + comboBar.getIssueComponent().getHeight() - 1);
    location = SwingUtilities.convertPoint(comboBar, location, lPane); // XXX terrible hack! fix this
    result.setLocation(location);

    // hack to make jList.getpreferredSize work correctly
    // JList is listening on ResultsModel same as us and order of listeners
    // is undefined, so we have to force update of JList's layout data
    jList1.setFixedCellHeight(15);
    jList1.setFixedCellHeight(-1);
    // end of hack

    jList1.setVisibleRowCount(modelSize);
    Dimension preferredSize = jList1.getPreferredSize();

    preferredSize.width = comboBar.getIssueComponent().getWidth();
    preferredSize.height += statusPanel.getPreferredSize().height + 3;
    if(preferredSize.height > 150) {
        preferredSize.height = 150;
    }

    result.setSize(preferredSize);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:QuickSearchPopup.java

示例7: isProbablyAContainer

import javax.swing.JLayeredPane; //導入依賴的package包/類
/**
 * Return true if the given component is likely to be a container such the each
 * component within the container should be be considered as a user input.
 * 
 * @param c
 * @return true if the component children should have this listener added.
 */
protected boolean isProbablyAContainer (Component c) {
    boolean result = extListener != null ? extListener.isContainer(c) : false;
    if (!result) {
        boolean isSwing = isSwingClass(c);
        if (isSwing) {
           result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
                   JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
                   c instanceof JFrame || c instanceof JRootPane || c instanceof
                   Window || c instanceof Frame || c instanceof Dialog ||
                   c instanceof JTabbedPane || c instanceof JInternalFrame ||
                   c instanceof JDesktopPane || c instanceof JLayeredPane;
        } else {
            result = c instanceof Container;
        }
    }
    return result;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:25,代碼來源:GenericListener.java

示例8: getView

import javax.swing.JLayeredPane; //導入依賴的package包/類
public JComponent getView() {
  if (theMap == null) {
    theMap = new View(this);
    scroll = new AdjustableSpeedScrollPane(
          theMap,
          JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
          JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scroll.unregisterKeyboardAction(KeyStroke.getKeyStroke(
          KeyEvent.VK_PAGE_DOWN, 0));
    scroll.unregisterKeyboardAction(KeyStroke.getKeyStroke(
          KeyEvent.VK_PAGE_UP, 0));

    layeredPane.setLayout(new InsetLayout(layeredPane, scroll));
    layeredPane.add(scroll, JLayeredPane.DEFAULT_LAYER);
  }
  return theMap;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:18,代碼來源:PrivateMap.java

示例9: addTo

import javax.swing.JLayeredPane; //導入依賴的package包/類
/**
 * Expects to be added to a {@link Map}. Adds itself as a {@link
 * GameComponent} and a {@link Drawable}component
 */
public void addTo(Buildable b) {
  map = (Map) b;

  mouseOverViewer = new CounterViewer();

  GameModule.getGameModule().getGameState().addGameComponent(this);

  GameModule.getGameModule().addKeyStrokeSource(
    new KeyStrokeSource(view, JComponent.WHEN_FOCUSED));

  map.addDrawComponent(this);
  map.getToolBar().add(launch);

  if (b instanceof Translatable) {
    getI18nData().setOwningComponent((Translatable) b);
  }

  map.getLayeredPane().add(scroll, JLayeredPane.PALETTE_LAYER);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:24,代碼來源:GlobalMap.java

示例10: setDrawWin

import javax.swing.JLayeredPane; //導入依賴的package包/類
/**
 * creates or moves cursor object to given JLayeredPane. Usually called by setDrawWinToOwnerOf()
 */
private void setDrawWin(JLayeredPane newDrawWin) {
  if (newDrawWin != drawWin) {
    // remove cursor from old window
    if (dragCursor.getParent() != null) {
      dragCursor.getParent().remove(dragCursor);
    }
    if (drawWin != null) {
      drawWin.repaint(dragCursor.getBounds());
    }
    drawWin = newDrawWin;
    calcDrawOffset();
    dragCursor.setVisible(false);
    drawWin.add(dragCursor, JLayeredPane.DRAG_LAYER);
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:19,代碼來源:PieceMover.java

示例11: getView

import javax.swing.JLayeredPane; //導入依賴的package包/類
/** @return the Swing component representing the map */
public JComponent getView() {
  if (theMap == null) {
    theMap = new View(this);

    scroll = new AdjustableSpeedScrollPane(
      theMap,
      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.unregisterKeyboardAction(
      KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0));
    scroll.unregisterKeyboardAction(
      KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0));
    scroll.setAlignmentX(0.0f);
    scroll.setAlignmentY(0.0f);

    layeredPane.setLayout(new InsetLayout(layeredPane, scroll));
    layeredPane.add(scroll, JLayeredPane.DEFAULT_LAYER);
  }
  return theMap;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:22,代碼來源:Map.java

示例12: add

import javax.swing.JLayeredPane; //導入依賴的package包/類
@Override
public Component add(Component comp) {
    setsize(comp.getPreferredSize());
    Component[] comps = getComponents();
    if (comps.length > 0) {
        oldComponent = comps[0];
    }
    if (comp.equals(oldComponent)) {
        return super.add(comp);
    }
    if (oldComponent != null) {
        putLayer((JComponent) oldComponent, JLayeredPane.DEFAULT_LAYER);
    }
    Component returnResult = super.add(comp);
    putLayer((JComponent) comp, JLayeredPane.DRAG_LAYER);
    comp.setSize(getPreferredSize());
    comp.setVisible(true);
    comp.setLocation(0, 0 - getPreferredSize().height);
    slideFromTop(comp, oldComponent);
    return returnResult;
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:22,代碼來源:SlideContainer.java

示例13: slideFromTop

import javax.swing.JLayeredPane; //導入依賴的package包/類
private void slideFromTop(final Component comp,
        final Component oldComponent2) {
    new Timer(DELAY, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent aEvt) {
            int y = comp.getY();
            if (y >= -2) {
                comp.setLocation(0, 0);
                putLayer((JComponent) comp, JLayeredPane.DEFAULT_LAYER);
                if (oldComponent2 != null) {
                    remove(oldComponent2);
                }
                ((Timer) aEvt.getSource()).stop();
            } else {
                y += DY;
                comp.setLocation(0, y);
            }
            repaint();
        }
    }).start();
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:23,代碼來源:SlideContainer.java

示例14: init

import javax.swing.JLayeredPane; //導入依賴的package包/類
private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
    JPanel panel = new JPanel();
    panel.setBackground(color);
    panel.setLocation(x, y);
    panel.setSize(w, h);
    pane.add(panel, new Integer(layer));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:javax_swing_JLayeredPane.java

示例15: dragStarted

import javax.swing.JLayeredPane; //導入依賴的package包/類
@Override
public void dragStarted(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON1 && e.getSource() instanceof JLayeredPane) {
        selectionContainer = new JNodeContainerSelection(e.getPoint());
        add(selectionContainer, JLayeredPane.POPUP_LAYER);
    }
}
 
開發者ID:VISNode,項目名稱:VISNode,代碼行數:8,代碼來源:JNodeContainer.java


注:本文中的javax.swing.JLayeredPane類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。