> Create an automated regression test for > [JDK-4138746](https://bugs.openjdk.java.net/browse/JDK-4138746) > > Issue: > In the following example (and similarly with other components) you cannot > specify the correct character to underline: > > JLabel label = new JLabel ("Save As..."); > label.setDisplayedMnemonic ('A'); > > The 'A' in 'As' should be underlined (that's the intention at least), but the > 'a' in 'Save' is what gets underlined. > > The problem (aside from the lack of an API to specify exactly what should be > underlined) is in the javax.swing.plaf.basic.BasicGraphicUtils drawString > method which underlines the first character (upper OR lowercase) that matches > the mnemonic character. > > Fix: > A new property "displayedMnemonicIndex" is introduced > in classes AbstractButton and JLabel. It tells which > character to underline. So for example to underline > the capital 'A' in 'Save As', one should call: > setMnemonic('A'); > setDisplayedMnemonicIndex(5); > > Testing: > Tested in Mach5 10 times per platform and got all Pass.
Manukumar V S has updated the pull request incrementally with one additional commit since the last revision: Fixed one wrong conditional check: removed ! operator from 'if (focusGainedLatch.await(3, TimeUnit.SECONDS))' ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8093/files - new: https://git.openjdk.java.net/jdk/pull/8093/files/9c951603..40bbfaac Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8093&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8093&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8093.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8093/head:pull/8093 PR: https://git.openjdk.java.net/jdk/pull/8093