Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: skT45625 Date: 08/07/2000 java version "1.3.0beta_refresh" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09) Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode) Platform: x86-architecture, Linux kernel 2.2.16 (based on RedHat 6.0 with many updates), XFree86 3.3.5 Java: JDK 1.2.2_006 or JDK 1.3.0beta_refresh System Enveroment: LANG=ru LC_ALL=ru_RU.KOI8-R Java property: file.encoding=KOI8-R For cyrillic input in XFree86 used Xkb. In Xkb setted 3 keyboard layout ("US/ASCII", "KOI8-R", "Cyrillic" ). The part of file with defines of symbols for Cyrillic 'A': ----------------- start ----------------- key <AC04> { [ f, F ], [ 0xc1, 0xe1 ], [ Cyrillic_a, Cyrillic_A ] }; ----------------- end ----------------- For switching keyboard layouts used ISO_Group. For test of input used this application: ----------------- start ----------------- import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; public class ex { boolean packFrame = false; public ex() { ex_frame frame = new ex_frame(); if (packFrame) { frame.pack(); } else { frame.validate(); } frame.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } new ex(); } public class ex_frame extends JFrame { JPanel contentPane; GridLayout gridLayout1 = new GridLayout(); JTextField jTextField1 = new JTextField(); JButton jButton1 = new JButton(); JTextField jTextField2 = new JTextField(); public ex_frame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { gridLayout1.setRows(2); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(gridLayout1); jTextField1.setToolTipText("input character here"); jTextField1.setDisabledTextColor(Color.gray); jTextField1.setHorizontalAlignment(SwingConstants.CENTER); jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(KeyEvent e) { jTextField1_keyTyped(e); } }); jTextField2.setToolTipText("Unicode code of input character"); jTextField2.setEditable(false); jTextField2.setHorizontalAlignment(SwingConstants.CENTER); contentPane.add(jTextField1, null); contentPane.add(jTextField2, null); } protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jTextField1_keyTyped(KeyEvent e) { jTextField2.setText( Integer.toHexString( e.getKeyChar() ) ); } } } ----------------- end ----------------- In upper TextField input characters, in buttom TextFiled see Unicode code of last input character in Hex. For key with Cyrrilic 'A' (UNICODE code - 0x0410) we see: in JDK 1.2.2_006 layout 1: 46 (correct for all - latin F) layout 2: e1 (correct for KOI8-R, but incorrect for UNICODE) layout 3: 6e1 (correct for Cyrillic_A defined in X11/keysymdef.h, but incorrect for UNICODE - 0x06xx - arabic page) in JDK 1.3.0beta_refresh layout 1: 46 (correct for all - latin F) layout 2: e1 (correct for KOI8-R, but incorrect for UNICODE) layout 3: e1 (correct for KOI8-R, but incorrect for UNICODE) PS: sorry for bad english. (Review ID: 108045) ====================================================================== ###@###.### 10/12/04 15:02 GMT
|