Re: [Ikvm-developers] InputMap problem?
Brought to you by:
jfrijters
|
From: Volker B. <vol...@go...> - 2009-04-02 20:22:03
|
I have look into it. The binding of the Inputmap seems not the problem. If I dispatch the event directly with:
frame.dispatchEvent(new KeyEvent(frame,401,System.currentTimeMillis(),0,KeyEvent.VK_ESCAPE));
then it will receive. That it must be a problem of the event generating. I think this must be a problem of the current
mix of GNU and Sun code. This should be solv if we replace the last part of the GNU code. Because you write that this
has work it can helpful if you can find the CVS version that start the problem.
Volker
_____
Von: Judit Vasko-Szedlar [mailto:jv...@ch...]
Gesendet: Montag, 30. März 2009 20:55
An: Volker Berlin
Cc: ikv...@li...
Betreff: Re: AW: AW: [Ikvm-developers] InputMap problem?
I'm sorry for the trouble. We have started with an InputMap problem, but arrived at a more global key handling problem,
that even the text components do not work. I have sent the previous JTextField code because it seemed easier to
represent the problem with it.
Bellow is a sample code with InputMap:
public class InputMapTest extends JPanel {
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run() {
createAndShowGUI();
}
});
}
private static void createAndShowGUI() {
JFrame frame = new JFrame();
InputMapTest test = new InputMapTest();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(test, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
public InputMapTest() {
setBackground(Color.green);
setOpaque(true);
setPreferredSize(new Dimension(200, 200));
initMap();
}
private void initMap() {
int type = JComponent.WHEN_FOCUSED;
InputMap map = new InputMap() {
public Object get(KeyStroke keyStroke) {
System.out.println(keyStroke.toString());
return super.get(keyStroke);
}
};
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
getActionMap().put("escape", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
System.out.println("Escape");
}
});
map.setParent(this.getInputMap(type));
setFocusable(true);
setFocusTraversalKeysEnabled(false);
setInputMap(type, map);
}
}
Volker Berlin wrote:
Hi,
In your sample I does not see any with InputMap. Soory But I have not understand the problem.
Volker
_____
Von: Judit Vasko-Szedlar [mailto:jv...@ch...]
Gesendet: Montag, 30. März 2009 19:11
An: Volker Berlin
Cc: ikv...@li...
Betreff: Re: AW: [Ikvm-developers] InputMap problem?
Hi Volker,
one more note that we have corrected the text position modifying the IKVM.AWT.Winforms.dll to achieve the text to appear
in the text field.
I hope the code below helps.
Thanks,
Judit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using javax.swing;
using java.awt;
namespace KeyboardTest
{
class Program
{
static void Main(string[] args)
{
JPanel ktest = new JPanel();
ktest.setLayout(new BorderLayout());
ktest.add(new JTextField(), BorderLayout.CENTER);
ktest.setBorder(new javax.swing.border.EmptyBorder(12,12,11,11));
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(ktest, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
}
Volker Berlin wrote:
Hi,
Can you send a simple sample source code that show the problem?
Volker
-----Ursprungliche Nachricht-----
Von: Judit Vasko-Szedlar [mailto:jv...@ch...]
Gesendet: Montag, 30. Marz 2009 11:27
An: ikv...@li...
Betreff: [Ikvm-developers] InputMap problem?
Hi,
we use IKVM to convert Java GUI components to .NET (with
ikvmc). Apart
from being AWT and Swing support a low priority issue for
you, we were
able to achieve a rather good result.
However migrating from 0.36.0.11 to 0.39.3308 we have faced a
problem.
Using InputMap to handle keyboard events do not work along with basic
input fields like JTextField. We have checked the 0.39 series
up to the
latest version and 0.38.0.3 without success.
Strange that we seem to have a different or older 0.39.3308
from unsure
source with which it works correctly. There seems to be approximately
1Kb difference in each dll-s from the one being linked from the IKVM
Weblog. Replacing the IKVM.OpenJDK.SwingAWT.dll only in the
"official"
0.39.3308 seems to solve the problem!
We would appreaciate if you had the time to check this or
give us a hint
what can be wrong.
Kind regards,
Judit Vasko-Szedlar
--------------------------------------------------------------
----------------
_______________________________________________
Ikvm-developers mailing list
Ikv...@li...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Judit Vasko-Szedlar
Software Engineer
ChemAxon Ltd.
Maramaros koz 3/A, Budapest, 1037 Hungary
Tel: +361 4532658
mailto:jv...@ch...
--
Judit Vasko-Szedlar
Software Engineer
ChemAxon Ltd.
Maramaros koz 3/A, Budapest, 1037 Hungary
Tel: +361 4532658
mailto:jv...@ch...
|