@Override public void mouseEntered(MouseEvent e) { Random r = new Random(); int x = r.nextInt(getWidth() - button.getWidth() - 50); int y = r.nextInt(getHeight() - button.getHeight() - 50); button.setLocation(x, y); }
/** * Creates a new button with manageable width. * * @param aText Text of the button. * @param aTooltip Tooltip text for the button. Set this to <code>null</code> if no tooltip is to * be displayed. * @param aListener Button click's listener. * @return Newly created instance of <code>JButton</code>. */ public static JButton createButton(String aText, String aTooltip, ActionListener aListener) { JButton button = new JButton(aText); button.setToolTipText(aTooltip); button.addActionListener(aListener); button.setMaximumSize(new Dimension(Short.MAX_VALUE, button.getHeight())); return button; }
private void showColumnSelectionPopup(final JPopupMenu headerPopup, final JButton cornerButton) { initColumnSelectorItems(); headerPopup.show( cornerButton, cornerButton.getWidth() - headerPopup.getPreferredSize().width, cornerButton.getHeight()); }
private void createGui() { final JPanel topPanel = new JPanel(new BorderLayout()); final JPanel messagePanel = new JPanel(new BorderLayout()); final JTextField messageField = new JTextField(); messageField.setEditable(false); messageField.setText(message); messageField.setBackground(Color.WHITE); messagePanel.add(messageField); messagePanel.setBorder(new TitledBorder("Error Message")); topPanel.add(messagePanel, BorderLayout.NORTH); final JTabbedPane tabbedPane = new JTabbedPane(); final JTextArea descriptionArea = new JTextArea(); descriptionArea.setEditable(false); descriptionArea.setText(description); descriptionArea.setLineWrap(true); descriptionArea.setWrapStyleWord(true); tabbedPane.addTab("Description", descriptionArea); if (exception != null) { final JTextArea traceArea = new JTextArea(); traceArea.setEditable(false); traceArea.setText(StackTrace.toString(exception.getStackTrace())); tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea)); } add(topPanel, BorderLayout.NORTH); add(tabbedPane); final JPanel bottomButtonPanel = new JPanel(new BorderLayout()); final JPanel leftButtonPanelBottom = new JPanel(); final JButton reportButton = new JButton(new ReportAction()); reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight())); leftButtonPanelBottom.add(reportButton); bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST); final JPanel rightButtonPanelBottom = new JPanel(); final JButton okButton = new JButton(new CloseButtonListener()); getRootPane().setDefaultButton(okButton); rightButtonPanelBottom.add(okButton); bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST); add(bottomButtonPanel, BorderLayout.SOUTH); }
private void refreshAddressAndQRCode() { String address = (String) listAddresses.getSelectedValue(); // System.out.println("Addres:" + address); if (address != null) { if (address.equals(txtAddress.getText())) return; txtAddress.setText(address); btnQRCode.setIcon( new ImageIcon(new QRImage(address, btnQRCode.getWidth(), btnQRCode.getHeight()))); } }
public void dessinerComposants() { process.setBounds(50, 20, process.getWidth(), process.getHeight()); infos.setBounds(175, 600, infos.getWidth(), infos.getHeight()); infos_coups.setBounds(600, 600, infos_coups.getWidth(), infos_coups.getHeight()); imageTower1.setBounds(tower1TopLeft, 100, imageTower1.getWidth(), imageTower1.getHeight()); imageTower2.setBounds(tower2TopLeft, 100, imageTower2.getWidth(), imageTower2.getHeight()); imageTower3.setBounds(tower3TopLeft, 100, imageTower3.getWidth(), imageTower3.getHeight()); buttonTower1.setBounds( tower1TopLeft + 25, 520, buttonTower1.getWidth(), buttonTower1.getHeight()); buttonTower2.setBounds( tower2TopLeft + 25, 520, buttonTower2.getWidth(), buttonTower2.getHeight()); buttonTower3.setBounds( tower3TopLeft + 25, 520, buttonTower3.getWidth(), buttonTower3.getHeight()); // dessiner dynamiquement this.dessinerComposantsDynamiques(stackTower1, imageTower1, tower1TopLeft); this.dessinerComposantsDynamiques(stackTower2, imageTower2, tower2TopLeft); this.dessinerComposantsDynamiques(stackTower3, imageTower3, tower3TopLeft); }
/** * Calls the given treeNode. * * @param treeNode the <tt>TreeNode</tt> to call */ private void call(TreeNode treeNode, JButton button, boolean isVideo, boolean isDesktopSharing) { if (!(treeNode instanceof ContactNode)) return; UIContact contactDescriptor = ((ContactNode) treeNode).getContactDescriptor(); Point location = new Point(button.getX(), button.getY() + button.getHeight()); SwingUtilities.convertPointToScreen(location, treeContactList); location.y = location.y + treeContactList.getPathBounds(treeContactList.getSelectionPath()).y; location.x += 8; location.y -= 8; CallManager.call(contactDescriptor, isVideo, isDesktopSharing, treeContactList, location); }
public void layoutComponents() { setLayout(new BorderLayout()); add(main, BorderLayout.CENTER); if (popperIsVisible) { if (getPopperButtonLocation() == RIGHT) { popper.setPreferredSize(new Dimension(14, main.getHeight())); add(popper, BorderLayout.EAST); } else if (getPopperButtonLocation() == BOTTOM) { popper.setPreferredSize(new Dimension(main.getWidth(), 14)); add(popper, BorderLayout.SOUTH); setPopperArrowDirection(DOWN); setPopupLocation(popper.getX(), popper.getY() + popper.getHeight() + 5); } } Utilities.updateView(this); }
@Test public void testEntrarComLoginQualquer() { try { // fail("Not yet implemented"); try { Thread.sleep(3000); } catch (Exception e) { } JButton botaoEntrar = telaLogin.getEntrar(); Robot r = new Robot(); r.delay(3000); Point p = botaoEntrar.getLocationOnScreen(); r.mouseMove(p.x + botaoEntrar.getWidth() / 2, p.y + botaoEntrar.getHeight() / 2); r.mousePress(InputEvent.BUTTON1_MASK); r.delay(3000); r.mouseRelease(InputEvent.BUTTON1_MASK); r.delay(3000); } catch (AWTException exc) { exc.printStackTrace(); fail("awt exception no teste da telaLogin clicar botao entrar"); } }
private void init() { manage.setBounds(0, frameHeight * 40 / 120, frameWidth / 4, frameHeight * 1 / 13); manage.addActionListener(this); logout.setMargin(new Insets(0, 0, 0, 0)); logout.setBounds( frameWidth * 2 / 80 + frameWidth / 150, frameHeight * 63 / 72 - frameHeight / 100, frameWidth / 13, frameWidth / 13); final ImageIcon icon8 = new ImageIcon("pictures//back.png"); Image temp8 = icon8 .getImage() .getScaledInstance( logout.getWidth(), logout.getHeight(), icon8.getImage().SCALE_DEFAULT); // icon8= new ImageIcon(temp8); final ImageIcon icon10 = new ImageIcon("pictures//back2.png"); Image temp10 = icon10 .getImage() .getScaledInstance( logout.getWidth(), logout.getHeight(), icon8.getImage().SCALE_DEFAULT); // icon10= new ImageIcon(temp10); logout.setIcon(icon8); logout.addActionListener(this); logout.addMouseListener( new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub logout.setIcon(icon8); } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub logout.setIcon(icon10); } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub logout.setIcon(icon8); } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub logout.setIcon(icon10); } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub } }); close.setMargin(new Insets(0, 0, 0, 0)); close.setBounds( frameWidth * 12 / 80 + frameWidth / 150, frameHeight * 63 / 72 - frameHeight / 130, frameWidth / 13 - frameWidth / 110, frameWidth / 13); close.addActionListener(this); final ImageIcon icon9 = new ImageIcon("pictures//delete.png"); Image temp9 = icon9 .getImage() .getScaledInstance(close.getWidth(), close.getHeight(), icon9.getImage().SCALE_DEFAULT); // icon9= new ImageIcon(temp9); close.setIcon(icon9); final ImageIcon icon11 = new ImageIcon("pictures//delete2.png"); Image temp11 = icon11 .getImage() .getScaledInstance( close.getWidth(), close.getHeight(), icon11.getImage().SCALE_DEFAULT); close.addMouseListener( new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub close.setIcon(icon9); } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub close.setIcon(icon11); } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub close.setIcon(icon9); } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub close.setIcon(icon11); } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub } }); // 左栏按钮贴图 ImageIcon icon0 = new ImageIcon("pictures//系统管理.png"); Image temp0 = icon0 .getImage() .getScaledInstance(frameWidth / 4, frameHeight / 13, icon0.getImage().SCALE_DEFAULT); icon0 = new ImageIcon(temp0); manage.setIcon(icon0); jtf_name.setBounds(frameWidth / 10, frameHeight / 64 * 15, frameWidth / 10, frameHeight / 30); jtf_num.setBounds(frameWidth / 10, frameHeight / 64 * 18, frameWidth / 10, frameHeight / 30); jtf_name.setText(SystemHelper.getUserName()); jtf_name.setEditable(false); jtf_num.setText(SystemHelper.getUserID()); jtf_num.setEditable(false); }
/** Create the panel. */ public Receiveui(JFrame m, JPanel jp, LoginPO loginPO) { main = m; JPanel lastui = jp; Receiveui nowPanel = this; setLayout(null); ImageIcon image1 = new ImageIcon("image/transparent_circle.png"); JButton button = new JButton(""); button.setBounds(13, -9, 63, 63); button.setContentAreaFilled(false); button.setBorderPainted(false); button.setIcon(image1); button.addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { button.setIcon(new ImageIcon("image/mask_circle.png")); } }); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { main.remove(nowPanel); main.getContentPane().add(lastui); main.invalidate(); main.repaint(); main.setVisible(true); } }); add(button); JLabel lblHello = new JLabel("Hello! " + loginPO.getName()); lblHello.setForeground(Color.WHITE); lblHello.setBounds(655, 12, 100, 15); add(lblHello); JToolBar toolBar = new JToolBar(); toolBar.setEnabled(false); toolBar.setBounds(8, 540, 750, 35); toolBar.setOpaque(false); toolBar.setBorder(null); add(toolBar); JLabel label_4 = new JLabel("״̬À¸"); label_4.setForeground(Color.WHITE); toolBar.add(label_4); textField = new JTextField("ÊäÈë×°Ô˵¥±àºÅ"); textField.setOpaque(false); textField.setBorder(null); textField.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 18)); textField.addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { label_4.setText("״̬À¸"); if (!(Character.isDigit(e.getKeyChar()))) { e.consume(); } } }); textField.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { textField.setText(""); } }); textField.setBounds(205, 244, 347, 44); textField.setForeground(new Color(255, 255, 255, 200)); textField.setCaretColor(new Color(248, 179, 28)); add(textField); textField.setColumns(10); JButton button_1 = new JButton(""); button_1.setContentAreaFilled(false); button_1.setBorderPainted(false); button_1.setBounds(349, 316, 52, 52); ImageIcon image2 = new ImageIcon("image/transparent_circle.png"); @SuppressWarnings("static-access") Image temp1 = image2 .getImage() .getScaledInstance( button_1.getWidth(), button_1.getHeight(), image2.getImage().SCALE_DEFAULT); image2 = new ImageIcon(temp1); button_1.setIcon(image2); button_1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (textField.getText().length() != 10) { label_4.setText("ÇëÊäÈëÕýÈ·×°Ô˵¥ºÅ"); } else { ReceiveBLService rbs = new ReceiveBL(); LoadorderVO lv = rbs.checkUnreceive_loadorderPO(textField.getText()); if (lv == null) { label_4.setText("δ¼ì²âµ½¸Ã×°Ô˵¥"); } else { Arriverorder a = new Arriverorder(main, nowPanel, lv, loginPO); main.remove(nowPanel); main.getContentPane().add(a); main.invalidate(); main.repaint(); main.setVisible(true); } } } }); add(button_1); }
@SuppressWarnings("static-access") public editSalary(SalaryVO vo, JFrame main, LoginPO loginPO) { editSalary editSalary = this; setBounds(100, 100, 750, 600); setLayout(null); this.setVisible(true); // first rdbtnNewRadioButton = new JRadioButton("\u6309\u6708"); rdbtnNewRadioButton.setOpaque(false); rdbtnNewRadioButton.setBorder(null); rdbtnNewRadioButton.setBounds(371, 290, 83, 23); rdbtnNewRadioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub salaryModel = SalaryModel.ByMonth; } }); add(rdbtnNewRadioButton); // second radioButton = new JRadioButton("\u6309\u6B21"); radioButton.setBounds(371, 326, 83, 23); radioButton.setOpaque(false); radioButton.setBorder(null); radioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub salaryModel = salaryModel.ByTimes; } }); add(radioButton); // third radioButton_1 = new JRadioButton("\u6309\u63D0\u6210"); radioButton_1.setBounds(371, 366, 100, 23); radioButton_1.setOpaque(false); radioButton_1.setBorder(null); radioButton_1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub salaryModel = salaryModel.ByBenefit; } }); add(radioButton_1); buttonGroup = new ButtonGroup(); buttonGroup.add(rdbtnNewRadioButton); buttonGroup.add(radioButton); buttonGroup.add(radioButton_1); if (vo.getTypeOfStrategy() == SalaryModel.ByMonth) { rdbtnNewRadioButton.setSelected(true); salaryModel = SalaryModel.ByMonth; } else if (vo.getTypeOfStrategy() == salaryModel.ByTimes) { radioButton.setSelected(true); salaryModel = salaryModel.ByTimes; } else { radioButton_1.setSelected(true); salaryModel = salaryModel.ByBenefit; } JButton btnNewButton = new JButton("\u786E\u5B9A"); btnNewButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int n = JOptionPane.showConfirmDialog(null, "确认修改?", "no", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { if (textField_1.getText().equals("")) { label_4.setText("请输入价格"); Thread thread = new Thread(editSalary); thread.start(); } else { SalaryVO salaryVO = new SalaryVO( textField.getText(), Double.parseDouble(textField_1.getText()), salaryModel); SalaryPolicybl salaryPolicybl = new SalaryPolicybl(); salaryPolicybl.editSalary(salaryVO); Salary salary = new Salary(salaryVO, main, loginPO); main.remove(editSalary); main.getContentPane().add(salary); main.invalidate(); main.repaint(); main.setVisible(true); } } } }); btnNewButton.setBounds(283, 419, 52, 52); ImageIcon image1 = new ImageIcon("image/transparent_circle.png"); Image temp1 = image1 .getImage() .getScaledInstance( btnNewButton.getWidth(), btnNewButton.getHeight(), image1.getImage().SCALE_DEFAULT); image1 = new ImageIcon(temp1); btnNewButton.setIcon(image1); btnNewButton.setContentAreaFilled(false); btnNewButton.setBorderPainted(false); add(btnNewButton); JButton button = new JButton(""); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Salary salary = new Salary(vo, main, loginPO); main.remove(editSalary); main.getContentPane().add(salary); main.invalidate(); main.repaint(); main.setVisible(true); } }); button.setBounds(13, -9, 63, 63); button.setContentAreaFilled(false); button.setBorderPainted(false); button.setIcon(new ImageIcon("image/transparent_circle.png")); button.addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { button.setIcon(new ImageIcon("image/mask_circle.png")); } }); add(button); textField = new JTextField(); textField.setColumns(10); textField.setBounds(373, 189, 108, 21); textField.setText(vo.getTypeOfStaff()); textField.setEnabled(false); textField.setForeground(new Color(88, 93, 103)); textField.setCaretColor(new Color(88, 93, 103)); textField.setOpaque(false); textField.setBorder(null); add(textField); textField_1 = new JTextField(); textField_1.setColumns(10); textField_1.setDocument(new JTextFieldLimit(7)); textField_1.setBounds(373, 239, 108, 21); textField_1.addKeyListener(new InputNumber()); textField_1.setText(vo.getSalary() + ""); textField_1.setForeground(new Color(88, 93, 103)); textField_1.setCaretColor(new Color(88, 93, 103)); textField_1.setOpaque(false); textField_1.setBorder(null); add(textField_1); JToolBar toolBar = new JToolBar(); toolBar.setBounds(8, 541, 750, 35); toolBar.setOpaque(false); toolBar.setBorder(null); add(toolBar); label_4 = new JLabel("\u72B6\u6001\u680F"); label_4.setForeground(Color.WHITE); toolBar.add(label_4); JButton button2 = new JButton("取消"); button2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { editSalary neweditSalary = new editSalary(vo, main, loginPO); main.remove(editSalary); main.getContentPane().add(neweditSalary); main.invalidate(); main.repaint(); main.setVisible(true); } }); button2.setBounds(416, 418, 52, 52); ImageIcon image2 = new ImageIcon("image/transparent_circle.png"); Image temp2 = image2 .getImage() .getScaledInstance( button2.getWidth(), button2.getHeight(), image2.getImage().SCALE_DEFAULT); image2 = new ImageIcon(temp2); button2.setIcon(image2); button2.setContentAreaFilled(false); button2.setBorderPainted(false); add(button2); }
private void init() { jl[0].setText("装车单"); jl[1].setText("装车日期"); jl[2].setText("营业厅编号"); jl[3].setText("汽运编号"); jl[4].setText("车辆编号"); jl[5].setText("达到地"); jl[6].setText("监运员"); jl[7].setText("押运员"); jl[8].setText("订单条形码号"); jl[9].setText("运费"); jl[0].setBounds( frameWidth / 3, frameHeight / 20 + frameHeight / 70, frameWidth / 10, frameHeight / 20); jl[0].setFont(new Font("黑体", Font.PLAIN, 19)); for (int i = 1; i < 10; i++) { jl[i].setBounds( frameWidth / 10, frameHeight / 20 + frameHeight / 58 + frameHeight / 225 * 25 * i, frameWidth / 7, frameHeight / 20); jl[i].setFont(new Font("宋体", Font.BOLD, 15)); } jtf[0].addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { if (!Character.isDigit(e.getKeyChar())) { e.consume(); } } }); jtf[6].addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { if (!Character.isDigit(e.getKeyChar())) { e.consume(); } } }); confirm.setBounds( frameWidth / 6, frameHeight * 8 / 10 + frameHeight / 30, frameWidth / 9, frameHeight / 16); confirm.addActionListener(this); cancel.setBounds( frameWidth * 2 / 5 + frameWidth / 15, frameHeight * 8 / 10 + frameHeight / 30, frameWidth / 9, frameHeight / 16); cancel.addActionListener(this); ImageIcon icon1 = new ImageIcon("pictures//取消t.png"); Image temp1 = icon1 .getImage() .getScaledInstance( icon1.getIconWidth(), icon1.getIconHeight(), icon1.getImage().SCALE_DEFAULT); icon1 = new ImageIcon(temp1); cancel.setIcon(icon1); ImageIcon icon2 = new ImageIcon("pictures//确认小.png"); Image temp2 = icon2 .getImage() .getScaledInstance( icon2.getIconWidth(), icon2.getIconHeight(), icon2.getImage().SCALE_DEFAULT); icon2 = new ImageIcon(temp2); confirm.setIcon(icon2); for (int i = 0; i < 8; i++) { jtf[i].setBounds( frameWidth / 4, frameHeight / 20 + frameHeight / 58 + frameHeight / 225 * 25 * (i + 2), frameWidth / 10, frameHeight / 20); jtf[i].setFont(new Font("宋体", Font.PLAIN, 15)); } time[0].setText("年"); time[1].setText("月"); time[2].setText("日"); for (int i = 0; i < 3; i++) { timeInput[i].setBounds( frameWidth / 4 + frameWidth / 10 * i, frameHeight / 20 + frameHeight / 15 + frameHeight / 60, frameWidth / 12, frameHeight / 20); time[i].setBounds( frameWidth / 3 + frameWidth / 10 * i, frameHeight / 20 + frameHeight / 15 + frameHeight / 60, frameWidth / 12, frameHeight / 20); timeInput[i].setFont(new Font("宋体", Font.PLAIN, 14)); time[i].setFont(new Font("宋体", Font.PLAIN, 14)); } add.setBounds( frameWidth / 12 * 4 + frameWidth / 30, frameHeight / 20 + frameHeight / 58 + frameHeight / 225 * 25 * 8, frameHeight / 19, frameHeight / 19); ImageIcon icon3 = new ImageIcon("pictures//添加.png"); Image temp3 = icon3 .getImage() .getScaledInstance(add.getWidth(), add.getHeight(), icon3.getImage().SCALE_DEFAULT); icon3 = new ImageIcon(temp3); add.setIcon(icon3); add.addActionListener(this); initTable(); js.setBounds( frameWidth / 12 * 5 + frameWidth / 20, frameHeight / 20 + frameHeight / 40 + frameHeight / 15 * 2, frameWidth / 5, frameHeight / 2); over.setBounds( frameWidth / 3, frameHeight * 8 / 10 + frameHeight / 30, frameWidth / 9, frameHeight / 16); over.addActionListener(this); ImageIcon icon4 = new ImageIcon("pictures//完成.png"); Image temp4 = icon4 .getImage() .getScaledInstance( icon4.getIconWidth(), icon4.getIconHeight(), icon4.getImage().SCALE_DEFAULT); icon4 = new ImageIcon(temp4); over.setIcon(icon4); jtf[0].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[1].requestFocus(); } } }); jtf[1].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[2].requestFocus(); } } }); jtf[2].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[3].requestFocus(); } } }); jtf[3].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[4].requestFocus(); } } }); jtf[4].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[5].requestFocus(); } } }); jtf[5].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) { jtf[6].requestFocus(); } } }); jtf[6].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[5].requestFocus(); } } }); jtf[5].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[4].requestFocus(); } } }); jtf[4].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[3].requestFocus(); } } }); jtf[3].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[2].requestFocus(); } } }); jtf[2].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[1].requestFocus(); } } }); jtf[1].addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { jtf[0].requestFocus(); } } }); }