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

📄 comptitledpane.java

📁 Swing Examples Sources Codes 里包含了Java Web开发的一些实例代码
💻 JAVA
字号:
/* (swing1.1.1) */package jp.gr.java_conf.tame.swing.panel;import java.awt.*;import javax.swing.*;import javax.swing.border.*;import jp.gr.java_conf.tame.swing.border.*;  /** * @version 1.0 08/12/99 */public class CompTitledPane extends JPanel {  protected CompTitledBorder border;  protected JComponent component;  protected JPanel panel;  protected boolean transmittingAllowed;  protected StateTransmitter transmitter;    public CompTitledPane() {    this(new JLabel("Title"));    // debug    // JLabel label = (JLabel)getTitleComponent();    // label.setOpaque(true);    // label.setBackground(Color.yellow);  }    public CompTitledPane(JComponent component) {    this.component = component;    border = new CompTitledBorder(component);    setBorder(border);    panel = new JPanel();    setLayout(null);    add(component);    add(panel);     transmittingAllowed = false;    transmitter = null;  }    public JComponent getTitleComponent() {    return component;  }    public void setTitleComponent(JComponent newComponent) {    remove(component);    add(newComponent);    border.setTitleComponent(newComponent);    component = newComponent;  }    public JPanel getContentPane() {    return panel;  }    public void doLayout() {    Insets insets = getInsets();    Rectangle rect = getBounds();    rect.x = 0;    rect.y = 0;    Rectangle compR = border.getComponentRect(rect,insets);    component.setBounds(compR);    rect.x += insets.left;    rect.y += insets.top;    rect.width  -= insets.left + insets.right;    rect.height -= insets.top  + insets.bottom;    panel.setBounds(rect);     }    public void setTransmittingAllowed(boolean enable) {    transmittingAllowed = enable;  }    public boolean getTransmittingAllowed() {    return transmittingAllowed;  }    public void setTransmitter(StateTransmitter transmitter) {    this.transmitter = transmitter;  }    public StateTransmitter getTransmitter() {    return transmitter;  }    public void setEnabled(boolean enable) {    super.setEnabled(enable);    if (transmittingAllowed && transmitter != null) {      transmitter.setChildrenEnabled(enable);    }  }     }

⌨️ 快捷键说明

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