小编spr*_*orn的帖子

仅在第一页上打印页脚

我想只在jasper报告的第一页上出现一个页脚.

在搜索论坛后,我已经看到这个问题,并在这里多次不正确地回答.正如许多人所建议的那样,我试图在页脚带上表达时打印一个打印,以防止它在不是第一页时打印:

new Boolean($V{PAGE_NUMBER}.intValue() == 1)
Run Code Online (Sandbox Code Playgroud)

但这不起作用.结果是页面页脚的所有属性都没有打印,但页脚块仍然打印并占用空间,阻止细节使用整个页面.实际上,您在第一页上有一个页脚,在每个后续页面上都有一个没有数据的页脚.

有没有人知道如何实际使这项工作?

jasper-reports footer ireport

9
推荐指数
1
解决办法
1万
查看次数

在悬停时激活JMenuBar

在首次单击JMenuBar之前,JMenuBar不会开始将JMenuItem显示为已选中或显示JMenu弹出窗口.单击JMenuBar中的某个位置后,所有这些项都会响应鼠标悬停.

我想绕过所需的初始点击,并在鼠标悬停时自动激活它.有没有办法做到这一点?

java swing mouse-listeners jmenubar

7
推荐指数
1
解决办法
3816
查看次数

SpringBootTest、Testcontainers、容器启动 - 容器启动后才能获取映射端口

我正在使用 docker/testcontainers 运行 postgresql 数据库进行测试。我已经有效地完成了单元测试,即测试数据库访问。然而,我现在已经将 springboot 测试纳入其中,这样我就可以使用嵌入式 Web 服务进行测试,但我遇到了问题。

问题似乎是在容器启动之前请求 dataSource bean。

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/myproject/integrationtests/IntegrationDataService.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Mapped port can only be obtained after the container is started
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Mapped port can …
Run Code Online (Sandbox Code Playgroud)

junit spring-boot testcontainers

5
推荐指数
1
解决办法
1万
查看次数

jcombobox作为单元格编辑器java.awt.IllegalComponentStateException:必须在屏幕上显示组件以确定其位置

我使用自定义JComboBox作为JTable中的单元格编辑器.当用户使用键盘控件进入单元格时,它会尝试打开弹出窗口.这会导致以下错误:

java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1964)
    at java.awt.Component.getLocationOnScreen(Component.java:1938)
    at javax.swing.JPopupMenu.show(JPopupMenu.java:887)
    at javax.swing.plaf.basic.BasicComboPopup.show(BasicComboPopup.java:191)
    at javax.swing.plaf.basic.BasicComboBoxUI.setPopupVisible(BasicComboBoxUI.java:859)
    at javax.swing.JComboBox.setPopupVisible(JComboBox.java:796)
Run Code Online (Sandbox Code Playgroud)

我看过一些文章说这是一个已知问题,解决方法是设置:

    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
Run Code Online (Sandbox Code Playgroud)

但这并没有帮助.无论如何这应该做什么?

我读过的关于这个的所有主题和文章对于问题的本质都非常模糊.

有没有人对这个问题出现的原因有什么了解?我的组合框是非常自定义的,所以它有助于理解问题的基础,所以我可以修复代码.

这是在捕获的组合框上的焦点获取事件上触发并调用setPopupVisible(true);

 public void focusGained(java.awt.event.FocusEvent e)
 {
        //if focus is gained then make sure we show the popup if it is suppose to be visible
            setPopupVisible(true);
        //and highlight the selected text if any
        comboTextEditor.setCaretPosition(comboTextEditor.getText().length());
        comboTextEditor.moveCaretPosition(0);
 }
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我在Java 1.7_40中获得与Java 1.6_45相同的结果

完整堆栈跟踪:

Exception in thread "AWT-EventQueue-1" java.awt.IllegalComponentStateException: component must be showing on …
Run Code Online (Sandbox Code Playgroud)

java swing jtable jcombobox illegalstateexception

4
推荐指数
1
解决办法
4657
查看次数

打开htaccess密码保护页面,没有提示

我在网站上有一个通过htaccess受密码保护的目录.我希望能够通过我的应用程序打开此网页,而无需用户输入密码,而是以编程方式进行.

例如,有没有办法可以在URL中嵌入登录信息?例如http://www.mypage.com/page.html?htaccesspassword=asdasdas

谢谢!

.htaccess .htpasswd

3
推荐指数
1
解决办法
3863
查看次数

javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure

我在具有Java 1.7.0_67的Linux服务器上使用APR 1.1.33和Tomcat 7.065。

多年来,我的应用程序一直很高兴通过SSL连接到第三方站点。第三方签发了新证书。第三部分站点是:https : //its.changehealthcare.com/

我下载了.cer文件并进行了keytool导入:

$JAVA_HOME/bin/keytool -import -trustcacerts -keystore cacerts  -noprompt -file path\to\certificate.cer
Run Code Online (Sandbox Code Playgroud)

当我做一个keytool列表时,我得到:

Owner: CN=its.changehealthcare.com, OU=COMODO EV SSL, OU=Web Operations, O=Change Healthcare Inc, STREET=3055 Lebanon Pike, L=Nashville, ST=TN, OID.2.5.4.17=37221, C=US, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.2=Delaware, OID.1.3.6.1.4.1.311.60.2.1.3=US, SERIALNUMBER=4237148
  DNSName: its.changehealthcare.com
  DNSName: www.its.changehealthcare.com
Run Code Online (Sandbox Code Playgroud)

但我仍然收到ssl握手错误。

我的tomcat ssl配置看起来像这样:

<Connector protocol="org.apache.coyote.http11.Http11AprProtocol"
           port="8443" minSpareThreads="5" maxSpareThreads="75"
           enableLookups="true" disableUploadTimeout="true"
           acceptCount="100"  maxThreads="200"
           scheme="https" secure="true" SSLEnabled="true"
           clientAuth="false"
SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"
        SSLCertificateFile="mycert.crt"
        SSLCertificateKeyFile="mykey.key"
        SSLCertificateChainFile="gd_bundle-g2-g1.crt"
        keyAlias="tomcat"
        SSLCipherSuite="ALL:!ADH:!RC4:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXPORT:!DHE:!EDH:!ECDH"
           compression="on" compressableMimeType="text/xml"
SSLHonorCipherOrder="true"
/>
Run Code Online (Sandbox Code Playgroud)

我很困惑。任何见解表示赞赏。这是在-Djavax.net.debug = all上调试时完整读取的错误:

INFO: Server startup in 26519 ms
keyStore …
Run Code Online (Sandbox Code Playgroud)

java ssl ssl-certificate sslhandshakeexception

3
推荐指数
1
解决办法
8901
查看次数

JMenu子菜单小箭头图标指示符

有谁知道如何控制JMenu子菜单上出现的小箭头的显示?

我可以改变吗?我可以禁用它吗?我可以移动吗?

另外,我注意到,仅当它们是其他JMenu的子菜单时,此箭头才出现在顶级JMenus上。由于我在JMenuBar的根目录上附加了JMenuItem和JMenu的混合,因此这种不一致使我感到烦恼,因此我希望它能始终表明这一点。无论如何也要这样做?

谢谢!

java swing submenu jmenubar jmenu

0
推荐指数
1
解决办法
3631
查看次数