当前位置: 首页>>代码示例>>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;未经允许,请勿转载。