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

📄 propertytest.java~32~

📁 利用jtable,设计属性编辑器程序设计实例。包括jtabe 编辑风格自定义
💻 JAVA~32~
字号:
package propertyproj;

import javax.swing.*;
import java.awt.*;

public class PropertyTest
    extends JFrame {
  BorderLayout borderLayout1 = new BorderLayout();

  public PropertyTest() {

    super("属性编辑器测试");
    try {

      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    this.getContentPane().setLayout(borderLayout1);
    PropertyEditor.PropertyEditorModel ptm = new PropertyEditor().new
        PropertyEditorModel();
    PropertyEditor propertyEditor = new PropertyEditor(ptm);
    propertyEditor.setForeground(Color.blue);
    propertyEditor.createLongEditorRenderer();
    propertyEditor.createBooleanEditorRender();
    propertyEditor.addProperty("单位代码", (Long)null);
    propertyEditor.addProperty("单位名称", (Long)null);
    propertyEditor.addProperty("系统启用", (Boolean)null);

    ptm.fireTableStructureChanged();
    JScrollPane jscrollPane = new JScrollPane(propertyEditor,
                                              JScrollPane.
                                              VERTICAL_SCROLLBAR_ALWAYS,
                                              JScrollPane.
                                              HORIZONTAL_SCROLLBAR_ALWAYS);
    this.getContentPane().add(jscrollPane);
    this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
    this.setVisible(true);
  }

  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    }
    catch (UnsupportedLookAndFeelException ex) {
    }
    catch (IllegalAccessException ex) {
    }
    catch (InstantiationException ex) {
    }
    catch (ClassNotFoundException ex) {
    }
    PropertyTest propertyTest = new PropertyTest();

  }
}

⌨️ 快捷键说明

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