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


Java CBorderlessButton类代码示例

本文整理汇总了Java中edu.mit.blocks.codeblockutil.CBorderlessButton的典型用法代码示例。如果您正苦于以下问题:Java CBorderlessButton类的具体用法?Java CBorderlessButton怎么用?Java CBorderlessButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setupSubsets

import edu.mit.blocks.codeblockutil.CBorderlessButton; //导入依赖的package包/类
/**
 * Sets up the subsets by clearing all subsets and installing
 * the new collection of subsets.  If "usingSys" is true,
 * the the factory and myblocks drawers will be accessible.
 * If "usingSubs" is true, then the subset drawers will
 * be accessible.
 * @param subsets - collection of subsets
 * @param usingSys - true for factory and myblocks
 * @param usingSubs - true for subsets
 */
public void setupSubsets(Collection<Subset> subsets, boolean usingSys, boolean usingSubs) {
    if (usingSubs) {
        this.subsetCanvases.clear();
        for (Subset subset : subsets) {
            FactoryCanvas canvas = new FactoryCanvas(subset.getName(), subset.getColor());
            for (RenderableBlock frb : subset.getBlocks()) {
                canvas.addBlock(frb);
                workspace.notifyListeners(new WorkspaceEvent(workspace, this, frb.getBlockID(), WorkspaceEvent.BLOCK_ADDED));
            }
            canvas.layoutBlocks();
            this.subsetCanvases.add(canvas);
        }
        this.navigator.setCanvas(this.subsetCanvases, SUBSETS_NAME);
        if (usingSys) {
            this.factorySwicther.removeAll();
            this.factorySwicther.add(this.navigator.getSwitcher());
        } else {
            this.factorySwicther.removeAll();
            this.factorySwicther.add(new CLabel(SUBSETS_NAME));
        }
        this.viewSubsetsDrawers();
    } else if (usingSys) {
        this.factorySwicther.removeAll();
        final CBorderlessButton factoryButton = new CBorderlessButton(STATIC_NAME);
        final CBorderlessButton myblocksButton = new CBorderlessButton(DYNAMIC_NAME);
        ActionListener listener = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (factoryButton.equals(e.getSource())) {
                    FactoryManager.this.viewStaticDrawers();
                } else if (myblocksButton.equals(e.getSource())) {
                    FactoryManager.this.viewDynamicDrawers();
                }
            }
        };
        factoryButton.addActionListener(listener);
        myblocksButton.addActionListener(listener);
        this.factorySwicther.add(factoryButton, BorderLayout.WEST);
        this.factorySwicther.add(myblocksButton, BorderLayout.EAST);
        this.viewStaticDrawers();
    }
    this.factorySwicther.revalidate();
    this.factorySwicther.repaint();
}
 
开发者ID:heqichen,项目名称:openblocks,代码行数:55,代码来源:FactoryManager.java


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