public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (comp.hasFocus() || focusLostTemporarily) { Color color = g.getColor(); g.setColor(focusColor); BasicGraphicsUtils.drawDashedRect(g, x, y, width, height); g.setColor(color); } }
// These is some wierd problem such that sometimes, the vnmrj command // area gets the focus and these items in the login box do not get // the focus. Even clicking in these items does not bring focus to // them. Issuing requestFocus() does not bring focus to them. // I can however, determing if either the operator entry box or // the password box has focus and if neither does, I can unshow and // reshow the panel and that fixes the focus. So, I have added this // to the mouseClicked action. If neither has focus, it will // take focus with setVisible false then true. public void mouseClicked(MouseEvent e) { boolean pfocus = m_passwordField.hasFocus(); boolean ofocus = comboTextField.hasFocus(); if (!pfocus && !ofocus) { setVisible(false); setVisible(true); } }