[ 1711539 ] Shortcut Alt-L not working for Lookup on Menu
- Implemented workaround suggested by Bahman.
This commit is contained in:
parent
368fe14f96
commit
d75a3a5f7d
|
@ -19,6 +19,7 @@ package org.compiere.swing;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.text.JTextComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label with Mnemonics interpretation
|
* Label with Mnemonics interpretation
|
||||||
|
@ -212,6 +213,14 @@ public class CLabel extends JLabel
|
||||||
super.setText (text);
|
super.setText (text);
|
||||||
if (text != null && getName() == null)
|
if (text != null && getName() == null)
|
||||||
setName(text);
|
setName(text);
|
||||||
|
//workaround for focus accelerator issue
|
||||||
|
if (getLabelFor() != null && getLabelFor() instanceof JTextComponent)
|
||||||
|
{
|
||||||
|
if ( m_savedMnemonic > 0)
|
||||||
|
((JTextComponent)getLabelFor()).setFocusAccelerator(m_savedMnemonic);
|
||||||
|
else
|
||||||
|
((JTextComponent)getLabelFor()).setFocusAccelerator('\0');
|
||||||
|
}
|
||||||
} // setText
|
} // setText
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,6 +232,7 @@ public class CLabel extends JLabel
|
||||||
*/
|
*/
|
||||||
private String createMnemonic(String text)
|
private String createMnemonic(String text)
|
||||||
{
|
{
|
||||||
|
m_savedMnemonic = 0;
|
||||||
if (text == null)
|
if (text == null)
|
||||||
return text;
|
return text;
|
||||||
int pos = text.indexOf('&');
|
int pos = text.indexOf('&');
|
||||||
|
@ -254,9 +264,22 @@ public class CLabel extends JLabel
|
||||||
*/
|
*/
|
||||||
public void setLabelFor (Component c)
|
public void setLabelFor (Component c)
|
||||||
{
|
{
|
||||||
|
//reset old if any
|
||||||
|
if (getLabelFor() != null && getLabelFor() instanceof JTextComponent)
|
||||||
|
{
|
||||||
|
((JTextComponent)getLabelFor()).setFocusAccelerator('\0');
|
||||||
|
}
|
||||||
super.setLabelFor (c);
|
super.setLabelFor (c);
|
||||||
if (c.getName() == null)
|
if (c.getName() == null)
|
||||||
c.setName(getName());
|
c.setName(getName());
|
||||||
|
//workaround for focus accelerator issue
|
||||||
|
if (c instanceof JTextComponent)
|
||||||
|
{
|
||||||
|
if (m_savedMnemonic > 0)
|
||||||
|
{
|
||||||
|
((JTextComponent)c).setFocusAccelerator(m_savedMnemonic);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // setLabelFor
|
} // setLabelFor
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue