本文整理汇总了Java中javax.swing.JLayeredPane.getLayer方法的典型用法代码示例。如果您正苦于以下问题:Java JLayeredPane.getLayer方法的具体用法?Java JLayeredPane.getLayer怎么用?Java JLayeredPane.getLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLayeredPane
的用法示例。
在下文中一共展示了JLayeredPane.getLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import javax.swing.JLayeredPane; //导入方法依赖的package包/类
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
// Ignore the children of a JScrollPane.
// Pending(milne) find a better way to do this.
if (oldInstance instanceof javax.swing.JScrollPane) {
return;
}
java.awt.Container oldC = (java.awt.Container)oldInstance;
java.awt.Component[] oldChildren = oldC.getComponents();
java.awt.Container newC = (java.awt.Container)newInstance;
java.awt.Component[] newChildren = (newC == null) ? new java.awt.Component[0] : newC.getComponents();
BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
? ( BorderLayout )oldC.getLayout()
: null;
JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
? (JLayeredPane) oldInstance
: null;
// Pending. Assume all the new children are unaltered.
for(int i = newChildren.length; i < oldChildren.length; i++) {
Object[] args = ( layout != null )
? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
: (oldLayeredPane != null)
? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
: new Object[] {oldChildren[i]};
invokeStatement(oldInstance, "add", args, out);
}
}