Cursor « JTable « Java Swing Q&A





1. Cursor positon within JTable    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; class Testing { public void buildGUI() { final JTable table = new JTable(5,5); JScrollPane sp = new JScrollPane(table); JButton btn = new JButton("Add New Row"); JFrame f = new JFrame(); f.getContentPane().add(sp,BorderLayout.CENTER); f.getContentPane().add(btn,BorderLayout.SOUTH); f.pack(); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ ((DefaultTableModel)table.getModel()).addRow(new String[]{"","","","",""}); table.editCellAt(table.getRowCount()-1,0); Component editor = table.getEditorComponent(); editor.requestFocusInWindow(); } }); } ...

2. Setting the cursor type in jtable.very urgent    coderanch.com

I have created a JTABLE with 5 columns headers. Now i want to change the cursor to hand cursor when the mouse is pointed to the edge of a particular cell in JTABLE. After the cursor type is changed at the edge of the cell in jtable, i want the cursor to rechange to default cursor when mouse is eneterd inside ...