JTextFields and model:Can i create a text model like ListModel for Lists

Hi,
i'm doing a cache simulator which uses several JTextFields to show information.
The problem is this:i have a class named cache which implements the observable interface and i use various variables to update the JtextFields everytime one of these changes.
So,everytime a values changes i'm doing this ugly thing...
accessResult="0";
setChanged();
notifyObservers(accessResult);and in the applet class i receive it:
public void update(Observable o, Object arg) {
if (o.equals(this.machine.cache)) {
if (arg.equals(this.machine.cache.accessResult)) {
                        if (this.machine.cache.accessResult == "0") {
                            this.resultTextField.setForeground(Color.red);
                            this.resultTextField.setText("MISS");
else if...//other variable
//other variable
}Anyway maybe i need to implement a model for each of the 10 JtextFields
so that they update automatically.
I dont know if this is feasible but i imagine i can do it just like i set up a model for a JList.
I think that the best way is to create the models and then call once the notifyObservers() which should only do a repaint.
Am i correct?
I think i'm missing something(maybe many things) about the correct use of the Observer-Observable (i've seen some tutorials)
but i need to know if i can render my work more elegant but not rewriting all code.
Thank you very much.
Chris

i use the JtextFields for output.
Sorry i'm new to java and even if i program intensively for the last 8 months
some things are not so clear to me..
Ok i know that exists the default model which i can get like this:
pcTextField.getDocument();should i register the document listener with the JtextField?
Please If you can, give me a very simple example(i dont want to waste your time) .
I initially thought that i have to create a proper class which implements necessary methods for
auto-update like this one i did for a JList:
class RegList implements ListModel {
        public void addListDataListener(ListDataListener l) {}
        public Object getElementAt(int i) {
            String rval = "";
            if (i < 16) {
                int regNum = i * 2;
                for (int j = 0; j < 2; j++) {
                    int theReg = regNum + j;
                    rval = rval + names[theReg] + " = " +
                           (regs[theReg]) + " ";
                return rval;
            } else {
                return rval;
        public int getSize() {
            return 32;
        public void removeListDataListener(ListDataListener l) {}
    public ListModel getRegListModel() {
        return new RegList();
}Thank you very much,
while waiting for your answer i go give a look at documentListeners.
Chris

Similar Messages

  • How can I create a Text-Input Field in BexAnalyzer for a Planning Function

    Hello,
    i want to create a pre calculation(contribution accounting) for Materials in BI-Integrated Planning. These Materials aren't in the master data. So I create a new Info Object for pre calculated materials with only a material-number as key and a text-description.
    Now I want to write a Exit-Function, which creates new materials in these Info Object. The user should start this function in a planning application in BexAnalyzer. There the user should have the possibility to enter a text-description for the new material. How can I create such a Text-Field in BexAnalyzer and how can I read this text filed in a planning function (exit).
    Thanks in advance

    Hi Jürgen,
    you can create a parameter for this in the exit function and a variable for the parameter. In BEx Analyzer then create a button for the planning function; in the button parameterization use VAR_NAME = , i.e. use an Excel formula here to get the value from an Excel input field.
    The command range should be some 'hidden area' in your Excel sheet.
    But may be you don't need this. Use a characteristic without master data. Then ensure that that the query uses the option 'key' as display. In new lines you can then enter the key, the system creates a SID on the fly (but the text table will not be updated). In this scenario you may take text also from the key. May be you can update the text table (online or in batch) by simply using function modules from function group RSNDI_MD (not released by SAP).
    But observere that the system in BI Planning reads only the active version, i.e. if you change something on the fly the changes may not be visible.
    Regards,
    Gregor

  • HOW CAN I CREATE A GROUP WITH MY CONTACTS FOR TEXTING

    HOW CAN I CREATE A GROUP WITH MY CONTACTS FOR TEXTING

    Olga, this is not a default feature in iPhone. You need a 3rd party application. I have created a free one, Easy Group, for group texting and group emailing.
    http://itunes.apple.com/fr/app/easy-group/id461469079?mt=8
    Rémi
    Note: I may receive some form of compensation, financial or otherwise,from my recommendation or link.

  • Daughter has an iPhone and she can send me a text but when I text her back I get error code 2127

    My daughter has an iPhone and she can send me a text but when I try to text her back I get the error code 2127. Does anyone know what this means? Does this mean my messages to her are being blocked somehow?

    Usually it means you are texting a number which isn't 10 digits in length.  I would recommend that you delete the entry in your Contacts for your daughter, then find the text she sent you and create your new Contact from that. If she is listed in your favorites - delete her from there too, then re-add after a successful hook-up.

  • How can I create a text pop up window in my Pages document? I want text to pop up when the reader hovers his/her cursor over a certain word.

    How can I create a text pop up window in my Pages document? I want text to pop up when the reader hovers his/her cursor over a certain word in the document. I am teacher. So for example when a student came to word he/she did not know, if he/she hovered the cursor over the word, a defintion or other information would appear.  You can do this in Word using bookmarks/hyperlinks but I can't figure this out in Pages. I can link it to another point in my Pages document but I just need the text to pop up - not take the reader to another location.  THANK YOU!!!!!!

    Have you tried Word for Mac?
    You will need to test if links survive export or printing to .pdf
    Peter

  • How can I edit my website from another computer? and how can I create a new website next to the one, I have already? Can anyone help, please?

    How can I edit my website from another computer? and how can I create a new website next to the one, I already have? Can anyone help, please?

    Move the domain.sites file from one computer to the other.
    The file is located under User/Library/Application Support/iWeb/domain.sites.  Move this file to the same location on the other computer and double click and iWeb will open it.  Remember, it is your User Library that you want and not your System Library, as you will not find iWeb there.
    Just create a new site on the same domain file and it will appear below the other site.  If you want them side by side then duplicate your domain file and have one site per a domain file and they can then be side by side.

  • I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this

    I have a Mac Pro 4,1 quad core intel Xeon running mac OSX 10.6.8 and I have just moved studios and now need to use the Internet wirelessly but there's no airport facilities on this model can anyone tell me what model of airport card I would need for this mac

    Instead of getting a wireless card for the Mac Pro, you might want to consider getting an 802.11ac wireless bridge device that would enable you to connect more than one device to it by Ethernet cable and to eventually take advantage of the faster 802.11ac wireless standard.

  • I am having external hard drive and i can't create a new folder.The option crete new folder is foggy

    i am having external hard drive and i can't create a new folder.The option crete new folder is foggy

    Macs can't write to, nor create folders on, NTFS formatted drives without the use of third-party software.
    If you want to maintain the NTFS formatting, try Paragon's NTFS for Mac -> http://www.paragon-software.com/home/ntfs-mac/.
    Good luck,
    Clinton

  • Maximum number of vlans and HSRPs can be created?

    Hi,
    would appreciate if anyone can advise what is the maximum number of vlans as well as HSRP can be created? Is it the same for all layer 2 and 3 switches?
    Thanks
    Christina

    VLANs - about 4096 - switch dependent
    HSRP - 16 groups max

  • I have the retail iCloud account. How can I delete it? And how can I create my own account?

    I have the retail iCloud account. How can I delete it? And how can I create my own account?

    Welcome to Apple Support Communities
    To delete the iCloud account, open Settings > iCloud, scroll to the bottom and select Delete account. Then, log in with the Apple ID you want to use with iCloud

  • What is matchcode objects and how can we create tthem

    hai to all.
         what is matchcode objects .
         and how can we create matchcode objects
         and how will it works

    Hi
    In which version of SAP are you working?
    Matchcodes are replaced by SEARCH HELPs in latest versions
    see the doc
    1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
    2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
    3)An elementary search help defines the standard flow of an input help.
    4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
    5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
    6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
    CREATION:
    Go to SE11 Tcode
    select search help
    give the 'z' search help name and create
    select the selection method ur table name eg : 'mara'
    dialog module 'display value immediately'.
    add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
    where left position when displaying and spos = search position
    and then save and activate ..
    See the links:
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
    https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=2176485
    https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=3601619
    pls go through this for search help creation
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm
    Search Help Exits:
    Re: dynamic values for search help
    Re: Dynamic search  help
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/content.htm
    http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_exit.htm
    https://forums.sdn.sap.com/click.jspa?searchID=4390517&messageID=1712818
    Collective search help Combine several elementary search helps. A collective search help thus can offer several alternative search paths.
    A Collective search help provides alternative search
    Paths by combining elementary search helps.
    Only one search help can be attached to a field, table or data element. Several search paths are therefore attached with a collective search help.
    A collective search help also has interface parameters like
    an elementary search help.
    Like an elementary search help, a collective search help has an interface of IMPORT and EXPORT parameters with which the search help exchanges data. Using this interface, the collective search help can be attached to fields, tables and data elements exactly like an elementary search help.
    Parameter assignment needs to be done for each of the
    Included search helps.
    When you define a collective search help, there are no components for describing the dialog behavior and data selection; instead the included search helps are listed here. You must assign the parameters of the collective search help to the interface parameters of the included search help for each inclusion.
    User may choose the tab and thus the elementary
    search maethod.
    When we execute the search help SCUSTOM, we are confronted with a dialog which gives us an option of either restricting
    By 1)Search for customer according to booking
    2)Search for customer according to name.
    These are effectively the elementary search helps (SCUSTOM_BOOK and SCUSTOM_NAME) which have been included in the collective search help SCUSTOM.
    HOT KEY
    The hot key is used to select the elementary search help from the collective search help and to enter the restrictions in the dialog box for restricting values directly from the entry field. If the user often searches for values using the same search help, this procedure can save time.
    Steps to create a Collective Search Help
    1)Enter the search help name and click on create.
    2)Choose Collective search help radio button option as the search help type.
    3)Enter the search help parameters.
    4)Instead of the selection method, we enter the included
    search helps for the collective search help.
    5)We need to assign parameters for each of the included
    search helps.
    6)Complete the parameter assignment by clicking on the push button
    7)Collective search help offers the user to obtain F4 help
    using any of the included search helps.

  • I have a iPad 2 and I can't send a text messege please help?

    I have a iPad 2 and I can't send a text messege please help?

    See Here  >  Troubleshooting Messages
    http://support.apple.com/kb/TS2755

  • How can I create a new E-mail address for the Marketing Manager

    Hullo,
    how can I create a new E-mail address for the Marketing Manager (i.e. marketing professional role in SAP CRM) please.
    That when you go and create a new E-mail campaign you need to choose an E-mail form in addition to the E-mail address of the Marketing Manager.
    Kind Regards.

    Hi Alhussien
    Add it to his Position in the Organisational Model. Transaction PPOMA_CRM.
    Under there address section is an option to populate the email address.
    Regards
    Arden

  • Can't use Find My Friends on iPhone due to Apple ID not being verified. Can't do this as I can't access my .mac email any longer and I can not change the primary e-mail address for my Apple ID!

    Can't use Find My Friends on iPhone due to Apple ID not being verified.
    Can't do this as I can't access my .mac email any longer and I can not change the primary e-mail address for my Apple ID!
    So my options are:
    Create a new Apple ID, use that and lose all the apps I've purhcased with it (a fairly substantial amount)
    Somehow Migrate these purchases over to a new Apple ID
    Apple let me change the primary ID for the account
    Anyone else ran into this before?
    I've tried accessing the mail through a mail application using the correct server information, and trying both the old 6 character password and the one I had to change it too after they updated the security guidelines - neither work.
    Help would be greatly appreciated as I can see more services down the line not working without the address being verified!

    To change the iCloud ID you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iDevice, then sign back in with the ID you wish to use.  When you do this you may find that the password for your old ID isn't accepted.  If this should happen, and if your old ID is an earlier version of your current ID, you need to temporarily recreate your old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You should not need to verify the old email address.  You can now use your current password to turn off Find My iDevice on your device, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • Where can I get the Text to Speech utility for Captivate 4?

    I looked all over the Adobe site. Where can I find the text to Speech utility for Captivate 4 and the voices that go with it. A URL to the download site would be perfect.

    It has been discuss a few posts down to your recently, as indicated correctly by Micheal.
    http://forums.adobe.com/thread/944601?tstart=0
    Thanks,
    Anjaneai

Maybe you are looking for

  • SAP BPC 7.5 - Loading Directly from r/3.

    Hi, anyone which has experience in loading directly from R/3 into SAP BPC ? are there any starterkits for this ? Only I can find are IFRS, but there are of course many starterkits which can be purchased from 3rd part. Pro/Cons using this direcly load

  • Problem MacBook Lion and TC file recovery from previous Mac

    I had backed up my Macbook (white) with Snow Leopard with Time Capsule. After having upgraded to a new Macbook Pro with Lion, having done migration, I found that not all photos or files have been transferred over. I am now trying to get them back fro

  • Networking OS9.2.2 G3 imac with OS10.4.6 G5

    We had a power failure here today and both my imacs went down, the routers and everything. All appears to be fine with no data loss. I have the two imacs connected via LAN router and have had no trouble logging onto each computer from the other but a

  • Mac cursor disappeared. OS Lion 10.7.2

    I am having this problem for few days now. It happened when I was watching a stream video in full screen mode, then I move to another screen (3-finger swipe) to work on something else and the cursor disappeared. It's fine when I am not waching in ful

  • Query on Clustering,Load Balancing and Dehydration in Oracle BPEL PM

    Hi, I had a Few queries on Dehydration ,Clustering and Load Balancing: 1) In section 5.1 "Use Case for Asynchronous Web Services",insertion of a dehydration point is mentioned.What do you exactly mean by this.Can a dehydration point be inserted expli