Very simple question about how to change a specific field in a table

Hi,
I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
Then I introduced the following java code in the Button:
public String button1_action() {
int quantity=Integer.parseInt(dropMenu.getValue().toString());
quantityChosen.setValue(quantity);
When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
How to write in the respective row?
Thanks in advance, Junkeira

Hi,
I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
Then I introduced the following java code in the Button:
public String button1_action() {
int quantity=Integer.parseInt(dropMenu.getValue().toString());
quantityChosen.setValue(quantity);
When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
How to write in the respective row?
Thanks in advance, Junkeira

Similar Messages

  • A question about how to change a button in a JPanel during runtime

    I am a beginner of GUI. Now I am trying to change a specific component, a button, when the application is running. For example, I have 3 buttons in a JPanel. Each button has its onw icon. If I click one of them, it will change its icon, but the other two don't change. I don't know if there is any method for changing a specific component during runtime. If any one knows please let me know, I will appreciate that very much!!!

    What you're going to have to do is loop inside the actionlistener but still have accessability to click while its looping. I don't know much about it, but I think you're going to need a thread. Try something like this... (it doesn't work yet, but I have to take off)
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class buttonxdemo extends JFrame implements ActionListener{
      Buttonx mybutton;
      //set it all up, make it look pretty  =]
      public buttonxdemo()
           mybutton = new Buttonx("default");
           getContentPane().add(mybutton.thebutton);
           mybutton.thebutton.addActionListener(this);
           this.setDefaultCloseOperation(3);
           this.setSize(200,200);
      public void actionPerformed(ActionEvent ae){
        if (ae.getSource() == mybutton.thebutton)
             if (mybutton.keepGoing)
               mybutton.keepGoing = false;
                else if (!mybutton.keepGoing)
                     mybutton.keepGoing = true;     
          mybutton = new Buttonx(/*Icon,*/"My Button");
          //getContentPane().remove(mybutton);
          //getContentPane().add(mybutton.thebutton);
          mybutton.startstop();
      }//actionperformed
      static void main(String args[])
           new buttonxdemo().show();
    } //movingicondemo
    class Buttonx extends Thread{
      public boolean keepGoing;
      //public Icon ICx;            //perhaps an array, so you can loop through?
      public String strbuttonx;
      public JButton thebutton;     //may have to extend JFrame?
      public Buttonx(/*Icon IC,*/ String strbutton){
        //ICx = IC;
        strbuttonx = strbutton;
        thebutton = new JButton(strbuttonx);
      public void startstop()
        int i = 0;
        while (keepGoing)
          thebutton.setLabel(strbuttonx.substring(0,i));
          //if an array of Icons ICx
          //thebutton.setIcon(ICx);
    i++;
    if (i > strbuttonx.length() - 1)
    i = 0;
    try
         Thread.sleep(1000);
    catch (InterruptedException ie)
         System.out.println("sleep caught: " + ie);
    }//startstop()
    }//buttonx
    kev

  • Very simple question about the turtle

    I'm kind of new to java, and I'm currently working on a university project involving the wellknown java turtle. Does any of you know how to change the turtle into another thing, like replacing the drawing of the turtle with a jpeg for instance? (I am using Guzdials turtle class)
    Thanks for helping!

    georgemc wrote:
    yawmark wrote:
    georgemc wrote:
    jverd wrote:
    Either the Java turtle is not that well-known, or I'm terribly out of touch. I've never heard of it, and have no idea what you're talking about.Maybe you just forgot about it, Jeff. Like in that Arnie film "Turtle Recall"Groan. :o)Bruce Willis, Arnie and Sylvester Stallone are sat in a bar discussing their new film "The Great Composers". Bruce Willis says, "I'll play the part of Beethoven. I fancy that"
    "I think I should be cast as Mozart" says Stallone
    Arnie simply says "I'll be Bach"
    beats george about the head and shoulders with a hockey stick for bad humor ... Bad George no beer for you.
    PS.

  • Very simple question about webapp list layout.

    Hi Everyone!
    I am having a very simple issue. I have created a web app and it has a default list layout looks like:
    <table><tbody><tr><td>{tag_counter}. {tag_name}</td></tr></tbody></table>
    I have placed web app module (using {module_webapps,14273,a} ) in one of my page. In front-end it has show every thing fine except it shows table tag for each item:
    <table>
        <tbody>
            <tr>
                <td>1. <a href="/lot/lot-101">Castlepoint Lot 101</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>2. <a href="/lot/efg-lot">EFG Lot</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>3. <a href="/lot/some-lot">Some Lot</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>4. <a href="/lot/some-other-lot">Some Other Lot</a></td>
            </tr>
        </tbody>
    </table>
    When I delete table and tbody tags from list view, it stop showing table related tags instead it start showing it without any tag.
    How to correct this issue? Please help!!!

    Here is what you can do:
    -edit the webapp list layout via FTP or via the "alpha" File Manager. The WYSIWYG editor will attempt to "correct" your HTML code. Enter something like this:
    <tr>
    <td>
    {tag_counter}. {tag_name}
    </td>
    </tr>
    -on the page you need the listing placed on enter this code:
    <table>
    <tbody>
    {webappmodule here}
    </tbody>
    </table>
    When the page renders you will get the desired result:
    <table>
    <tbody>
    <tr><td>1</td><td>Item1</td></tr>
    <tr><td>2</td><td>Item2</td></tr>
    <tr><td>3</td><td>Item3</td></tr>
    <tr><td>4</td><td>Item4</td></tr>
    </tbody>
    </table>

  • A very simple question about WF

    hi experts
    I would like to ask a question about workflow
    as u may know there is 'Loop' step in workflow, but I am confused when should I use Loop?
    Is this step used for processing internal table?  if yes, why shouldn't I create a custom BOR method and pass the entire internal table to the method?
    many thanks

    hi
    loop step for not process the internal table,
    this is used to process the some steps repetely until condition True or False.
    we have two loop steps is there
    WHILE AND UNTIL.
    Thanks
    sitaram

  • How to populate customer specific field data in table /SAPAPO/ORDFLDS

    Dear Gurus,
    I have explained in detail about the problem we face. I guess persons who has implemented enhancement:  /SAPAPO/RRP_IO_COL in their system can help me out.
    Background:
    Purchase requisitions in APO is created by an idoc that comes from a legacy system using BAPI CALL FUNCTION 'BAPI_POSRVAPS_SAVEMULTI3'.
    Business Requirement:
    I have a business requirement where I need to populate an additional data 'Original delivery date' from the idoc during PR creation in Product view.
    Development:
    To achieve the above requirement, we are following the below procedure in our development system.
    1. We are using enhancement:  /SAPAPO/RRP_IO_COL, method: RRP_USEX_COLS_FILL_01 and RRP_USEX_COLS_GET_TEXT_01 to display an additional field 'Original delivery date' in /sapapo/rrp3 - elements view. This field is restricted to Purchase requisition (Order category: AG) only. We are planning to populate the additional data 'Original delivery date' in this customer specific field and store it in table: /SAPAPO/ORDFLDS at the time of PR creation.
    2. Table: /SAPAPO/ORDFLDS is appended with the 'customer specific field'.
    3. We couldnt find a document on how the data can be populated in table /SAPAPO/ORDFLDS.
    4. How to polulate the live cache data in the table  '/APAPO/ORDFLDS' ? ( i.e using connection parameter )?
    Appreciate if you can throw me some light on this.
    Thanks
    Vignesh M

    Hi Vignesh,
    ANy luck on this ? I am trying the almost same thing...and stuck at same point.
    Please let us know if you have any more information.

  • Some questions about how to change scenes

    i have something like the following:
    fxml (view/main/MainMenu.fxml):
    <Scene fx:controller="view.main.CtrlMainMenu" xmlns:fx="http://javafx.com/fxml" stylesheets="view/main/main.css">
        <GridPane xmlns:fx="http://javafx.com/fxml" alignment="center" id="backgorund" hgap="10" vgap="10">
            <!--other panes -->
            <VBox spacing="8" GridPane.columnIndex="0" GridPane.rowIndex="1">
                <Button text="Start" onAction="#Start"/>
                <Button text="Options" onAction="#Options"/>
                <Button text="Exit" onAction="#Exit"/>
            </VBox>
        </GridPane>
    </Scene>main loop (cotroller/main.java):
    public class main extends Application{
        public static void main(String[] args){
            launch(main.class, args);
        public void start(Stage stage) throws Exception{
            stage.setTitle(CtrlLanguage.get(CtrlLanguage.TITLE));
            CtrlMainMenu main = new CtrlMainMenu();
            Scene scene = main.main();          //don't know how to make Scene scene = (Scene)FXMLLoader.load(getClass().getResource("MainMenu.fxml")); work on here since MainMenu.fxml is in view/main while the main class is in controller and ended up putting CtrlMainMenu in the view although is not very correct
            stage.setScene(scene);
            stage.setWidth(1080);
            stage.setHeight(720);
            stage.show();
    }view controller (view/main/CtrlMainMenu.java):
    public class CtrlMainMenu{
        //other buttons actions
        public Scene main() throws Exception{
            return (Scene)FXMLLoader.load(getClass().getResource("MainMenu.fxml"));
        @FXML protected void Start(ActionEvent event){
        @FXML protected void Options(ActionEvent event){
        @FXML protected void Exit(ActionEvent event){
            System.exit(0);          //is there any other way to finish the program than using a system.exit?
    }got few questions currently:
    1. i'd like to be able to keep using CtrlMainMenu for other buttons while the ones that appear there go to the main (since will be reusing those classes from other scenes)
    tried adding fx:controller on panes instead of the scene, but it doesnt work at all (it crashes) else directly in CtrlMainMenu change the scenes of the stage, but then, i have to send the stage to every controller i use? (or how do i know the stage of the scene?)
    and in the case of options, i'd like after done, go back to the previous scene, is that possible? if so, how?
    2.if i want to implement languages, how do i do to change the text? tried with setText() but depending on where do i put it, it crashes, so dont know where do i have to put it
    3.im doing a game that may have different number of players, so, is there some way to erase/hide/add data from a gridpane with fxml?

    1. ok, found the way to change scenes, with this way:
    @FXML protected void Start(ActionEvent event) throws Exception{
         Node node = (Node)event.getSource();
         Stage stage = (Stage)node.getScene().getWindow();
         Scene scene = (Scene)FXMLLoader.load(getClass().getResource("../view/main/MainMenu.fxml"));     //this is just an example, will change to go to another scene
         stage.setScene(scene);
         stage.show();
    }but now i have another problem, when i click on the button the stage scene is changed, but the scene is transformed to a very small one at the top left (the size seems the same as when i dont put the set width/height on the stage when creating it), the stage size remains the same, and when i resize the window, it gets "repaired"
    the options, i thought on using a pane over the current pane so this way instead of going back would be just removing that new pane, would that work well?
    2. found about languages that is by using <Label text="%myText"/> and java.util.ResourceBundle but don't know how to use it, can someone provide me an example, please?
    3. still haven't looked on it...

  • Very Simple Question About Animated GIF Background

    Hi,
    Till now I didn't realise that I don't have to copy the whole
    picture into every frame, I can simply keep the "static" part as a
    background, and animate only the changing object (for example, some
    letters). This way the final file will be much smaller in size.
    I right-click on the selection and choose Animate Selection,
    but then I don't know how to arrange the animated selection and the
    background static picture to achieve the desireble result.
    Please advise.
    Andy

    Anna2257 wrote:
    > Hi,
    > Till now I didn't realise that I don't have to copy the
    whole picture into
    > every frame, I can simply keep the "static" part as a
    background, and animate
    > only the changing object (for example, some letters).
    This way the final file
    > will be much smaller in size.
    > I right-click on the selection and choose Animate
    Selection, but then I don't
    > know how to arrange the animated selection and the
    background static picture to
    > achieve the desireble result.
    > Please advise.
    > Andy
    >
    Seeing your PNG file would take a lot of the guesswork out of
    this, but
    basically:
    Put the static elements on one layer and choose to share that
    layer to
    frames.
    Either add your animation elements to separate frames or read
    up on
    using animation symbols.
    You can check out this list of tutorials as well, and/or post
    a link to
    your PNG file so we can be more detailed in our advice.
    http://tinyurl.com/2ljze9
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

  • Very simple question about formula EXACT

    Hi,
    i'm new to Numbers. Trying to use the 'exact' formulas.
    It's not working, so I'm reading the help section about it...
    The example is the following : =EXACT("toledo"; "toledo") should return a TRUE value.
    Numbers keeps telling me I have a syntax problem... Don't know where it is...

    Súbastien Rezzonico wrote:
    Numbers keeps telling me I have a syntax problem... Don't know where it is...
    I don't know where you are and this may be the problem.
    If you are running your program on a system using the period as the decimal separator, in Numbers the operands must de separated by commas.
    My guess is that your system uses the decimal period and that French is the 1st language in the International Pref pane.
    EXACT() is used in the English version but this one doesn't use the semi-colon in the Help or in the insert functions tool.
    It's used also in the French version which use the semi-colon in the Help and in the insert functions tool because in French (of France) the decimal separator is the comma.
    The two eastern localized versions uses EXACT() too but they assumes that the decimal separator is period so the parameters are separated by comma.
    If my guess is true, you may go to my iDisk:
    <http://idisk.mac.com/koenigyvan-Public?view=web>
    and download:
    foriWork:for_Numbers:pour_modifierNumbers.zip
    which will give you the ability to change two plist files giving you an "insert function" tool inserting functions with the comma as separator matching the fact that the system uses the decimal period.
    Yvan KOENIG (from FRANCE lundi 7 juillet 2008 18:57:39)

  • This is a very simple question about multi-channel audio playback

    I have an mp4 file that i made and i made it 7.1 surround sound, and i'm pretty sure that this 7.1 surround sound works, as it can be played in VLC. i'm using netstream to load my files now. How do i make it so that flash can playback all 8-channels of sound? I suppose kglad would know the answer

    Flash doesn't support multi-channel audio (yet?)

  • Very Simple question about JList

    Hi,
    I am newbie to Java, and I want to show a couple of items in JList Control, but it doesn't show up, anyone can help me. When I use system.out to printout the contents of the ListModel, it does tell me that those items are in it.
    Thanks a lot!!!!
    Code are like this:
    import java.lang.*;
    import javax.swing.*;
    public class listExample extends javax.swing.JApplet {
    public void init(){
    String[] data={"one", "two", "three", "four"};
    jList1=new JList(data);
    for(int i=0; i<jList1.getModel().getSize(); i++)
    System.out.println(jList1.getModel().getElementAt(i));
    public listExample() {
    initComponents();
    private void initComponents() {
    jList1 = new javax.swing.JList();
    getContentPane().add(jList1, java.awt.BorderLayout.CENTER);
    // Variables declaration - do not modify
    private javax.swing.JList jList1;
    // End of variables declaration

    The objects in your list probably don't know how to display themselves. To do this you must overload the toString method that is originally in java.lang.Object. So basically if you have an object with a String for a first name and last name, for example, you would write a toString() method that looks something like this:
    public String toString() {
    return firstName + " " + lastName;
    When you put this object in a list the JList will use the toString method automatically to place text in teh JList object.
    Hope it helps.

  • Very simple question about JTextArea

    I know how to append text to JTextArea.
    textBox.append("the text to be appended")
    but how do I clear the textBox
    stev

    textArea.setText("");

  • Help!!  2 very simple questions about Tomcat 5

    1. How can I run a servlet within a package?
    * I add the package to Tomcat 5.0\webapps\servlets-examples\WEB-INF\classes
    * I add the following to Tomcat 5.0\webapps\servlets-examples\WEB-INF\web.xml
    <web-app>
    <servlet>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>Package.ServletName</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> ServletName </servlet-name>
    <url-pattern> /servlet/ServletName </url-pattern>
    </servlet-mapping>
    </web-app>
    * I type in the address line the following:
    http://localhost/servlets-examples/servlet/ServletName
    But it does not work!
    2. I can run servlets and JSP files only when they are saved inside the following packages:
    Tomcat 5.0\webapps\servlets-examples\
    Tomcat 5.0\webapps\jsp-examples\
    How can I make my own folder if I want to use Tomcat 5?
    Any answer will be appreciated. Thanks in advance!

    1. How can I run a servlet within a package?
    Define package XXX for your servlet
    For eg : package xxx;
    class ServletTest extends HttpServlet
    * I add the package to Tomcat
    5.0\webapps\servlets-examples\WEB-INF\classes
    * I add the following to Tomcat
    5.0\webapps\servlets-examples\WEB-INF\web.xml
    <web-app>
    <servlet>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>Package.ServletName</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> ServletName </servlet-name>
    <url-pattern> /servlet/ServletName
    letName </url-pattern>
    </servlet-mapping>
    </web-app>
    * I type in the address line the following:
    http://localhost/servlets-examples/servlet/ServletName
    But it does not work!
    http://localhost/servlets-examples/servlet/ServletName
    What is the error being thrown here >>> 404 not found?
    2. I can run servlets and JSP files only when they are
    saved inside the following packages:
    Tomcat 5.0\webapps\servlets-examples\
    Tomcat 5.0\webapps\jsp-examples\
    How can I make my own folder if I want to use Tomcat
    5?
    create a folder under webapps for eg :
    myfirstapp
    and follow a similar directory structure that has been followed for the example applications.Register your context with the server.xml located at tomcat\conf\server.xml
    -Regards
    manikantan

  • Very simple question about declaring variables

    if a create a new ' int ' as in the code below :
    static int counter;
    does the value of counter automatically default to ' 0 ' ?
    Does this also apply if i declare the var to be public, protected etc ( but not final )
    thanks

    Most languages will initialise an int to 0 if no value is specified but it is dangerous to rely on this as it is not always the case. It is therefore recommended as good practice that you always initialise your own variables to ensure they start with the value you wish and not something unexpected.
    Mark.

  • Very basic questions about how Airport Express works

    I'm using a non-Apple wireless router at home. I'd like to stream music from my iBook to my stereo. Will an Airport Express do that? Will it get confused that there's another access point? Can my iBook receive streaming radio via the non-Apple wireless router and send it to Airport Express?
    Alternatively: can I simply replace my non-Aple wireless router with an Airport Express? Will an Airport Express work as a wireless router? Will it to DHCP and NAT so that multiple computers can connect to the Internet through it?
    Thanks.

    johnbkim, Welcome to the discussion area!
    I'd like to stream music from my iBook to my stereo. Will an Airport Express do that?
    Yes
    Will it get confused that there's another access point?
    You would simply configure the AirPort Express (AX) to join your current wireless network.
    Can my iBook receive streaming radio via the non-Apple wireless router and send it to Airport Express?
    To stream non-iTunes items you will need to use Airfoil.
    Alternatively: can I simply replace my non-Aple wireless router with an Airport Express?
    Yes as long as you don't have any devices connected to that router via Ethernet.
    Will it to DHCP and NAT so that multiple computers can connect to the Internet through it?
    Yes it is a router.

Maybe you are looking for

  • Uneditable JTextArea

    I have created a simple JTextArea with a scrollPane printJTextArea = new JTextArea();         // setting up my text area for output       printJScrollPane = new JScrollPane(printJTextArea); // putting my text area in a scrollpane       printJScrollPa

  • Install R2 failure

    Hi, I try to install 9iAS R2 j2ee only on Suse 7.2 linux. I get some errors: 1) When installing the jdk: 'Error in setting permissions of file <oraclebasedir>/jre/bin/.java_wrapper' But this file does not exits (also not in the tmp/installer dir. Whe

  • Best method to stop game and make a 3,2,1 countdown on screen?

    Hi, Was wondering if I wanted to stop my game so that no input and all ai action seized what the best way to do it is, is there a way besides stop every listener and every timer and ai event? Also I want to kind of make a big 3,2,1 countdown appear i

  • How to clear running programs

    How do I clear the running programs on my iPad 2?   I fingured out how to bring them up - pushing the button 2x.  I figured out how to check them - hold button down.  but How do I clear them?

  • Interactive Reports - Actions Menu - Download option

    The interactive report Actions Menu has many wonderful options. The action that my users will use the most is the Download. Is there any way to create a button or text link for the download, similar to what is shown in the classic report? The users w