示例#1
0
 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!");
   }
 }
示例#2
0
文件: Notes.java 项目: justin0127/IM
  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();
  }