2
사용자가 행을 두 번 클릭하고 다음 행에 마우스를 놓을 때 JTable을 사용하고 있습니다. -> 시간 스크롤 막대에서 좋아, 대신 AWT.Robot
를 사용 ListSelectionListener를 추가 ListSelectionModelJTable
스윙 : Jtable에서 커서가 아래로 움직이면 JScroll 막대도 아래로 내려야합니까?
에 적절한 설정 같은 poistion
public void TableMouseListener implements MouseListener {
public void mouseClicked(MouseEvent e) {
//if the double click is performed or left button
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() >= 2) {
Robot r;
Point p = e.getPoint();
JTable table = (JTable) e.getSource();
int rowNumber = table.rowAtPoint(p);
PointerInfo a1 = MouseInfo.getPointerInfo();
Point b1 = a1.getLocation();
int x1 = (int) b1.getX();
int y1 = (int) b1.getY();
System.out.println(x1+" :X : "+x1);
System.out.println(y1+" : Y : "+y1);
//Mouse move to next record based row height
r = new Robot();
r.mouseMove(x1, y1 +table.getRowHeight());
//Can any one suggest move the scrollbar based on the cursor move
//Rectangle rect = viewport.getViewRect();
//rect.y = rect.y + table.getRowHeight();
//viewport.scrollRectToVisible(rect); -> IF scrollbar is used to move but not in next poistion
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
마우스는 다음에 초점을 맞추어야하지만, 선택은 선택한 행에서만해야한다. 그러나 scrollpane이있을 때의 문제는 Jscrollpane & 마우스를 움직일 때 아무런 관련이 없다. –
마우스와 스크롤바를 동시에 움직이는 방법에 대한 제안이 있으십니까? –
JTable을 사용하여 JScrollBar를 계속적으로 움직이는 경우에는 isuse가 없다. 모든 것이 코드의 나머지 부분에있다. 블록은 built_in 스크롤 가능하다. :-) – mKorbel