嗨,我有一个问题,
我不能在Jtextfield上使用左右键来移动光标
当我想在Jtextfield上更改句子时,它不会让我使用左右键
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jScrollPane2 = new javax.swing.JScrollPane(jPanel1);
jPanel1 = new javax.swing.JPanel();
textField1 = new java.awt.TextField();
textField2 = new java.awt.TextField();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jTextArea1.setAutoscrolls(false);
jTextArea1.setEnabled(false);
jScrollPane1.setViewportView(jTextArea1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMaximumSize(new java.awt.Dimension(1500, 1500));
setMinimumSize(new java.awt.Dimension(2000, 2000));
getContentPane().setLayout(null);
jScrollPane2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jScrollPane2.setMaximumSize(new java.awt.Dimension(3000, 3000));
jScrollPane2.setMinimumSize(new java.awt.Dimension(3000, 3000));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
textField1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
textField1.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
jPanel1.add(textField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 130, 2260, 70));
谢谢
答案 0 :(得分:0)
我想你指的是当你将鼠标指针移动到JTextField时,你看不到这个指针变为“文本选择”模式。我认为您必须将Cursor更改为textField1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
我希望它有所帮助:)