gpt4 book ai didi

java - JComponent 无法初始化 : java. lang.IllegalArgumentException:宽度和高度必须 >= 0

转载 作者:行者123 更新时间:2023-12-01 18:07:42 26 4
gpt4 key购买 nike

我有一个使用 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)

最佳答案

它最终以某种方式与 Windows 用户权限/设置相关。

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

这两个用户都是管理员用户,因此我必须进行更多研究才能找到用户权限的差异以及它们如何影响此问题。

关于java - JComponent 无法初始化 : java. lang.IllegalArgumentException:宽度和高度必须 >= 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60531015/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com