User Profile

Collapse

Profile Sidebar

Collapse
no1zson
no1zson
Last Activity: Sep 8 '07, 05:53 AM
Joined: Jul 13 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    I think the term "primary number" is our problem. I am not sure what that means or implies, I simply wanted itemno field to be automatically kept in ascending order instead of user entered.
    Each new disk has a number higher than the previous last numbered disk.

    From all my testing and retesting this solution satisfies that requirement.
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Adding a Restock Fee
    in Java
    I just went through that class. Get ready to rewrite your entire primary class.
    It is fun. :o)...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    I do not know about all that, but it is working as planned, so I am leaving it alone before I break it. :o)

    Thanks Jos
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    Well, as I was going through and coding everything it dawned on me, I am already using a counter in my app, currCD that is tied to my list index.

    I simply changed two lines of code.

    I set itemno=(currCD+ 1) so that it would not start with 0 as the index does
    and I added ++currCD to my ADD button so that it would keep up with my new cds.

    It actually took longer to clean out all the stuff I put in...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    OK, my post was a little ambiguous.
    I did use three classes, two of them I already had.
    the first, as you pointed out was Inventory.java (my application)
    I initialized the components
    Code:
    public interface PrimaryKeyGenerator
    		{
    		public int give();
    		public void take();
    		}
    the second was simpleprimaryke ygenerator.java
    here is pretty self explainatory, i put
    public class SimplePrimaryKe yGenerator...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    OK. after two hours, several curse words I think I am pretty close.
    I tried to take all that and weave it into the fabric of my current code.
    This is what I have.
    I took the generator and put it into my primary Inventory class
    Code:
    public interface PrimaryKeyGenerator
    	{
    	public int give();
    	public void take();
    	}
    No compile issues so I moved forward.
    I then took the code from your...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    OK, that is an explaination I THINK I understand.

    So, I do not want the user entering anything in to my itemField, I should probably just set editable to false and be done with it right off the bat.

    I should then impliment the public int give(); every time a cd is added, which stupidkeygenera tor will give the next available number?

    Is that about the long and short of it, or am I twisted?

    ...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    I have read it, and I do think it will help, but reading about it does not show me how to code it in to my existing program. That is what I do not understand.

    I understand that you do not wish to just hand out code,

    but could you show code examples of what I might try? I have never seen this implemented anywhere, it is hard for me to see how I would put it in action with what I already have.
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    wow. Now I feel dumb. I know nothing about arrays, and boolean is just a term to me at this point for true or false.

    I understand the basic concept, but have no idea how to code it.

    Am I reformatting the field? Am I creating a whole new field? Am I creating this bit and then applying it to my itemno field?

    I am lost.
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to Integer Field in JList ... renumbering
    in Java
    I did. It is what I thought of useing, but the API just confuses me.
    I do not yet understand how to use the API properly, so I have been scanning the internet for code examples of one that is actually being used, but I cannot find a model to try and use to set mine up.
    See more | Go to post

    Leave a comment:


  • no1zson
    started a topic Integer Field in JList ... renumbering
    in Java

    Integer Field in JList ... renumbering

    I do not even know how to correctly ask this question.
    I have an item field in the code I am about to post. Simple intger meant to be an item number for a cd. The user enters this number.
    Over the last week I have played with Add buttons, Del buttons, Modify and everything else and it brought to light a problem I want to address today.
    I have always just used 1 for the first item, 2 for the second and so on ...
    well after...
    See more | Go to post

  • no1zson
    replied to listModle.modify
    in Java
    You are right Jos. I have only 2 or 3 more things to do in order to close out this app and get it doing what I want it to.
    I will then go back through it and "clean it up" ... this is my first experience with Java and I am just trying to see what is what right now.

    Validation is also a concern when I go through on my second sweep. I fear if I try and do everything at once then I may just confuse myself further and...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    I know it has been commented on earlier in the thread, but I did not understand the solution.
    I know the list does not like the information I am trying to pass to it.

    The $ comes from the decimal formatter I have put in.
    That was the issue. I took the $ out of the formatter and just left it at 0.00, put the $ into the label instead, and all is well.

    You guys are great.

    Of course that was...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    perfect. I think I should have known that.
    Of course, this leaves me at my original problem.
    When I pull in a cd to modify, it performs step one and deletes the current element, but goes all crazy without adding the new cd.
    It looks as if it does not like the formatting of my fields, but I cannot figure out why.
    This is exactly how I ADD cds to begin with, why would it not work this way?
    Here are my buttons, so...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    That makes perfect sense now doesn't it!?

    Of course I should then have to set it for my LAST button as well, which I thought I did, but same problem.
    Is this not the equivilent to the last element? Is listModel.size?
    Code:
    CdwArtist newCD = (CdwArtist) listModel.lastElement();
    			currCD = listModel.size();
    			
    
    			artistField.setText(newCD.getArtist());
    			cdNameField.setText(newCD.getName());
    ...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    I see. Playing with my app, trying to debug I have discovered some kind of currCD problem.
    My delete button deletes the last cd put in the list, not what I think should be the currCD.
    When I hist FIRST for example, the first cd in the list populates my fields ... is that not set up to be my currCD?
    The way I read it, it is. Why then would my Delete button not delete that element?

    This confuses me.
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    You are correct, I am sorry. (new to this)
    When I hit Modify ..
    The last entered cd into my list is deleted, NOT the one I have in the fields ... then I get these errors
    Code:
    ---jGRASP exec: java Inventory2
    
    Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "$1.00"
    	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
    	at
    ...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    I have tried to Delete current, and then Add new cd but it is not working.

    Can you see my problem? Logic being, delete whatever cd I am currently looking at, take what is in the fields at that time (modified data) and create a new element. After new element is added, clear fields.
    Code:
    	// Modify cd
    			listModel.remove(currCD);
    			
    			// Create cd to add
    			CdwArtist newCD = new CdwArtist();
    ...
    See more | Go to post

    Leave a comment:


  • no1zson
    replied to listModle.modify
    in Java
    That is on the horizon ... sort of.
    I will be changing the itemno field to stay in order. For example,
    if I have 10 cds, they should be labeled 1-10 in order.
    if we delete # 8, the remaining 9 should reorder accordingly ... if we add one, it should automatically take on the next number in line.

    I do not think that will affect this current task at all though.
    like listmodel.remov e, listmodel.add, listmodel.firss t...
    See more | Go to post

    Leave a comment:


  • no1zson
    started a topic listModle.modify
    in Java

    listModle.modify

    I have been adding buttons to my GUI to manipulate list data.
    I added a Delete button this morning in case I decide I no longer needed a particular element.
    I am now working on a modify button, in case I want to keep the element, but only modify a field or two.
    This seemed easy after my Delete, but now I am having issues with it.
    Is there a listModel command out there that I am unfamiliar with that will help me with this?...
    See more | Go to post
No activity results to display
Show More
Working...