JTable methods worked in JDK5 and no more in JDK6

Hi,
I have a JTable child class, with an override method editCellAt. The main goal of this method is to allow select all the cell value and when the user types some char, it changes all the old value. This is very important for users, to easy typing new values in any cell.
These worked very well until JDK5, and it doesn't work in JDK6. Now in JDK6 this code puts the 1st char after other old chars, and then for 2nd char it starts to work fine.
The code for test is here:
package gestor.princ;
import java.util.EventObject;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
import javax.swing.text.*;
public class testJTable extends JFrame {
  public static void main(String[] args) {
    testJTable frame = new testJTable();
    Object[][] data =
      {"TesteAAAAAA1","1.2"},
      {"TesteBBBBBB2","3.4"},
      {"TesteCCCCCC3","5.6"},
      {"TesteDDDDDD4","7.8"},
    Object[] columnNames = {"Text","Value"};
    DefaultTableModel model = new DefaultTableModel(data, columnNames);
    selectallJTable table = new selectallJTable(model);
    table.setPreferredScrollableViewportSize(table.getPreferredSize());
    JScrollPane scrollPane = new JScrollPane(table);
    frame.getContentPane().add(scrollPane);
    frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
    frame.pack();
    frame.setLocationRelativeTo( null );
    frame.setVisible(true);
class selectallJTable extends JTable {
  public selectallJTable(AbstractTableModel dataModel) {
    super(dataModel);
    TableCellRenderer highlightRenderer = new SelectAll();
    setDefaultRenderer(Object.class, highlightRenderer);
  //  Select the text when the cell starts editing
  //  a) text will be replaced when you start typing in a cell
  //  b) text will be selected when you use F2 to start editing
  //  c) text will be selected when double clicking to start editing
  public boolean editCellAt(int row, int column, EventObject e) {
    boolean result = super.editCellAt(row, column, e);
    Component editor = getEditorComponent();
    if (editor != null) {
      if (editor instanceof JComboBox)
        editor = ((JComboBox) editor).getEditor().getEditorComponent();
      if (editor instanceof JTextComponent) {
        if (e == null) {
          ((JTextComponent)editor).selectAll();
        } else {
          final Component editor1 = editor;
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              ((JTextComponent)editor1).selectAll();
    return result;
  class SelectAll extends DefaultTableCellRenderer {
    private Color selectionBackground = UIManager.getColor("TextField.selectionBackground");
    private Border editBorder = BorderFactory.createLineBorder(Color.BLACK);
    private boolean cellHasFocus;
    public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected,
      boolean hasFocus, int row, int column) {
      super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
      cellHasFocus = hasFocus;
      return this;
    protected void paintComponent(Graphics g) {
      if (cellHasFocus && !getText().equals("")) {
        setBorder( editBorder );
        g.setColor( selectionBackground );
        g.fillRect(0, 0, getPreferredSize().width, getSize().height);
      super.paintComponent(g);
}

I have changed this part of code:
        if (e == null) {
          ((JTextComponent)editor).selectAll();
        } else {
          final Component editor1 = editor;
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              ((JTextComponent)editor1).selectAll();
       }by simply:
((JTextComponent)editor).selectAll();Now typing new value works fine. However, selectAll doesn't work anymore. I would like to select all cell value (with blue mark), it's better for user to know what cell is actually selected.

Similar Messages

  • The web address bar no longer displays the url of the open tab, the refresh button doesn't work any longer, and the more time FF is open, the slower it eventually runs.

    Downloaded FF4 a while back. Not the beta version. All seemed to work well for a while. Then the aforementioned problems began. I did not add any plugins or make any changes at all. Web site addresses do not show in tabs, and the refresh button is non-functional. After FF4 has been open a while, it begins to run slower and slower as if there is a memory leak.

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Pinyin not working for Mail and some other APPs

    Hi all,
    Now the Pinyin panel (in which one chooses characters) does not show up at all when I try to use either built-in Pinyin simplified or Sougou Pinyin, in Mail and for example Tencent QQ.
    It seems that there is no reaction whichever key I press. Cmd+space to switch methods always work.
    However, all Pinyin input methods work in Safari and other cases in web browsing.
    And the US English input works fine.
    Does anyone have any ideas? Appreciate!
    Cheers,
    Yi

    If you don't get an answer here, you can also try
    https://discussionschinese.apple.com
    or
    https://groups.google.com/forum/#!forum/chinesemac

  • Work Schedule Rules and Period Work Schedules

    Is it possible to have one work schedule rule have different period work schedules. We have several different period work schedules that work the same amount of hours. The only difference between them is that the days for the schedules are different. However, the total amount of hours worked in the week are the same. If we assign the period work schedules that have the same hours to one work schedule rule we do not have to create and maintain several work schedule rules for each different work schedule.
    Edited by: chawkins on Jan 6, 2011 6:40 PM

    A Work Schedule Rule is created for an Employee SubGroup Grouping, Calendar Grouping and Personnel SubArea Grouping, using a single Periodic Work Schedule.
    So, if you have 100 PWS, you will need at least 100 Work Schedule Rules, and probably more since some PWS will probably be used by more than one combinations of ESG/Calendar/PSA Groupings.

  • I want to ask that i have passed my 10th and i am doing diploma in Mechanical Engineering. So i want to work with apple and wants to lean more from them. So how i can this company as a studying student?

    I want to ask that i have passed my 10th and i am doing diploma in Mechanical Engineering. So i want to work with apple and wants to lean more from them. So how i can this company as a studying student?

    [http://support.mozilla.com/en-US/kb/Managing+file+types]

  • My eBay pages don't work properly. There are parts missing. The symbols on the My eBay page have gone. The £ paid sign, checkout, feedback, and probably more. I can't list an item as the submit button has disappeared. It all works fine on IE.

    My eBay pages don’t work properly. There are parts missing. The symbols on the My eBay page have gone. The £ paid sign, checkout, feedback, and probably more.
    I can’t list an item, as the submit button has disappeared.
    It all works fine on IE. I’ve uninstalled and reinstalled Firefox, but still the same.
    How can I regain my missing bits please.
    Thanks

    Can you attach a [http://en.wikipedia.org/wiki/Screenshot screenshot]?
    Use a compressed image type like PNG or JPG to save the screenshot and make sure that you do not exceed the maximum file size (1 MB).
    See http://kb.mozillazine.org/Websites_look_wrong
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Since installation of Mavericks, Time Capsule works very slowly, and the next backup of 236 GM will take nearly 30 days. What can I do to get backup more rapidly ?

    Since the installation of Mavericks, Time capsule works very slowly and will need 30 days or more to produce a complete backup of about 200 GB. What can I do to get a complete backup more rapidly ?

    What setup is the TC now.. ? what model and what firmware? Maverick seems to need 7.6.4 on the older TC.. and latest firmware on the AC version.
    Is it in router or bridge mode? Do not use wireless only.. join a wireless network.
    Is the computer connected by wireless or ethernet? I strongly recommend a test by ethernet.. with wireless in the computer turned off. If it is still very slow something is majorly wrong.. but I need the info I asked for to troubleshoot further.

  • HT3964 I have macbook air late 2010 model... it works fine otherwise but it has started being overheated in normal situations where normally it used to work fine and draining more battery....... battery time is almost half now. should i reset SMC. Would i

    I have macbook air late 2010 model... it works fine otherwise but it has started being overheated in normal situations where normally it used to work fine and draining more battery....... battery time is almost half now.
    should i reset SMC... would it help?

    I'm doubtful it's a missing driver too, but I feel as though it's driver related. The first time XP was installed, after first boot without installing drivers, it was without sound etc, but fundamentally the system worked. Now after first boot, it's very buggy. Thanks for your suggestion Tonny. I ran the tool but it turns out the HDD is fine. Besides, everything runs fine in safe mode.
    Does anyone know if (generally speaking) there is any firmware on the graphics card that would get updated via a Windows update? i.e. is it possible that Windows update downloaded a driver for the graphics card that installed new firmware that wasn't all that compatable with XP?

  • Attempting to install Adobe Acrobat 7 installer isn't recognizing my product serial number as a valid serial number.  I tried entering it with and without the dashes and neither methods work.  What should I do now?

    I bought a new computer and I'm attempting to install my older Adobe products that I still use, Adobe Acrobat 7 is the issue for now.  I followed the instructions on the Adobe site for installing the older apps, but the installer isn't recognizing my product serial number as a valid serial number.  I tried entering it with and without the dashes and neither methods work.  What should I do now?

    You cannot use your original files and serial number.  See the following for the files you need and the associated serial number(s)....
    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3 -
    http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l

  • I am just starting out in graphic design and I wanted to know how to get more involved with either adobe and or graphic design? I am really very interested in working with adobe and graphic design more and becoming more involved with both!!

    I am just starting out in graphic design and I wanted to know how to get more involved with either adobe and or graphic design? I am really very interested in working with adobe and graphic design more and becoming more involved with both!!

    I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that.
    Version 10.0.2 is the newest version and the successor to GarageBand '11 (version 6.0.5).
    The '11 is referring to the iLife '11 suit of multimedia application - the older GarageBand was a part of this bundle.
    Have a look at Edgar's graphical enhanced manuals, the explain very detailed how things work and why. You can buy them as iBooks from the iBook store or directly from the page:
    http://DingDingMusic.com/Manuals/

  • Digital persona(fingerprint reader) extension is incompatable with firefox 4.0b7 and many more extension which is working in firefox 3.6 is not compatable with this version

    Current version of firefox shows "Digital persona(fingerprint reader) extension is incompatable with firefox 4.0b7" and many more extension which is working in firefox 3.6 also not compatable with this version what should we do because this extensions are very useful for me in my laptop

    I got this reply from DigitalPersona:
    "DigitalPersona made the decision late last Spring, to discontinue the Personal products. There will be no further revisions."

  • I have some usses with my iMac. In this days i am working in  videos and suddenly the computer turn off i am very  worried about it because the computer is new do not have more that 5 months

    I have some usses with my iMac. In this days i am working in  videos and suddenly the computer turn off i am very  worried about it because the computer is new do not have more that 5 months, the other problem is i am working in whatever thing and suddenly the music is on and i do not nothing. Please help me.

    Have you looked at the previous discussions listed on the right side of this page under the heading "More Like This"?
    BTW this is the iPod touch forum

  • My 4s has no sound on most outgoing calls. i constantly have to turn my phone off and on more than once a day to get it to work. how can i get this fixed?

    My 4s has no sound on most of the outgoing calls i make. It will ring the other phone I am calling but I cannot hear it nor can they hear me when they answer. Its just dead air but my phone timer is in use. How can this be corrected?

    It's very possible that you have stuff running in the background that you don't even realize you have running. For example the default is for all notifications to be on and you usually need few to none of them.
    That said, while an iPad can run warm, too hot to handle isn't right. ALso you should get about 10 hours....depending on what you're doing of course. If you're doing processor intensive stuff, like gaming and videos it can drain faster and generate more heat.
    I would say if you have an apple store near by, make an appointment and have them check it out. If the issue is due to what they determine to be manufacturer's defects then it could fall under the warranty. But that's up to the store to determine.

  • How do I get my sd card out of the cd slot.. I have tried the method shown on youtube and it is not working

    How do i get my sd card out of the cd slot.. I have tried the method shown on youtube and it's not working

    Shut down the machine, turn it on it's side and shake it out. If you still can't get it try another solution on YouTube, there are many shown. We Have no idea which one you tried. If you still can't get it out take the machien into your local Apple Store or AASP and they will help you.

  • A simple selection of objects behind and much more

    Selecting things under a different object in the Illustartor is sometimes very annoying.
    For proper selection of objects was invented several tools. Please use them alternately depending on the situation.
    - outline mode
    - preferences = object selections by patch only
    - menu Lock = lock selection, All artwork above other layers
    + isloate mode
    + smart guides
    + layers (pity that to this day can not enable the option automatically locates the object)
    But still the selection of one object over time requires a lot of time and clicking. Especially if they are just above or below.
    The Blender is such a great option. According to me, works well and is easy to use. You can work on hundreds of superimposed objects, and continues to act quickly. it is not perfect but I would very I would see in Illustrtaor. However, this requires a better reflection of the current use of the objects in Illustrator than it is today.
    New Method of Selection:
    1. Click on an object once and you select an object on top,
    2. for any re-clicking LBM selects an object underneath. Simple, fast and understandable.
    +. By clicking and selecting objects at the same time watching a dream in which Appearance palette name and see what properties of the selected object.
    +. Adding to the selection or subtraction:
             - When I have selected the correct object can click on the layer name
              - Layer palette displays a view of all layers
              - New: Automatically expanding palette view to show the structure of the objectindicated in the structure of the layers and stack.
              - Now I can easily add or subtract to the selection of other objects or select just another object.
    Important to work with this method to modify the interface illustartor.
    1. Palette Appearance must expand and show more things. For example, as in this description:
        http://forums.adobe.com/message/3024803#3024803
    2. This rapid work with objects should also improve the Illustrator interface and make it more useful.
         Quick change opportunity to give a name or a group or object.
         Even now it is missing this opportunity. Even now it is missing this opportunity. For example, click and change the name in these views:
         One Clik and change name of layers or object or group or patch...
    Note. If it can be easily and quickly rename objects. RBM is an option on the menu will show that the category of the popup list of objects under the cursor.
      It would be enough to click on the object and would be selected. Super for me!
    3. New. The new functionality.
         - Appearance palette retains the settings of the object was last selected. Just as color palette ikon "Out of... Click to correct".
    The appearance palette, she could be named: "Last appearance use. Click to Add or Click+Alt to show".
         - This allows me to select a different object, and quickly give it the properties of the previous one.
         - Or click on the icon of the previous appearance when they are showing up and I choose only the one I want to use the new facility, eg by drag & drop the icon of the appearance of the currently selected object. — Something like a story last selected object appearance to choose to use the newfacility.
    Or better. Drop-down list to the history of recently used names of objects.
    The choice would result in giving the highlighted current object stored Apperance.Alt + Click does not change the selected object apperance just simply list Apperance with the possibility of drag and drop individual features in the current Apperance select object.
    Appearance to such a list could choose to display in the view layers palette by clicking on the icon Apperance.
    Of course, the idea presented is not conclusive, show just the way we work withillustartor expect from a modern program.
    After the present work in Illustartorze are really very complex and currentlydevotes much time on it just to check something.
    Currently Illustartor reminds me of a Christmas tree with different ideas than theprofessional tool for my daily earning.
    I spend my time like other colleagues on this forum because I support the idea, and Adobe Illustrator.
    I hope someone appreciates it. I've been looking around for an idea for anotherprogram to work with vectors.

    and...

Maybe you are looking for

  • JTable - how to do multiple interval selections

    Suppose if i have a 10 rows in the table. By Default, How can i select multiple interval rows selection. Like 2,5,7,8,10 rows has to be selected. After loading i should be able to select different rows also. How can I do it.

  • I movie wont download

    It is preventing me from using the old software, while also not actually installing the update. I need to use Imovie and could care less for the update, how do i stop this?

  • Missing receiver agreement for incoming IDoc

    Hi guys, I transfer IDoc's from a SAP-system to XI to start a ccBPM-process For that I don't need a receiver agreement. But why I get always the error message "<b>No receiver agreement found for sender -<SAP-SYSTEM> to receiver -<integration process>

  • How to delete a system generated query

    Hi, I want to delete a system generated query without doing which i am not able to delete a field from field group. Regards, Sharadha

  • PLM iviews

    We are and FDA regulated company and as part of that we are required to store our operating procedures in a secure environment so they can not be changed without the proper authority.  But while they are stored there we need to be able to give access