SkillAgentSearch skills...

ReflectionUI

Java reflection-based GUI builder/generator

Install / Use

/learn @dotxyteam/ReflectionUI
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

ReflectionUI

ExamplesImage

Overview

ReflectionUI is a free (open source) Java GUI builder/generator library allowing to build Reflected Graphical User Interfaces (based on reflection).

The generation of the GUI (graphical user interface) requires no other information that the object itself. Its structure is discovered at run-time through Java reflection.The generated GUI can be customized in a non-intrusive way by overriding some key methods of the generator objects.

CustomUI is a sub-project of ReflectionUI providing a GUI builder. It actually allows WYSIWYG advanced customizations of user interfaces generated by ReflectionUI.

Demonstration Video (More videos below)

Use Cases

  • Developing a project GUI by generating and customizing it
  • Prototyping a GUI
  • Exploring a library capabilities quickly through a generated GUI

Advantages

  • Instant prototyping
  • Reduced cost of user interface development and testing
  • Code injection simplified for cross-cutting concerns (logs, usage statistics, etc.)

Features

(ReflectionUI)

  • On the fly GUI generation
  • Controls generated for public fields, methods, get/set properties, …
  • Automatic undo/redo management
  • Automatic copy/cut/paste management
  • Dynamic menus
  • Field validation
  • On-line help management
  • Elegant display for exceptions
  • Non-intrusive customizations
  • Generator pluggable to any meta-data model

(CustomUI)

  • WYSIWYG GUI customization
  • Various configurable controls (forms, sliders, spinners, tables, trees, html panes, …)
  • Grouping and categorizing controls
  • Flexible layout management
  • Skinning
  • Icons
  • Menus (standard and custom items)
  • Extensible (control plugins)
  • Support for teamwork

Differences compared to classic GUI builders

| | CustomUI (ReflectionUI) | Classical GUI builder | |--------------------------------------------------------------------|-----------------------------------------------|------------------------------------| | GUI structure | generated, customized | designed, connected to the data | | GUI code | mostly interpreted (XML-based customizations) | generated and/or interpreted | | Standard features (copy/cut/paste, undo/redo, open/save file, ...) | enabled/disabled | developed | | GUI update | automatic | manual | | GUI maintenance | optional | mandatory | | GUI re-usability | reusable plugins can be developed | reusable controls can be developed |

Requirements

Tested on Java 8 and 21.

Licensing

ReflectionUI and CustomUI libraries are distributed under this license.

Getting started

  • Use Maven (see below)
  • Or Get the archive (zip) file from the download area
    • Extract it
    • Add the jars from the 'bin' directory to your classpath
  • Run the class: xy.reflect.ui.control.swing.customizer.SwingCustomizer

Download

Maven Dependencies

ReflectionUI:

<dependency>
<groupId>com.github.dotxyteam</groupId>
<artifactId>reflection-ui</artifactId>
<version>LATEST</version>
</dependency>

CustomUI:

<dependency>
<groupId>com.github.dotxyteam</groupId>
<artifactId>custom-ui</artifactId>
<version>LATEST</version>
</dependency>

Documentation

  • Read the user guide (below)
  • Explore the examples ('examples' directory in the distribution folder)

User guide

Basic Usage

SwingCustomizer.getDefault().openObjectFrame(myObject);

Disable the design mode by setting this system property:

-Dxy.reflect.ui.infoCustomizationsToolsHidden=true

Default Operation

  • Only public fields and methods are considered.
  • A public getter (public <Type> (get|is|has)Something()) and its eventual associated public setter (public void setSomething(<Type> object)) are considered as a unique public field (public <Type> something).
  • A final field or a getter without an associated setter are considered as a "get-only" field that may not be editable (depends on the field type).
  • A field control (text component, list view, combo-box, ...) is generated for each field.
  • A button is generated for each method.
  • Field changes can be undone.
  • Method calls invalidate the modification stack and cannot be undone. Note that IMethodInfo.getNextInvocationUndoJob(...) or IMethodInfo.isReadOnly() can be overridden in order to make a method call undoable or harmless for the modification stack.

Architecture

The GUI is generated in 2 steps:

The class information of each object is read and interpreted by the ReflectionUI object. The result is an abstract GUI model: ITypeInfo. Then this abstract GUI model is passed to the engine that will create the various GUI controls displaying the object values: the SwingRenderer.

Class ----------(ReflectionUI)----------> ITypeInfo -----------(SwingRenderer)---------> GUI

Note that the SwingRenderer creates Swing-based GUIs. This is the default renderer but other renderers (JavaFX-based, SWT-based, ...) could be developed and plugged.

IMPORTANT: Swing is not (and will not be) obsolete even if JavaFX seems to be its replacement. Since 2020 we know that Swing might even survive longer than JavaFX. From the official Oracle Java Client Roadmap:

Oracle will continue developing Swing and AWT across all supported releases as a core Java SE technology.

...

Oracle will continue to support JavaFX with new fixes for Java SE 8 until at least March 2025.

The ReflectionUI interpretation algorithm is based on the Java language coding standards (ex: getter/setter interpreted as a unique property, ...).

Unfortunately, even when these standards are respected, there might not be enough information in every class definition to provide a GUI that looks and behaves exactly as expected. This is why the ReflectionUI interpretation process will often need to be customized. This is where the InfoProxyFactory comes into play. It is not essential to the ReflectionUI customization, but it makes it easier by allowing to specify conveniently a proxy for each ITypeInfo object.

CustomUI provides the customizations editor by using the following classes:

  • InfoCustomizations: declarative customizations persisted in XML.
  • InfoCustomizationsFactory: subclass of InfoProxyFactory generating proxies according to its InfoCustomizations instance.
  • CustomizedUI: ReflectionUI subclass compatible with InfoCustomizationsFactory
  • SwingCustomizer: subclass of SwingRenderer compatible with CustomizedUI

| | (CustomizedUI) | | (InfoCustomizationsFactory) | | (SwingCustomizer) | | |:-----:|:--------------:|:---------:|:---------------------------:|:-----------------:|:-----------------:|-----| | | | | | | | | | | | | | ∇ | | ∇ | | ∇ | | | | (ReflectionUI) | | (InfoProxyFactory) | | (SwingRenderer) | | | Class | ——————–> | ITypeInfo | ——————–> | ITypeInfo (proxy) | ——————–> | GUI | | | | | ^ | | | | | | | | |_______ | ____| | | |

The GUI builder Online Documenation

Note that since the version 4.6.0 the GUI builder has an online documentation. To view it click on the question mark buttons available on any customization editor window.

Demonstration Videos (and covered subjects)

https://youtu.be/E5gHqU6LRPQ

  • Virtual fields
  • Windows background image
  • Buttons background image
  • Title bar removal

https://youtu.be/y4hb8Zkql_A

  • Enumeration
  • Side menu
  • Method presets
  • Converting fields to method parameters

https://youtu.be/36E7k8vAgeY

  • Menus
  • Windows background image

https://youtu.be/db6iGuYqzto

  • Styled texts
  • Windows background image
  • Buttons background image

https://youtu.be/5EAa0Q09KV0

  • Toggle buttons
  • Form background
  • Button icon

https://youtu.be/x17wshiS1Wg

  • Side menus
  • Type conversion
  • List columns

https://youtu.be/o1VHdLp12eg

  • Form background image
  • Styled texts
  • Windows background color
  • Buttons background color

https://youtu.be/qNI_fJkF6oY

  • List colums
  • Image banner
  • Button icon

https://youtu.be/BZnHu_Y-mg4

  • Field periodic auto-update
  • Styled texts
  • Windows background image

https://youtu.be/7bXQGf1EkS8

  • Getting started
  • Windows colors
  • Buttons colors

https://youtu.be/TK1iH_IXtYo

  • Windows background image
  • Undo management
  • Custom checkbox
  • Shared customizations

https://youtu.be/Pqf_bAEDFYw

  • Multiple lines text
  • Image banner
  • Buttons colors

https://youtu.be/xG4G_n4wFGk

  • Banner
  • Button icon
  • Styled texts

https://youtu.be/HCaohJ7PMlM

  • List details view
  • Side menu
  • Image ban
View on GitHub
GitHub Stars22
CategoryDevelopment
Updated2mo ago
Forks5

Languages

Java

Security Score

75/100

Audited on Jan 2, 2026

No findings