jTextField1.setNextFocusableComponent(jPasswordField1);请问这句是什么意思?就问这一句以下是这个程序的一部分:……class Login extends JFrame implements KeyListener,ActionListener,MouseMotionListener{ FlowLayout flowLayout1=new FlowLayout(); JLabel jLabel1=new JLabel("用户代码:"); JTextField jTextField1=new JTextField(5); JButton jButton1=new JButton("确认"); JLabel jLabel2=new JLabel("口令:"); JPasswordField jPasswordField1=new JPasswordField(8); JButton jButton2=new JButton("退出"); Login(){ super("登录系统"); setSize(200,150); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.getContentPane().setLayout(flowLayout1); Font font1=new Font("仿宋_GB2312", Font.ITALIC, 15); jTextField1.setNextFocusableComponent(jPasswordField1); jLabel1.setFont(font1); jLabel2.setFont(font1);……
jTextField1.setNextFocusableComponent(jPasswordField1);就是强制规定按下 Tab 后光标的顺序(也叫TabIndex)这表示,你在 jTextField1 中按下 Tab 键,光标会跳到 jPasswordField1 中.
提问者对答案的评价: |