How do i change the cursor on a jtable header when clicked for sorting?

here is my question, how do i change the cursor on a jtable header when I click the header for sorting?
I think it is suppose to be in the fragment of code where the header listener is implemented for sorting, but I'm not quite sure what is the exact component that holds everything so that i can change the cursor...
below is what I've tried, but it doesn't seem to work... thank you
public void addMouseListenerToHeaderInTable(JTable table) {
final TableSorter sorter = this;
final JTable tableView = table;
tableView.setColumnSelectionAllowed(false);
MouseAdapter listMouseListener = new
MouseAdapter() {
public void mouseClicked(MouseEvent e) {
TableColumnModel columnModel =
tableView.getColumnModel();
int viewColumn =
columnModel.getColumnIndexAtX(e.getX());
int column =
tableView.convertColumnIndexToModel
(viewColumn);
System.out.println("column = "+column);
if (e.getClickCount() == 1 && column != -1) {
System.out.println("Sorting ...");
Cursor oldCursor =
tableView.getRootPane().getCursor();
System.out.println("oldCursor.getType()
= "+oldCursor.getType());
if (oldCursor.getType() !=
Cursor.WAIT_CURSOR){
JComponent parentPane =
tableView.getRootPane();
parentPane.getContentPane().setCursor
(new Cursor(Cursor.WAIT_CURSOR));
parentPane.setCursor(new Cursor
(Cursor.WAIT_CURSOR));
Cursor newCursor =
parentPane.getCursor();
System.out.println("newCursor.getType
() = "+newCursor.getType());
int shiftPressed = e.getModifiers(
&InputEvent.SHIFT_MASK;
boolean ascending = (shiftPressed == 0);
//System.out.println("tableView.getRootPane()
is "+tableView.getRootPane().getRootPane());
sorter.sortByColumn(column, ascending);
tableView.getRootPane().setCursor(new Cursor
(Cursor.DEFAULT_CURSOR));
//System.out.println("Done sorting");
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(listMouseListener);
}

Hi,
Try setting the cursor for the table header.
table.getHeader().setCursor(Wait_Cursor);
Bala.

Similar Messages

  • How do I change the content-type in http header when using JAX-WS?

    I need to change Content-Type in http Header. I am using JAX-WS to invoke web service call. Can someone tell me how to do it? Thanks a lot!

    LabVIEW does so many wonderful things, but the inability to perform what should be a simple task, such as upgrade a RT chassis within a LV Project, bewilders me. This is going to cost me hours, I just know it...
    Is there anything on the Idea Exchange for this?? A quick search shows nothing, so maybe I'll add an entry.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • How do I change the cursor size.

    How do I change the cursor size. I  enlarged  it and now cannot remember where the command is to put it back to normal.

    System Preferences->Accessibility->Display
    Adjust the Cursor Size slider there

  • How do I change the cursor blink rate? Firefox 3.6.10 under Ubuntu.

    How do I change the cursor blink rate? Firefox 3.6.10 under Ubuntu.

    See this old mozillaZine forum thread about this:
    *http://forums.mozillazine.org/viewtopic.php?f=38&t=865895
    ''(please to not post in such old threads)''
    See also:
    * http://kb.mozillazine.org/about:config
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • How do I change the font size of a document when I PRINT?

    How to I change the font size of a document when I print it?

    To specifically and fully answer your question, no, you absolutely cannot change the “font size” as a function of print.
    First of all, there isn't a single “font size” associated with a PDF file (and we assume you are referring to a PDF file since this is an Acrobat forum).
    Secondly, PDF is a final form file format meaning that the content is static in terms of location, size, etc. on the page. To change the point size of any particular text, you really need to go back to the source document and make the changes there.
              - Dov

  • How do I change the default setting from Pages to MS Word for Mac?

    How do I change the default setting from Pages to MS Word for Mac?

    https://discussions.apple.com/message/13008817#13008817

  • How do i change the color of a JTable's column names

    hai,
    i'm very new to java and trying to customize the look of a JTable.
    how do i change the color of a JTable's Column names. i know its very simple, i just couldn't figure out how to do it!!
    thanx in advance

    table.getTableHeader().setForeground(Color.RED);

  • How do I change the default programme to open pictures when downloading? Why can't I make it automatic? - the tick box is greyed out.ut

    How do I change the default programme to open pictures when downloading? It always proposes Windows Live Photo Gallery and I have to change it to Windows Photo Viewer every time. Why can't I make it automatic? - the tick box is greyed out.

    Thread discussing this issue here:
    http://discussions.apple.com/thread.jspa?messageID=1289317

  • TS3899 How do I change the address that my iphone sends when i send mail.  I have deleted the account but it still shows up as the account that will be replyed to if people hit reply.

    How do I change the address that my iphone sends when i send mail.  I have deleted the account but it still shows up as the account that will be replyed to if people hit reply.

    Hey There I didn't need to change it as it shows my correct name in my icloud account. The problem is on my Mac where it still shows my Full name as my partners name.
    For eg. if I send an email from "Mail" on mac and I use my icloud account then the name that shows up is my partners name when the email is received. If I send an email from the Icloud Mail box that I log into on my browser then the name that shows up when the email is received is my name which is correct.
    When I go into preferences in "Mail" on my Mac to change my name, the name is ghosted out and doesn't allow me to change it ! ? It is here that it still show my partners name ?

  • (simple q) how do I change the font in a JTable column header?  thanks

    how do I change the font in a JTable column header?
    thanks

    JTableHeader header = yourTable.getTableHeader();
    // Set to serif, bold, size 12...
    header.setFont( new java.awt.Font( "serif", 1, 12 ) );
    // you can set others like color and border, too.
    header.setBackground(Color.white);
    header.setBorder( new EmptyBorder(15,2,15,2) );

  • How do i change the "profile" picture on m iPad when I'm using iMessenger for IOS5?

    How do i change the "profile" picture on m iPad when I'm using iMessenger for IOS5?

    You do realize that only you see the photo associated with this correct - nobody else will see your photo - only you will.
    You have to add the photo in the contacts app. Locate your vcard and tap Edit. Then tap the area where the photo will be located to add a photo. You can take a photo or choose one from your photos app.

  • How can i change the Cursor for the hole frame?

    I think this is quite a simple question:
    I would like to change the cursor for the hole Frame, while the programme is reading data from database.
    but with frame.setCousor(...) i get a compiler-error.
    Thank you

    I think this is quite a simple question:
    I would like to change the cursor for the hole Frame,
    while the programme is reading data from database.
    but with frame.setCousor(...) i get a compiler-error.
    Thank youHello,
    there shouldnt be any compiler-error.
    Post some code and we will help.
    docs:
    /**Sets the cursor image to the specified cursor.
    This cursor image is displayed when the contains method for this component returns true for the current cursor location,
    and this Component is visible, displayable, and enabled.
    Setting the cursor of a Container causes that cursor to be displayed
    within all of the container's subcomponents, except for those that have a non-null cursor.*/
    public void setCursor(Cursor cursor)regards
    tim

  • How can I change the e-mail address that shows when I try to order from iBooks?

    Hi.  I recently had to change my e-mail address, and successfully changed my Apple ID to reflect the new e-mail.  However, while trying to order a book through iBooks today, I noticed that I was asked for my password and that my old e-mail was showing.  How can I change the old address to the new one so that I can order from iBooks?  Thank you.
    janiekhi

    Hi, fromsouth, and thank you for your reply.  When I go to store, there is no place that says "sign out" so I can't do this.  My old email is showing, and when I click on it I am asked for my password.  I tried my old password that I used with that email, but was told it was incorrect.  This is so frustrating!  I can't do any ordering on my iPad until this problem is solved.  Thanks again.
    janiekhi

  • How do I change the email associated with my facetime account. For some reason I was notified that the email was switched to an older email that I had and I need to change it back.

    How do I change the email address associated with FaceTime.  I received a notification that it was being changed to an old email address. I want to change it back to my current email.

    Hi there,
    You may find the information in the article below helpful.
    FaceTime for Mac 1.x: Sign in to FaceTime
    http://support.apple.com/kb/PH5645
    -Griff W.

  • How do I change the clock source in Audio/Midi when it's greyed out?

    I've tried and tried to change the clock source to eliminate pops and clicks in audio output and input but I just can't change the clock source because it's greyed out - how can I make it changeable?
    Any suggestions would be great !

    Hi, Acoma.
    Have you seen the steps and specifics (analog vs. digital inputs) discussed in:
    • "Soundtrack Pro: Setting the correct clock source for your audio interface."
    • "Logic Pro/Express: Digital input not available."
    Providing more specifics concerning your exact recording configuration may enable the audio gurus who answer questions here to give you additional assistance. You may also want to try your question on the Discussions for either of Apple's Soundtrack or Logic products, as those contributors are most familiar with audio set-up issues.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

Maybe you are looking for

  • Kapsel Logon Example - IOS 7 https issue

    Hello Experts, When i try to connect via HTTP from the cordova project "logondemo" everything works fine, when i switch to HTTPS, i have this issue on the cordova project... CFNetwork SSLHandshake failed (-9807) I tested the connection via the REST A

  • ORDERS05, posting PO and raising Order in CRM

    Hi, I testing an ORDERS05 IDOC via WE19. I can see that there's a Distribution Order being created each time in CRM (viewable by CRMD_ORDERS), but there seems to be a number of messages, of which some say that the Distribution Center and Sales Org ar

  • Abstract class, Interface and two models issue

    Hi! I will post my code and then ask the question (text between code snippets is bold, so you don't miss it, it's not shouting): public class AppScreen extends JFrame                        implements ActionListener {   private MemoryTableModel model

  • TS3694 My phone is in recovery after a number of events being stolen and dropped, not sure which wiped it! but i can't restore it,

    My phone won't restore and keeps coming up with error 21 . My security settings on my home computer haven't changed and the phone was only restored about 2 months ago when my daughter gave me the phone. I have tried disabling my anti virus and stuff,

  • Number for iPad and photographs

    I have built a spreadsheet, using Numbers which catalogues details of fifty items and growing. Each item has its own row in a table. I have photographed each of the items. How can I have  a cell in each row which would link to and enable me to view t