public void gotoError(int pos) { errorPane.requestFocus(); errorPane.grabFocus(); errorPane.requestFocusInWindow(); errorPane.transferFocus(); errorPane.setCaretColor(Color.RED); errorPane.setCaretPosition(pos); if (errorPane.hasFocus()) { System.out.println("Has Focus!"); } else { System.out.println("Has no Focus!"); } }
public void showDialog() { if (notesFrame != null && notesFrame.isVisible()) { return; } notesFrame = new JFrame(FpRes.getString("title.chat.notes")); notesFrame.setIconImage(SparkManager.getMainWindow().getIconImage()); notesFrame.getContentPane().setLayout(new BorderLayout()); notesFrame.getContentPane().add(new JScrollPane(this), BorderLayout.CENTER); notesFrame.pack(); notesFrame.setSize(500, 400); notesFrame.setLocationRelativeTo(SparkManager.getChatManager().getChatContainer()); notesFrame.setVisible(true); textPane.requestFocusInWindow(); }