블로그

ej-technologies의 제품 뉴스, 업데이트 및 인사이트입니다.

RSS로 읽어보세요. 이메일로 구독하세요. 에서 팔로우하세요.

Changing the visibility of form components at runtime

2009-05-27
Ingo Kegel 작성
One of the strong points of form screens is that they are displayed by console installers without any further configuration. You don't have to program the user interface twice, once for the GUI and once for the console.

However, it is often necessary to hide certain form components at runtime. For example, a certain form component might only make sense on a specific platform. Until now, you could use the initialization script of the form component to change the visibility like this:

boolean visible = Util.isWindows();
component.setVisible(visible);

This hides the form component unless the operating system is Windows.

However, the drawback of this method is that the console installer does not execute the initialization script of a form component - there is no GUI widget created and so the configurationObject parameter would be null. In the upcoming install4j 4.2.3, we have added a visibility script property that works for both the GUI and the console installer:

Even simpler than the previous initialization script, a simple visibility expression of

Util.isWindows()
(no semicolon at the end to make it an expression rather than a script) hides the form component on non-Windows platforms.
아카이브