Prevent Java Swing JTable losing focus when invalid data entered

We currently have a focus problem with a JTable / JTextEditor in java swing. The JTable has a custom cell editor which is a JTextField . The issue is when a cell is being edited and contains invalid data, and the user clicks on a JButton , the text field will stop editing and the JButton actionPerformed (clicked) is called. The JTable#setValueAt handles validation so if the data in the JTextF

防止Java Swing JTable在输入无效数据时失去焦点

我们目前在java swing中有一个关于JTable / JTextEditor的焦点问题。 JTable有一个定制的单元格编辑器,它是一个JTextField 。 问题是当一个单元格被编辑并且包含无效数据,并且用户点击JButton ,文本字段将停止编辑,并调用JButton actionPerformed(点击)。 JTable#setValueAt处理验证,因此如果JTextField的数据无效,则不会更新基础TableModel 。 理想情况下,我们不想让JButton发生点击。 焦点应该保留在JTable或J

FocusEvent doesn't get the last value of JFormattedTextField, How I can get it?

I have two JFormattedTextField objects on my JFrame object. I want a basic Math (addition) by the values of these JFormattedTextField objects. I want it happen when focus lost either the first or the second textfield. But when " focusLost() ", event doesn't get the last value, it gets the previous value. For example; tf1 has 0 and tf2 has 0 at first. I write 2 to tf1 , and wh

FocusEvent没有得到JFormattedTextField的最后一个值,我怎么能得到它?

我的JFrame对象上有两个JFormattedTextField对象。 我想通过这些JFormattedTextField对象的值来获得基本的数学(加法)。 当焦点丢失第一个或第二个文本字段时,我希望它发生。 但是,当“ focusLost() ”事件没有获得最后一个值时,它会获得前一个值。 例如; tf1有0, tf2有0。 我写2到tf1 ,当我改变它们中的任何一个时, focusLost() ,result( tf1+tf2 )变为0时,结果变成2(前一个值) 我如何获得focusLost的最后

selenium webdriver

I have implement two scenario outlines in one feature file at cucumber, and also wrote script that new browser initiate in @After Junit command when my test case fail. @After public void teardownpatientregis(Scenario s) throws IOException, InterruptedException { if(s.isFailed()) { Screenshots.getscreenshot(s); driver.quit(); initialize(failbrowser); url(fa

硒webdriver

我在黄瓜的一个特性文件中实现了两个场景轮廓,并且在我的测试用例失败时,还在@After Junit命令中编写了新的浏览器启动的脚本。 @After public void teardownpatientregis(Scenario s) throws IOException, InterruptedException { if(s.isFailed()) { Screenshots.getscreenshot(s); driver.quit(); initialize(failbrowser); url(failurl); Logintestpage.getusername(failu

Selenium and Parallelized JUnit

The setup So, basically i am trying to achieve Selenium tests that run in parallel using JUnit. For that i have found this JUnit runner. It works really well, i like it alot. However, i am running into problems regarding the handling of WebDriver instances. What i want Each WebDriver element should be created once for every class before @Test methods are executed. Logically, i could

硒和并行化的JUnit

设置 所以,基本上我试图实现使用JUnit并行运行的Selenium测试。 为此我找到了这个JUnit亚军。 它工作得很好,我非常喜欢它。 但是,我遇到了有关处理WebDriver实例的问题。 我想要的是 在执行@Test方法之前,应该为每个类创建一个WebDriver元素。 从逻辑上讲,我可以使用这个类的构造函数。 其实这是我的测试相当的要求,因为我需要使用@Parameters以便我可以相应地创建WebDriver实例(Chrome,FF,IE ...)。

test cases for login page using selenium ; java and Eclipse IDE

I am new to selenium webdriver, java (junit) and eclipse IDE. Please help me to provide all the test cases for the login page. I have managed to write one test case in the test suite in eclipse IDE using selenium and Junit. for your reference the two classes are: import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner

使用硒登录页面的测试用例; java和Eclipse IDE

我是新的selenium webdriver,java(junit)和eclipse IDE。 请帮助我提供登录页面的所有测试用例。 我已经设法使用selenium和Junit在eclipse IDE中的测试套件中编写一个测试用例。 供您参考的两个课程是: import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; public class TestSuite1 extends TestCase { public static Test

How do I rerun Selenium 2.0 (webdriver) tests on the same browser?

I am trying to use Selenium 2.0 (Webdriver) to implement a series of tests. Before these tests can run, I have to login into the application. Since the application is not my 'own' (testing api-built functionality), each test should not be logging into my application to run. I would prefer to do the following: Connect my webdriver tests to my open Firefox browser (already loggedin)

如何在同一浏览器上重新运行Selenium 2.0(webdriver)测试?

我正在尝试使用Selenium 2.0(Webdriver)来执行一系列测试。 在这些测试运行之前,我必须登录到应用程序。 由于该应用程序不是我自己的(测试api-built功能),每个测试都不应该登录到我的应用程序中运行。 我宁愿做以下事情: 将我的webdriver测试连接到我打开的Firefox浏览器(已经登录) 使用相同的浏览器运行我的webdriver项目。 我知道Selenium通常会将会话ID分配给其浏览器。 然而,Selenium 2.0驱动程序的当

Getting number of rows inserted on IBM DB2 V6R1 (AS400) through JBDC

We migrated recently to newer V6R1 version of DB2 on AS400, we are using Spring framework (v. 2.5.6.) to communicate with the database. We are calling Spring's NamedParameterJdbcTemplate.update() method to insert new rows, this method should return number of inserted rows, what is not happening (we got zero back as a result) although row is being inserted regularly. We concluded that if th

获取通过JBDC在IBM DB2 V6R1(AS400)上插入的行数

我们最近迁移到了AS400上更新的V6R1版本的DB2,我们使用Spring框架(v.2.5.6)与数据库进行通信。 我们调用Spring的NamedParameterJdbcTemplate.update()方法来插入新的行,这个方法应该返回插入行的数量,没有发生什么(我们得到的结果为零),尽管定期插入行。 我们的结论是,如果插入语句中没有主键列,则一切正常,所以当PK列是自动增量时没有问题,但在某些情况下,我们必须插入PK值,然后我们必须以某种方式应对定期插

How to know whether a shutdown is currently in progress?

In Tomcat, when the server is being shut down, it tries to set all static variables in classes it knows of to null. By touching these classes, their static initializers are run, which can result in an endless loop for some of our legacy classes which have massive static initializers . Is there an elegant way to detect whether a shutdown is currently in progress? We could then check at the top

如何知道关机是否正在进行?

在Tomcat中,当服务器关闭时,它会尝试将它所知道的类中的所有静态变量设置为null。 通过触摸这些类,它们的静态初始化器就会运行,这可能会导致我们的一些具有大量静态初始化器的遗留类的无限循环。 有没有一种优雅的方式来检测关机是否正在进行? 然后我们可以检查静态初始化器的顶部是否处于关闭模式,然后忽略初始化。 我们发现似乎工作的唯一方式是优雅的: try{ Thread hook = new Thread(); Runt

Making each test method run in its own instance of a test class with TestNG?

So I thought the following code would run fine in TestNG, although it doesn't: public class Tests { int i = 0; @Test public void testA() { Assert.assertEquals(0, i); ++i; } @Test public void testB() { Assert.assertEquals(0, i); ++i; } } Is there a way to make TestNG fire up a new Tests class for each test method? 常见的解决方案

使用TestNG让每个测试方法都在其自己的测试类实例中运行?

所以我认为下面的代码可以在TestNG中正常运行,但它不会: public class Tests { int i = 0; @Test public void testA() { Assert.assertEquals(0, i); ++i; } @Test public void testB() { Assert.assertEquals(0, i); ++i; } } 有没有办法让TestNG为每个测试方法启动一个新的Tests类? 常见的解决方案是使用@BeforeMethod方法来设置测试状态, @BeforeMethod

Is .NET/Mono or Java the better choice for cross

How much less libraries are there for Mono than for Java? I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of performance (for example, I'm told Java is good for threading, and I hear the runtime code optimization has become very good recently for .NET) real world portability (

.NET / Mono或Java是更好的交叉选择

Mono比Java少了多少库? 我缺乏关于这两种替代方案的概述,但是我对我的下一个项目有很大的自由选择余地。 我正在寻找在这方面的硬技术事实 性能(例如,我被告知Java对线程是有利的,而且我听说最近对于.NET的运行时代码优化已经变得非常好) 真实世界的便携性(它们都意味着便携性,每个Catch-22都是什么?) 工具可用性(CI,构建自动化,调试,IDE) 我特别在寻找你在自己的工作中实际经历的事情,而不是我可以谷