• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HierarchyBoundsAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initLineWrapSupport

import java.awt.event.HierarchyBoundsAdapter; //导入依赖的package包/类
/**
 * Helper method for initializing multi line support.
 */
private void initLineWrapSupport() {
    addPropertyChangeListener(new MultiLineSupport());
    // FYI: no more listening for componentResized. Those events are delivered out
    // of order and without old values are meaningless and forcing us to react when
    // not necessary. Instead overriding reshape() ensures we have control over old AND new size.
    addHierarchyBoundsListener(new HierarchyBoundsAdapter() {
        @Override
        public void ancestorResized(HierarchyEvent e) {
            // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars.
            // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view
            if (e.getChanged() instanceof JViewport) {
                Rectangle viewportBounds = e.getChanged().getBounds();
                if (viewportBounds.getWidth() < getWidth()) {
                    View view = getWrappingView();
                    if (view != null) {
                        view.setSize(viewportBounds.width, viewportBounds.height);
                    }
                }
            }
        }});
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:JXLabel.java


示例2: initLineWrapSupport

import java.awt.event.HierarchyBoundsAdapter; //导入依赖的package包/类
/**
 * Helper method for initializing multi line support.
 */
private void initLineWrapSupport() {
    addPropertyChangeListener(new MultiLineSupport());
    // FYI: no more listening for componentResized. Those events are delivered out
    // of order and without old values are meaningless and forcing us to react when
    // not necessary. Instead overriding reshape() ensures we have control over old AND new size.
    addHierarchyBoundsListener(new HierarchyBoundsAdapter() {
        public void ancestorResized(HierarchyEvent e) {
            // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars.
            // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view
            if (e.getChanged() instanceof JViewport) {
                Rectangle viewportBounds = e.getChanged().getBounds();
                if (viewportBounds.getWidth() < getWidth()) {
                    View view = getWrappingView();
                    if (view != null) {
                        view.setSize(viewportBounds.width, viewportBounds.height);
                    }
                }
            }
        }});
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:24,代码来源:JXLabel.java


示例3: ScreenLayout

import java.awt.event.HierarchyBoundsAdapter; //导入依赖的package包/类
/** Create a new screen layout manager */
public ScreenLayout(final Container parent) {
	parent.addHierarchyBoundsListener(new HierarchyBoundsAdapter() {
		public void ancestorMoved(HierarchyEvent e) {
			layoutContainer(parent);
		}
	});
	parent.setLayout(this);
}
 
开发者ID:CA-IRIS,项目名称:ca-iris,代码行数:10,代码来源:ScreenLayout.java


示例4: installListeners

import java.awt.event.HierarchyBoundsAdapter; //导入依赖的package包/类
protected void installListeners(final JXHeader header) {
    propListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
        }
    };
    boundsListener = new HierarchyBoundsAdapter() {
        @Override
        public void ancestorResized(HierarchyEvent e) {
            if (header == e.getComponent()) {
                View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
                // view might get lost on LAF change ...
                if (v == null) {
                    descriptionPane.putClientProperty(BasicHTML.propertyKey, 
                            MultiLineSupport.createView(descriptionPane));
                    v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
                }
                if (v != null) {
                    Container tla = header.getTopLevelAncestor();
                    if (tla == null) {
                        tla = header.getParent();
                        while (tla.getParent() != null) {
                            tla = tla.getParent();
                        }
                    }
                    int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
                    int w = Math.min(tla.getWidth(), header.getParent().getWidth());
                    // 35 = description pane insets, TODO: obtain dynamically
                    w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
                    v.setSize(w, h);
                    descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
                }
            }
        }};
    header.addPropertyChangeListener(propListener);
    header.addHierarchyBoundsListener(boundsListener);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:39,代码来源:BasicHeaderUI.java


示例5: installListeners

import java.awt.event.HierarchyBoundsAdapter; //导入依赖的package包/类
protected void installListeners(final JXHeader header) {
    propListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
        }
    };
    boundsListener = new HierarchyBoundsAdapter() {
        @Override
        public void ancestorResized(HierarchyEvent e) {
            if (header == e.getComponent()) {
                View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
                // view might get lost on LAF change ...
                if (v == null) {
                    descriptionPane.putClientProperty(BasicHTML.propertyKey, 
                            descriptionPane.getMultiLineSupport().createView(descriptionPane));
                    v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
                }
                if (v != null) {
                    Container tla = header.getTopLevelAncestor();
                    if (tla == null) {
                        tla = header.getParent();
                        while (tla.getParent() != null) {
                            tla = tla.getParent();
                        }
                    }
                    int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
                    int w = Math.min(tla.getWidth(), header.getParent().getWidth());
                    // 35 = description pane insets, TODO: obtain dynamically
                    w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
                    v.setSize(w, h);
                    descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
                }
            }
        }};
    header.addPropertyChangeListener(propListener);
    header.addHierarchyBoundsListener(boundsListener);
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:38,代码来源:BasicHeaderUI.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExternalMetadataFeature类代码示例发布时间:2022-05-23
下一篇:
Java BarChart类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap