简体   繁体   English

Java Panel不会偶尔完全更新

[英]Java Panel not updating completely occasionally

UPDATE - 21/09/2011 更新 - 2011年9月21日

I have done an initial cursory review of the code and anywhere it looks like it's updating the user interface it's doing it via: 我已经对代码进行了初步粗略的审查,并且它看起来正在通过以下方式更新用户界面:

SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        // code goes here
    }
});

The main updates to the UI happen in a single place which first does the above wrapper and then asks the current visible panel to update itself within that thread, so it should be within the EDT, if I understand it correctly? UI的主要更新发生在一个地方,首先执行上面的包装,然后要求当前可见的面板在该线程内更新自己,所以它应该在EDT中,如果我理解正确的话?

That said, there could be odd places i've missed. 也就是说,我可能会错过一些奇怪的地方。 Currently i'm working with some AspectJ code i've found here: 目前我正在使用我在这里找到的一些AspectJ代码:

http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html

to see whether this will highlight any odd places where it's not doing the right thing. 看看这是否会突出任何奇怪的地方,它没有做正确的事情。

Other than that though, any other thoughts? 除此之外,还有其他想法吗?

Re: transparency assumptions - how would this be manifested? Re:透明度假设 - 如何表现出来? What am I looking for? 我在找什么? While i've done a fair bit of work improving the code, it's largely inherited from previous people so I'm not as intimately familiar with it as might be helpful :) 虽然我已经做了很多工作来改进代码,但它很大程度上是从以前的人那里继承而来的,所以我并不是非常熟悉它可能会有所帮助:)

Re: pasting code fragments - I'd love to, but without narrowing the problem down I can't think of a sensible constrained fragment to post, I literally have no idea where the problem might lie in the code unfortunately. Re:粘贴代码片段 - 我很乐意,但是如果没有缩小问题,我就无法想到一个合理的约束片段,我不知道问题可能存在于代码中。

Thanks for all the responses thus far. 感谢迄今为止的所有回复。

ORIGINAL QUESTION 原始问题

We have an application that is hosted inside a third party system. 我们有一个托管在第三方系统内的应用程序。 Our part is a JPanel that is returned, the host application (Lagan CRM) then embeds that Panel in to their application. 我们的部分是返回的JPanel,主机应用程序(Lagan CRM)然后将该Panel嵌入到他们的应用程序中。

In most cases this is working very well, however occasionally, and in only one implementation that we know of, the panel does not update correctly - it's like something has stopped a part of the panel from being updated. 在大多数情况下,这种情况非常有效,但偶尔也会如此,并且在我们所知的一个实现中,面板无法正确更新 - 就像某些事情已经阻止了面板的一部分被更新。

In the screenshots below, our JPanel is right at the bottom, the top left of it is essentially the "INFO" button. 在下面的屏幕截图中,我们的JPanel位于底部,它的左上角基本上是“INFO”按钮。

Here are a few screenshots demonstrating the issue: 以下是一些演示此问题的屏幕截图:

In this example, the issue is visible around the "Go unavailable" and "Dial" button area. 在此示例中,问题在“Go unavailable”和“Dial”按钮区域可见。 例1

In this example, the issue is in the same general area but it is not the same dimensions, indeed we've not found any commonality in respect of the area / size of the anomoly. 在这个例子中,问题是在相同的一般区域,但它的尺寸不同,实际上我们没有找到关于异常区域/大小的任何共性。 例2

In this example i've done a bit more communication with the user and it seems like what happened was the user prior to the current call the user had the "GO UNAVAILABLE" button shown. 在这个例子中,我与用户进行了更多的沟通,看起来发生的事情是用户在当前呼叫之前用户已经显示“GO UNAVAILABLE”按钮。 They then started a conversation with a caller, which means that the system should then start showing "CONNECT" on the top left, the phone number below and it has the HANGUP button on the right. 然后他们开始与呼叫者进行对话,这意味着系统应该开始在左上方显示“CONNECT”,下面是电话号码,右侧有HANGUP按钮。 As you can see, it's updated only around the outside of it, there's a large block in the middle area that has not been updated at all and is still acting as though they're not on a call. 正如你所看到的,它仅在它的外部更新,在中间区域有一个大块,根本没有更新,并且仍然表现得好像它们没有通话。 Besides looking ugly, it causes problems because there are two or three buttons that should replace the "GO UNAVAILABLE" one and this means that functionality is not accessible. 除了看起来丑陋之外,它还会导致问题,因为有两个或三个按钮应该替换“GO UNAVAILABLE”,这意味着无法访问功能。 例3

I just wanted to show a few examples so that you can see they are different blocks each time, but the basic issue is always the same. 我只是想展示一些例子,这样你每次都可以看到它们是不同的块,但基本问题总是一样的。

Some basic stats: 一些基本统计数据:

  1. Only happens on XP machines. 只在XP机器上发生。

  2. Only happens at one customer site out of about 10-15 sites that use it, but happens on all the machines at that site. 仅发生在使用它的大约10-15个站点中的一个客户站点,但发生在该站点的所有计算机上。

  3. I've asked about windows popping up over the top but the only one they are aware of they have sent me a screenshot for and it doesn't overlap much, certainly nothing remotely similar to these patterns. 我已经问过在顶部弹出的窗口,但是他们唯一知道他们已经给我发了截图,它没有重叠,当然也没有与这些模式类似。

  4. Java 1.5 is being used on this site, getting 100+ workstations updated to 1.6 is not impossible but I would need to have some reasonable indication it's going to help. Java 1.5正在这个网站上使用,将100多个工作站更新到1.6并非不可能,但我需要有一些合理的迹象表明它会有所帮助。

  5. We have many other sites on 1.5 without this issue. 我们在1.5上有很多其他网站没有这个问题。

  6. We've asked about what other software might be running on the machines and to be honest there's very little as they are contact centre agent workstations and tightly bolted down. 我们已经询问了其他软件可能在机器上运行的情况,并且说实话,因为它们是联络中心代理工作站并且紧密连接起来很少。

  7. The panel will right itself once the caller hangs up, but it means the agent effectively loses that call as they can't do anything with it. 一旦呼叫者挂断,面板就会自行调整,但这意味着代理有效地失去了呼叫,因为他们无法对其进行任何操作。 This implies to me it's essentially being blocked from an update rather than being persistently blocked. 这对我来说意味着它基本上被阻止了更新,而不是被持久阻止。

  8. Panel is implemented in SWING, nothing particularly fancy in there. 小组在SWING中实施,在那里没什么特别的花哨。

Any hints, tips, guidance, suggestions for other questions I can get answers to - or even better, solutions :) would be very gratefully received. 任何提示,技巧,指导,其他问题的建议,我可以得到答案 - 甚至更好的解决方案:)将非常感激地收到。

Since I am not able to see the code this answer is more from what you could try to do with the information I have :) 由于我无法看到代码这个答案更多来自你可以尝试用我所拥有的信息:)

  1. Updating a JPanel is tricky if not done from the EDT. 如果没有从EDT完成更新JPanel是很棘手的。 Even when done from the EDT I have had issue when trying to change the entire structure of the JPanel and repainting it. 即使从EDT完成,我在尝试更改JPanel的整个结构并重新绘制它时也遇到了问题。 Instead in these places I have changed to using a JTabbedpane. 相反,在这些地方,我已经改为使用JTabbedpane。 Drop a tab and recreate it. 删除选项卡并重新创建它。 Much more easier to do. 更容易做到。 I am not sure if that will help in this case. 在这种情况下,我不确定这是否会有所帮助。
  2. Next the layout. 接下来的布局。 Are you using any Layout manager? 你在使用任何布局管理器吗? If you have absolutely positioned stuff, then depending on the monitors size and resolution all things will go haywire. 如果你有绝对定位的东西,那么根据显示器的大小和分辨率,一切都会变得混乱。 I would recommend using the JGoodies - Forms layout. 我建议使用JGoodies - Forms布局。 Link here - http://www.jgoodies.com/freeware/forms/ 链接在这里 - http://www.jgoodies.com/freeware/forms/

Sorry couldnt be more of help.. :( 对不起,无法帮助.. :(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM