下面列出了javax.swing.JLayeredPane#remove ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
}
protected void installTitlePane(JRootPane root, LuckTitlePanel titlePane, Window window)
{
JLayeredPane layeredPane = root.getLayeredPane();
JComponent oldTitlePane = getTitlePane();
if (oldTitlePane != null)
{
oldTitlePane.setVisible(false);
layeredPane.remove(oldTitlePane);
}
if (titlePane != null)
{
titlePane.setOpaque(true);
layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
titlePane.setVisible(true);
}
this.titlePane = titlePane;
}
/**
* Sets the window title pane -- the JComponent used to provide a plaf a
* way to override the native operating system's window title pane with
* one whose look and feel are controlled by the plaf. The plaf creates
* and sets this value; the default is null, implying a native operating
* system window title pane.
*
* @param root the root
* @param titlePane the title pane
*/
private void setTitlePane(JRootPane root, JComponent titlePane)
{
JLayeredPane layeredPane = root.getLayeredPane();
JComponent oldTitlePane = getTitlePane();
if (oldTitlePane != null)
{
oldTitlePane.setVisible(false);
layeredPane.remove(oldTitlePane);
}
if (titlePane != null)
{
layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
titlePane.setVisible(true);
}
this.titlePane = titlePane;
}
/**
* Sets the window title pane -- the JComponent used to provide a plaf a way
* to override the native operating system's window title pane with one
* whose look and feel are controlled by the plaf. The plaf creates and sets
* this value; the default is null, implying a native operating system
* window title pane.
*
* @param root content the <code>JComponent</code> to use for the
* window title pane.
* @param titlePane the SeaGlassTitlePane.
*/
private void setTitlePane(JRootPane root, JComponent titlePane) {
JLayeredPane layeredPane = root.getLayeredPane();
JComponent oldTitlePane = getTitlePane();
if (oldTitlePane != null) {
oldTitlePane.setVisible(false);
layeredPane.remove(oldTitlePane);
}
if (titlePane != null) {
layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
titlePane.setVisible(true);
}
this.titlePane = titlePane;
}
public void close() {
Preconditions.checkState(SwingUtilities.isEventDispatchThread(), "Must be on the EDT");
JLayeredPane layeredPane = Panels.getApplication().getLayeredPane();
Component[] components = layeredPane.getComponents();
if (components.length == 4 || components.length == 6) {
layeredPane.remove(0);
}
if (components.length > 2 && components.length < 7) {
layeredPane.remove(1);
layeredPane.remove(0);
}
Panels.getApplication().validate();
Panels.getApplication().repaint();
}
protected void setTitlePane( FlatTitlePane newTitlePane ) {
JLayeredPane layeredPane = rootPane.getLayeredPane();
if( titlePane != null )
layeredPane.remove( titlePane );
if( newTitlePane != null )
layeredPane.add( newTitlePane, TITLE_PANE_LAYER );
titlePane = newTitlePane;
}
private void removeProgressIndicator() {
if (lastLayeredPane == null || progressIndicator == null) {
return;
}
progressIndicator.setVisible(false);
JLayeredPane lp = lastLayeredPane;
lp.remove(progressIndicator);
lp.repaint();
progressIndicator = null;
}
/**
* Remove a sticky window from the editor.
* @param window the JComponent to remove
*/
public void removeWindow(JComponent window) {
Container container = jtc.getParent();
if(container instanceof JLayeredPane) {
JLayeredPane pane = (JLayeredPane) container;
pane.remove(window);
pane.repaint(window.getBounds());
}
}