JComponent初始化失败:java.lang.IllegalArgumentException:宽度和高度必须> = 0

问题描述 投票:0回答:1

我有一个用install4j创建的安装程序,它在包含安装目录选择器组件的屏幕上根本无法显示除背景图像以外的任何内容,据我从堆栈跟踪中得知,该组件基于Swing JComponent 。

该问题仅在特定的Windows Server 2016服务器上发生,并且我从未对其进行过测试的其他环境下发生。在同一屏幕上还有其他组件,但是通过反复试验,我发现一旦禁用/不构建上述JComponent / Directory Chooser,一切都可以正常显示。

这里是堆栈跟踪:

java.lang.IllegalArgumentException: Width and height must be >= 0
    at java.awt.Component.getBaseline(Unknown Source)
    at javax.swing.JComponent.getBaseline(Unknown Source)
    at java.awt.GridBagLayout.calculateBaseline(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at com.install4j.runtime.beans.screens.components.ScrollablePanel.getPreferredScrollableViewportSize(ScrollablePanel.java:13)
    at javax.swing.ViewportLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.ScrollPaneLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.ArrangeGrid(Unknown Source)
    at java.awt.GridBagLayout.arrangeGrid(Unknown Source)
    at java.awt.GridBagLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validate(Unknown Source)
    at java.awt.CardLayout.show(Unknown Source)
    at com.install4j.runtime.wizard.WizardBase.activateScreen(WizardBase.java:138)
    at com.install4j.runtime.wizard.WizardScreen.activate(WizardScreen.java:43)
    at com.install4j.runtime.installer.frontend.ScreenEnvelope.activate(ScreenEnvelope.java:166)
    at com.install4j.runtime.wizard.WizardBase.setScreen(WizardBase.java:122)
    at com.install4j.runtime.installer.frontend.WizardScreenExecutor.execute(WizardScreenExecutor.java:293)
    at com.install4j.runtime.installer.controller.Controller$1.run(Controller.java:155)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
java swing awt install4j jcomponent
1个回答
0
投票
最终以某种方式与Windows用户权限/设置有关。

遇到此问题的安装程序/可执行用户最终以其他Windows管理员用户身份运行可执行文件,并且一切正常。

两个用户都是管理员用户,所以我将不得不深入研究以发现用户权限的差异以及它们如何影响此问题。

© www.soinside.com 2019 - 2024. All rights reserved.