Work with JTable cell (check input, set text color)

I have a JTable with data
The task is:
User inputs some data into cell
I want to check his input string for equatily with other values in column
For example, I have these values in column:
1.example
2.exercise
3.execute
User inputs word "execution" in the same column
until user inputs "executi" his input string should be red.
What event I have to listen to if I want to get user input string?
Also a question:
Is there any opportunity to work with cell row (copy it to another JTable) ?
Message was edited by:
Holod

i think you should use cell editor as textfield (although that is default for jtable) and then implements document listener and set text color in insert update method.
try this out :-)

Similar Messages

  • My new I phone 4s does not ring when someone calls. Speakers works with music, it works with headphones, it works with the ringtones in the setting mode but it does not ring when is in normal mode...Please HELP!!!!

    Speakers works with music, it works with headphones, it works with the ringtones in the setting mode but it does not ring when is in normal mode...Please HELP!!!!

    Try a different ringtone.
    Reset or restart the device.

  • Why can't I get the average function work with empty cells?

    Why can't I get the average function work with empty cells?

    The thing that I am having a problem with is that I made a different form that calculates the average no matter how may of the cells have numbers or not and I didn't use an if function.  I have tried with this other form and and it calulates as if all the cells where being used.  I am using the [*] in both instances but it only works in the one I did earlier.

  • Mouselistner is not working with jtable in the browser

    Hi
    I am having a problem with jTable.
    I added a mouselistener to table header to sort table but when i run that applet from my netbean ide it works fine but when i run that applet in my browser it doesn't work, i have tested, its not even generate mouseclick event .Please help me guys.
    I call this function after calling initComponents() method of JApplet.
    public void setTableAction()
    //set mouselistener to sort table on click of table header
    final JTableHeader head= jTable1.getTableHeader();
    head.addMouseListener(new java.awt.event.MouseAdapter()
    public void mouseClicked(java.awt.event.MouseEvent evt)
    Vector data= ((DefaultTableModel)jTable1.getModel ()).getDataVector();
    sortTable(data, head.columnAtPoint(evt.getPoint()));
    //set action map to change the default action performed for enter key pressed
    InputMap imap = jTable1.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    KeyStroke tabKey = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    final Action oldAction= jTable1.getActionMap().get(imap.get(tabKey)); // get map to set enter key.
    imap.put(enterKey, "enter"); // set enter key
    Action newAction = new AbstractAction(){
    public void actionPerformed(ActionEvent e) {
    oldAction.actionPerformed(e);
    JTable table= (JTable)e.getSource();
    table.changeSelection(0,0,false,false);
    if(table.isCellEditable(0,0))
    String sTemp= (String)table.getValueAt(0,0);
    if(sTemp.length()>0) {
    if(bRenewItem)
    retrieveRcodeDetails("",sTemp);
    else
    processRCodeDetails(sTemp, e);
    }else
    table.editCellAt(0,0);
    jTable1.getActionMap().put("enter", newAction);
    jTable1.setPreferredScrollableViewportSize(jTable1.getPreferredSize());
    }

    Hi,
    I also am using the Bépo layout with an encrypted drive and encountered the same problem: the Return key does not work.
    It seems to work fine if you use the fr-bepo-latin9 keymap.
    # /etc/vconsole.conf
    KEYMAP=fr-bepo-latin9
    But I also looked at the files /usr/share/kbd/keymaps/i386/bepo/fr-bepo.map.gz and /usr/share/kbd/keymaps/i386/bepo/fr-bepo-latin9.map.gz (you can open gzipped files in vim directly). fr-bepo-latin9.map.gz defines keycode 28 (Return) but fr-bepo.map.gz does not.
    I modified fr-bepo.map.gz:
    # vim /usr/share/kbd/keymaps/i386/bepo/fr-bepo.map.gz # Append that line : "keycode 28 = Return".
    # mkinitcpio -p linux # Rebuild the initramfs.
    The Return key now works, but the Backspace (14, "Delete") and Shift (54) keys don’t work. I found that both the cf.map.gz (french canadian layout) and fr-bepo-latin9.map.gz files define those keycodes as well as other non-printing keys so I copied the following lines from fr-bepo-latin9.map.gz to fr-bepo.map.gz:
    keycode 1 = Escape Escape
    keycode 14 = Delete Delete
    keycode 15 = Tab Tab
    keycode 28 = Return
    keycode 29 = Control
    keycode 42 = Shift
    keycode 54 = Shift
    keycode 56 = Alt
    keycode 58 = Caps_Lock
    keycode 97 = Control
    It works! Don’t forget to rebuild the initramfs after you change the keymap file.
    # mkinitcpio -p linux
    I will send a message to the kbd and bépo projects mailing lists and report back.

  • 5130 will work with the BH 503 head set

     I bought a Nokia BH 503 head set before checking out compatibility with my 5130. From what I figured out it would work with it but the buttons might not work on the head set since the specifications on the 5130 does not list having AVRCP. Well I am happy to say it works just fine with my 5130 and all the buttons work like they should. Wondering if that was one of the things added with the up dated software. Did not try it with the old software.

    hi there, i have also bought bh503 and possess nokia 5130 xpressmuzic edition.BUt i am not able to pair the devices.everytime i try to connect it says"pairing rejected by device". would you please tell me how did you connect your devices.i have version 7.95 installed on my handset.
    Thank you.

  • Will Analog Instruments ADXL330 triaxial accelerometer work with the SCXI-1531 input module?

    I have an SCXI-1001 chassis and will soon be purchasing an accelerometer input module (SCXI-1531).  I'm also investigating possible accelerometers to buy.  Does anyone know if the the Analog Instruments ADXL330 accelerometer can be made to work with the SCXI-1531?  Here is a link to the Analog Instrument's page about the device:
    http://www.analog.com/en/sensors/inertial-sensors/adxl330/products/product.html
    Thanks!

    Hello,
    The output voltage and current levels are within specification of the module, the only concern I have is interfacing between the IC chip and the BNC connections on the 1531.  If you have a way to effectively connect the pins to BNC connectors and connect that to the module, then it should work.  Are you using the module's excitation source as well? 
    Kyle A.
    National Instruments
    High Speed Digital I/O Product Support Engineer - R&D

  • Will PFC power supplies work with SIMULATED sine wave inputs

    Will PFC power supplies work with a SIMULATED sine wave input from a UPS unit?

    Not sure whether you really meant "PPC" and have never heard of a PFC power supply, but if your question is whether a Mac PPC computer will run on a UPS, then the answer is definitely "yes" as my machine has shown twice in the past 12 months and several times in the past on the G5 tower and with a G3 B&W.
    I haven't dragged the old analog scope off the shelf to see what the UPS output really looks like, but I suspect it is no dirtier than the mains power in my neighborhood.

  • How to work with a product containing variable set with fixed component..?

    Hi All,
    i got a situation where i need to add the fixed component price that is associated with a product of variable set to the total price of product..
    That is, Variable set with the fixed component (hidden SKU).. Now it is missing the hidden SKU price in total price which is to be included actually.. how to get through this..?
    Thanks,
    VishnuVardhan Bovilla

    If I understand you currently you want to charge an additional component price for certain products.
    Is the added price varies with different products or is it the same for all, are you also shipping an additional product or component with those products?
    Without knowing the answers to above question a simple approach you might want to try is create a scenario to add a sku when certain products are added to cart.
    Define a price for the hidden SKU, In you page hide the hidden sku from being displayed.

  • Linux: The tabs text color changes with the theme, while the menu text color is always black.

    Hello,
    When Firefox theme is changed, it usually changes window appearance, e. g. backgrounds, and sets corresponding text color to contrast with that background. It always used to be like this. For instance, I currently use Sunflower_01 theme which sets blue sky as a background. The tabs text is white, as well as the bookmarks. The white text contrasts very fine with the sky. But the menu items are awfully black, casting dark-gray shadows on the dark-blue sky. The menu remains black regardless of the theme I set.
    Of course, it's all fine without any add-ons (light background, dark text), but with a theme enabled, it looks not the way it used to be. I wonder if it can be fixed somehow.
    I use Mozilla Firefox 33.0 for Linux Mint (release 13, maya).
    Looking forward to your reply.
    Regards,
    Andrey

    Hello,
    Did you install from the repositories? I have found the same problem with Ubuntu 14.04, a workaround is to either use a userChrome.css file, or (in my opinion, the easier route) [https://addons.mozilla.org/en-US/firefox/addon/stylish/ Stylish] extension with a new Style.
    See these articles about the userChrome.css file:
    * http://kb.mozillazine.org/index.php?title=UserChrome.css
    * http://kb.mozillazine.org/UserChrome.css_Element_Names/IDs
    If you use the userChrome.css route, you may need to restart Firefox to apply the changes.
    See this article for Stylish:
    * http://forums.mozillazine.org/viewtopic.php?f=38&t=1570945
    To add a new style in Stylish, click on the Stylish tool on your toolbar, then "Write New Style", then "Blank style". Or:
    * Tools (or [[Image: New Fx Menu]]) > Add-ons > User Styles > Write New Style
    Example code for either one method you choose (you can play around with the colours, but I found this worked nicely for my theme):
    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
    /*change size, color, style of text in Menu Bar */
    menubar > menu
    {color: darkgray !important}
    /* Mouse hovering over menu */
    menubar > menu[_moz-menuactive="true"]
    {color: white !important;}
    /* Active/Open menus */
    menubar > menu[_moz-menuactive="true"][open="true"]
    {color: black !important;}

  • Is there any way to set text color of a (NS)Button in IB?

    as the title reads.. is there? i'm using xcode 4.6

    If you are asking about the actual text color then yes it is possible but not so simple.
    If you look at the class definition for NSButton youwill see two methods
    – setAttributedAlternateTitle:
    – setAttributedTitle:
    These will allow you to specify an attributed string as the button label and in the attributed string you can set the  string attributes such as color.
    If you are just looking to change the background color or somehtingalong those lines that can be done right in NSButton.

  • Working with japanese and other char sets..

    Hey all,
    I primarily use XML Pull parsing becuase of its speed and my lack of need to validate a document.
    One problem we are having is saving text input by a user into an xml when it is japanese characters. We can clearly see the japanese characters in the text field.
    I have tried setting the encoding to utf-8, utf-16 and ucs-2. When I set it to utf-16, the output gets all garbled and it cant be read. Actually, in fairness, I am using a basic file writer and building up a StringBuffer with the xml I want, where I put the declaration tag at the top in and write it all out. At least on the mac, when I open the xml with textedit, I see a slew of japanese characters but no valid xml. Somehow it turns the entire file into japanese and not just the values within quotes.
    What's the trick in writing xml out and reading it back in so that various languages can be saved and restored?
    Thank you.

    I am using a basic file writer and building up a StringBuffer with the xml I want,That isn't the trick. The trick is to use a FileWriter that has been set up to use the same encoding you put into the XML document's prolog. Just having the XML document declare that it's encoded in UTF-8 doesn't make it be encoded in UTF-8, that is your responsibility. Like this:Writer w = new OutputStreamWriter(new FileOutputStream(...), "UTF-8"));And make sure you have a text editor that can understand UTF-8 and also render Japanese characters properly.

  • Working with JTable

    Hello,
    I am java beginner and trying to write a Swing based application with an observer-pattern
    When the user clicks on the button named "showTable" after giving two Object rows values in Min and Max textfields (min < max all the time), the values of the table between Min and Max become yellow. This works properly.
    Now I need a help for the "showResults" button, this button need to work after giving four different Object rows values in textfields (with Min< Start < End < Max).
    I want the botton "showResults" panel to show the results of all values gave in textfields and the number of values between Start and End (both values including), Min and Start (only Min including), End and Max ( only Max including) and Min and Max (both values including) in the created panel as "TableModel.
    1st problem: I don't know exactly, if the implementation of my methods are okay.
    2nd problem: I try to implemente the method actionPerformed of my button "showResults" in order to get results in the new panel as tableModel, but in vain.
    Can anyone tell me, how can I do it correctly.
    Thanks in advance for your help.
    {code}
    /***********************************Main:******************************/
    Object rows[][] = {{"-1.02", "2.00", "-5.00"}, {"-2.98", "-4.10", "0.18"}, {"4.76", "-2.29", "-2.22"}};
    Object columns[] = {"A1", "A2", "A3"};
    final JTable table = new JTable(rows, columns) {
    @Override
    public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {      
    Component c = super.prepareRenderer(renderer, row, column);
    c.setBackground(Color.WHITE);
    double value = 0;
    double min = 0;
    double max = 0;
    String val = getValueAt(row, column).toString();
    if (!val.equals("")) {
    value = Double.parseDouble(val);
    String minS = tf1.getText();
    if (!minS.equals("")) {
    min = Double.parseDouble(minS);
    String maxS = tf2.getText();
    if (!maxS.equals("")) {
    max = Double.parseDouble(maxS);
    if (value >= min && value <= max ){
         c.setBackground(Color.YELLOW);      
    return c;
    button1.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
    table.repaint();
    button2.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {      
         updater.setMinValue(JTextField.getValue());
         updater.setMaxValue(JTextField.getvalue());
         updater.setStartvalue(JTextField.getvalue());
         updater.setEndvalue(JTextField.getvalue());
         updater.setNumberOfValues1();
         updater.setNumberOfValues2();
         updater.setNumberOfValues3();
         updater.setAllNumberOfValues();
    /**************************Updater:******************************************/
    import java.beans.PropertyChangeSupport;
         public class TableTest4Updater extends PropertyChangeSupport {          
              private TableTest4DataChanger ttdc;
              public TableTest4Updater(TableTest4DataChanger ttdc) {
                   super(ttdc);
                   this.ttdc = ttdc;
              public int getAllNumberOfValues(){
              return ttdc.getAllNumberOfValues();          
              public void setAllNumberOfValues(int allNumberValues){
                   super.firePropertyChange("AllNumber", ttdc.getAllNumberOfValues(), allNumberValues);
                   this.ttdc.setAllNumberOfValues(allNumberValues);          
    /**************** Listener: ************************************/
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    public class TableTest4Listener implements PropertyChangeListener{
         public void propertyChange(PropertyChangeEvent pce) {
    {code}

    No idea what is causing the problem. You can find working examples in the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Tables.
    If that doesn't help then read this link before posting further replies:
    http://www.physci.org/codes/sscce.jsp

  • Working with JTable in intelliJ  in forms

    hi,
    iam trying to create a JTable using forms,can anyone pls tell me how to add rows and columns to it ?

    Hi Alice,
    I really don't think the problem is using LC Designer 8. We have several forms that were developed in LC Designer 8 (with FormCalc and Javascript), that still function in Acrobat/Reader 9.3.1.
    There are two potential issues. The first is the most likely.
    In the new installation of Reader 9.3.1, JavaScript is turned off. See this blog and sample: http://blogs.adobe.com/livecycle/2009/02/adobe_reader_disabled_javascri.html
    If you send the sample to the agency, a warning will appear if they open it and Javascript is turned off. When they turn javascript back on in the preferences, then your form should work again.
    The second issue can be a little more trouble. Adobe have introduced a new Javascript Blacklist Framework in Acrobat/Reader 9.3.1, which can disable FormCalc and JavaScript if it contravenes the framework. See these links:
    http://kb2.adobe.com/cps/504/cpsid_50431.html
    Managing JavaScript Execution in the Acrobat Family of Products
    As I say, unless your FormCalc is trying to access external resources, I suspect that Javascript is turned off in Reader. I don't think you have to upgrade Acrobat/LC Designer.
    Hope that helps,
    Niall

  • INTERSECT funcation in MDX not working with if we INTERSECT Parent SET and lower leval Set

    Hi All,
    INTERSECT funcation is not working if i filter Parent attribute and simple attribute
    ex.
    SET a as
    INTERSECT(
    [DimCustomerBuyer].[ParentProvince].[ParentProvince],[DimCustomerBuyer].[Province].[Province])
    Query (99, 1) Members, tuples or sets must use the same hierarchies in the INTERSECT function.
    is there any  work around
    parent Provence we use for Parent child attribute but Province is normal attribute
    Regards,
    Manish

    Hi manishcal16PPS,
    According to your description, you want to use the INTERSECT() function for different hierarchy members. Right?
    In MDX, when using INTERSECT() function, the two sets must have same dimensionality. Which means the two set of members must be under same hierarchy, otherwise they will be not comparable to SSAS so that it can't return the intersect part
    of members. This is the limitation of INTERSECT() function.
    Reference:
    Intersect (MDX)
    Intersect(MDX)
    Regards,
    Simon Hou
    TechNet Community Support

  • Can I get the Line in signal to work with a 5:1 speaker set

    I have recently connected my turntables via a mixer to the line in on my soundblaster audigy 2 NX. When I play records the sound only works through the left and right front speakers. I have messed arounsd with speaker settings but it doesn't make any difference. All other audio will work through the surround sound when played from the computer. Is there any way of telling the software that the line in is to be converted to surround sound?

    I have the same problem.
    Can anyone help us?
    For an example my sound card for my PC is Game Theater XP 5. and after 6 months using the card th driver now supports line in stereo sound extension to 5..
    So i think a Sound Blaster (as my favourite sound card) should have this feature too :-)
    Andrew

Maybe you are looking for