当前位置: 首页>>代码示例>>Java>>正文


Java JLayeredPane.add方法代码示例

本文整理汇总了Java中javax.swing.JLayeredPane.add方法的典型用法代码示例。如果您正苦于以下问题:Java JLayeredPane.add方法的具体用法?Java JLayeredPane.add怎么用?Java JLayeredPane.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLayeredPane的用法示例。


在下文中一共展示了JLayeredPane.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: addWindow

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
/**
 * Add a sticky window to the editor.
 * @param window the JComponent to add to the editor
 */
public void addWindow(JComponent window) {
    Container container = jtc.getParent();
    if(container instanceof JLayeredPane) {
        JLayeredPane pane = (JLayeredPane) container;
        pane.add(window, JLayeredPane.PALETTE_LAYER);
        window.setVisible(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:StickyWindowSupport.java

示例4: DesktopImpl

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
/** Creates a new instance of DesktopImpl */
public DesktopImpl () {
    // layered pane with absolute positioning, to enable overlapping
    layeredPane = new JLayeredPane();
    layeredPane.setLayout(new LayeredLayout());
    // desktop represents regular layer of layeredPane
    desktop = new JPanel() {
        @Override
        public boolean isOpaque() {
            if( UIManager.getBoolean( "NbMainWindow.showCustomBackground" ) ) //NOI18N
                return false;
            return super.isOpaque();
        }

        @Override
        public void updateUI() {
            Mutex.EVENT.readAccess( new Runnable() {
                @Override
                public void run() {
                    superUpdateUI();
                }
            });
        }

        private void superUpdateUI() {
            super.updateUI();
        }
    };
    desktop.setLayout(new GridBagLayout());
    Color bkColor = UIManager.getColor("NbSplitPane.background"); //NOI18N
    if( null != bkColor ) {
        desktop.setBackground(bkColor);
        desktop.setOpaque(true);
    }
    layeredPane.add(desktop);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:DesktopImpl.java

示例5: showEffect

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
public void showEffect(JLayeredPane pane, Integer layer, SlideOperation operation) {
    this.pane = pane;
    this.operation = operation;
    Component comp = operation.getComponent();
    Graphics2D gr2d = (Graphics2D)pane.getGraphics();
    Rectangle start = operation.getStartBounds();
    Rectangle finish = operation.getFinishBounds();
    Dimension finishSize = finish.getSize();
    Dimension startSize = start.getSize();
    Rectangle current = start;
    Image compImage = preparedImage;

   /* if (compImage == null) {
        if (finishSize.width * finishSize.height > startSize.width * startSize.height) {
            compImage = renderCompIntoImage(comp, finishSize, pane);
        } else {
            compImage = renderCompIntoImage(comp, startSize, pane);
        }
    }*/
    pane.add(stretchedImage, layer);
    
    path = computePath(start, finish);
    
    curIter = 1;
    if (compImage != null) {
        stretchedImage.setOrigImage(compImage);
    } else {
        if (finishSize.width * finishSize.height > startSize.width * startSize.height) {
            stretchedImage.setComp(comp, finishSize);
        } else {
            stretchedImage.setComp(comp, startSize);
        }
    }
    stretchedImage.setBoundsAndAlpha(start, initialAlpha);
    
    getTimer().start();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:ScaleFx.java

示例6: updatePopup

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
/**
 * Updates size and visibility of this panel according to model content
 */
public void updatePopup () {
    int modelSize = rModel.getSize();

    // plug this popup into layered pane if needed
    JLayeredPane lPane = JLayeredPane.getLayeredPaneAbove(comboBar);
    // lPane can be null when the corresponding dialog is closed already
    // for example, when the user didn't want to wait until the search finishes
    if (!isDisplayable() && (lPane != null)) {
        lPane.add(this, new Integer(JLayeredPane.POPUP_LAYER + 1) );
    }

    boolean statusVisible = updateStatusPanel();

    if(lPane != null) {
        computePopupBounds(popupBounds, lPane, modelSize);
        setBounds(popupBounds);
    }

    // popup visibility constraints
    if ((modelSize > 0 || statusVisible) && comboBar.isTextFieldFocusOwner()) {
        if (jList1.getSelectedIndex() >= modelSize) {
            jList1.setSelectedIndex(modelSize - 1);
        }
        setVisible(true);
    } else {
        setVisible(false);
    }

    // needed on JDK 1.5.x to repaint correctly
    revalidate();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:QuickSearchPopup.java

示例7: makePreviewTable

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
/**
 * Fills the tablePane with content.
 */
private JComponent makePreviewTable() {
	previewTable = new ExtendedJTable(false, false, false);
	// ensure same background as JPanels in case of only few rows
	previewTable.setBackground(Colors.PANEL_BACKGROUND);
	previewTable.setColoredTableCellRenderer(new ColoredTableCellRenderer() {

		private final Font boldFont = getFont().deriveFont(Font.BOLD);

		@Override
		public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
				int row, int column) {
			JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
			adjustCell(row, label, boldFont);
			return label;
		}

	});

	loadingContentPane = new LoadingContentPane("loading_data", previewTable);

	tablePane = new JScrollPane(loadingContentPane);
	tablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	tablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	tablePane.setBorder(null);

	// add PREVIEW label in front of scrollpane
	JLayeredPane layeredPane = new JLayeredPane();
	layeredPane.setLayout(new OverlayLayout(layeredPane));
	layeredPane.add(tablePane, JLayeredPane.DEFAULT_LAYER);

	JPanel overlayPanel = new JPanel(new BorderLayout());
	overlayPanel.setOpaque(false);
	overlayLabel = new JLabel("", SwingConstants.CENTER);
	showPreviewLettering();
	overlayPanel.add(overlayLabel, BorderLayout.CENTER);

	layeredPane.add(overlayPanel, JLayeredPane.PALETTE_LAYER);
	return layeredPane;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:43,代码来源:CSVFormatSpecificationPanel.java

示例8: createAndShowGUI

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:CursorOverlappedPanelsTest.java

示例9: updatePopup

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
private void updatePopup (boolean isInProgress, boolean canRetry) {
    int modelSize = rModel.getSize();
    if (modelSize > 0 && jList1.getSelectedIndex()<0) {
        jList1.setSelectedIndex(0);
    }

    // plug this popup into layered pane if needed
    JLayeredPane lPane = JLayeredPane.getLayeredPaneAbove(comboBar);
    if (lPane == null) {
        // #162075 - return when comboBar not yet seeded in AWT hierarchy
        return;
    }
    if (!isDisplayable()) {
        lPane.add(this, new Integer(JLayeredPane.POPUP_LAYER + 1) );
    }

    boolean statusVisible = updateStatusPanel(isInProgress);

    try {
        computePopupBounds(popupBounds, lPane, modelSize);
    } catch (Exception e) { //sometimes the hack in computePopupBounds fails
        LOG.log(canRetry ? Level.INFO : Level.SEVERE, null, e);
        retryUpdatePopup(canRetry, isInProgress);
        return;
    }
    setBounds(popupBounds);

    // popup visibility constraints
    if ((modelSize > 0 || statusVisible) && comboBar.getCommand().isFocusOwner()) {
        if (modelSize > 0 && !isVisible()) {
            jList1.setSelectedIndex(0);
        }
        if (jList1.getSelectedIndex() >= modelSize) {
            jList1.setSelectedIndex(modelSize - 1);
        }
        if (explicitlyInvoked || !searchedText.isEmpty()) {
            setVisible(true);
        }
    } else {
        setVisible(false);
    }
    explicitlyInvoked = false;

    // needed on JDK 1.5.x to repaint correctly
    revalidate();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:QuickSearchPopup.java

示例10: createExtComponent

import javax.swing.JLayeredPane; //导入方法依赖的package包/类
@Override
    protected JComponent createExtComponent() {

        JTextComponent component = getComponent();
        
        JLayeredPane layers = new LayeredEditorPane(component);
        layers.add(component, JLayeredPane.DEFAULT_LAYER, 0);
//        MyInternalFrame window = new MyInternalFrame();
//        layers.add(window, JLayeredPane.PALETTE_LAYER);
//        window.show();

        // Add the scroll-pane with the component to the center
        JScrollPane scroller = new JScrollPane(layers);
        scroller.getViewport().setMinimumSize(new Dimension(4,4));

        // remove default scroll-pane border, winsys will handle borders itself 
        Border empty = BorderFactory.createEmptyBorder();
        // Important:  Do not delete or use null instead, will cause
        //problems on GTK L&F.  Must set both scroller border & viewport
        //border! - Tim
        scroller.setBorder(empty);
        scroller.setViewportBorder(empty);
        
        if (component.getClientProperty("nbeditorui.vScrollPolicy") != null) {
            scroller.setVerticalScrollBarPolicy(
                    (Integer)component.getClientProperty("nbeditorui.vScrollPolicy"));
        }
        if (component.getClientProperty("nbeditorui.hScrollPolicy") != null) {
            scroller.setHorizontalScrollBarPolicy(
                    (Integer)component.getClientProperty("nbeditorui.hScrollPolicy"));
        }
        // extComponent will be a panel
        JComponent ec = new JPanel(new BorderLayout());
        ec.putClientProperty(JTextComponent.class, component);
        ec.add(scroller);

        // Initialize sidebars
        // Need to clear the cache - it's null at this point when opening file but the sidebars
        // would be reused during L&F change (see BaseTextUI.UIWatcher) which would not work properly.
        CustomizableSideBar.resetSideBars(component);
        Map<SideBarPosition, JComponent> sideBars = CustomizableSideBar.getSideBars(component);
        processSideBars(sideBars, ec, scroller);
        
        if (listener == null){
            listener = new SideBarsListener(component);
            CustomizableSideBar.addChangeListener(NbEditorUtilities.getMimeType(component), listener);
        }
        
        // Initialize the corner component
        initGlyphCorner(scroller);

        return ec;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:54,代码来源:NbEditorUI.java


注:本文中的javax.swing.JLayeredPane.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。