⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insetpanel.java

📁 Java邮箱
💻 JAVA
字号:
package Email.awt;


import java.awt.*;
import java.awt.event.*;

public class InsetPanel extends Panel {
  private Panel center;

  public Component add(Component comp) {
    if ( center.getLayout() instanceof BorderLayout )
      return center.add("Center",comp);
    return center.add(comp);
  }

  public Component add(String name, Component comp) { 
    return center.add(name, comp); 
    }

  public Component add(Component comp, int index) {
    return center.add(comp,index); 
    }

  public void add(Component comp, Object constraints) {
    center.add(comp,constraints); 
    }

  public void add(Component comp, Object constraints, int index) { 
    center.add(comp,constraints,index); 
    }

  public void addContainerListner(ContainerListener l) { 
    center.addContainerListener(l); 
    }

  public void removeContainerListener(ContainerListener l) { 
    center.removeContainerListener(l); 
    }

  public void remove(int index) { 
    center.remove(index); 
    }

  public void remove(Component comp) { 
    center.remove(comp); 
    }

  public void removeAll() { 
    center.removeAll(); 
    }

  public LayoutManager getLayout() { 
    return center.getLayout(); 
    }

  public void setLayout(LayoutManager mgr) {
    if (center == null)
      super.setLayout(mgr);
    else
      center.setLayout(mgr);
    }

  private void init(int top, int left, int bottom, int right) {
    super.setLayout( new BorderLayout() );
    super.add( "East",new FixedFill(left,50) );
    super.add( "North",new FixedFill(50,top) );
    super.add( "West",new FixedFill(right,50) );
    super.add( "South",new FixedFill(bottom,50) );
    center = new Panel();
    center.setLayout( new BorderLayout() );
    super.add( "Center",center );
    }

  public InsetPanel(int top, int left, int bottom, int right) { 
    init( top,left,bottom,right ); 
    }

  public InsetPanel(Insets i) { 
    init( i.top,i.left,i.bottom,i.right );
    }

  public InsetPanel(int top, int left, int bottom, int right, Panel p) {
    init( top,left,bottom,right );
    add(p);
    }

/*
  public static void main(String[] args) {
    InsetPanel p = new InsetPanel(10,10,10,10);
    p.add(new OutlinedPanel("Folders"));
    new WinFrame("InsetPanel Demo",p)
      .appMainWindow().setVisible(true);
  }
*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -