简体   繁体   中英

Java Swing Properties Editor

Is there an existing library that automatically creates a Java Swing form from a Properties (or Properties-like) object? ie shows 2 columns, as many rows as there are properties, properly justified Property names on the left, JTextFields for the values on the right.

I do not have access to the property names (or expected types) at compile time.

In addition, the solution must allow some value fields to be set read-only after construction.

A great solution would :

  • allow some property values to be specified as sensitive, requiring a JPasswordField
  • provide input format checking, eg against an object type (such as URL, Double, etc)

or by type-sensitive so that appropriate widgets (or buttons to bring up appropriate widgets) are used instead of JTextField for standard object types. eg JFileChooser for properties expected to be of a File type, SwingX Colour/Date selection, numerical format checking)

Getting into type-specific properties starts to sound like JavaBeans. I'd rather not go down the JavaBeans route unless there is a really easy - not a big framework - solution for this for an object that is a Javabean.

(I already know how to manually do this and could write a simple implementation myself that ignores sensitivity/type information - anyone answering along those lines will be shot down! I only want to know if such a beast already exists, preferably in a well maintained library)

UPDATE: related to Java Beans - creating an inspector window

No such thing exists. However, I wrote a rudimentary feature (and released it OSS) for https://github.com/fommil/zibaldone

We use JIDE , which not open-source. If you don't mind that, take their Property Grid for a spin - it seem to match all your requirements.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM