我甚至不知道如何正确地提出这个问题。 我要发布的代码中有一个项目字段。简单的intger意味着是cd的项目编号。用户输入此号码。 在过去的一周里,我玩过添加按钮,Del按钮,修改以及其他所有内容,它揭示了我今天要解决的问题。 我一直都有只使用1作为第一项,2作为第二项等等...... 我完成之后所有按钮都没有项目编号都在这个地方。 我怎么能这样做,以便项目编号字段将被重组并保持升序无论添加或删除什么? 如果我删除cd number 4,那么make 5 number 4 ,6号5等等...下一张CD应该只取下一个最高的数字... 这有意义吗? 这是我的小班。如果需要,我可以发布其他内容。
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 I am done will all the button nonsence the item numbers are all over the place. How could I make it so that the item number field would be restructured and stay in ascending order no matter what was added or deleted? If I delete cd number 4, then make 5 number 4, 6 number 5 and so on ... the next cd added should just take the next highest number ... Does that make sense? Here is my primary class. I can post the others if needed.
展开 | 选择 | Wrap | 行号 推荐答案不允许用户输入该(整数)键他/她自己。用户是傻瓜 众生一直犯错误。你看过 Bitset 课了吗?我可能会派上用场。 亲切的问候, Jos Don''t allow the user to enter that (integer) key him/herself. Users are stupid beings that make mistakes all the time. Have you had a look at the Bitset class yet? I might come in handy. kind regards, Jos
我做到了。这是我想到的用法,但API让我感到困惑。 我还不知道如何正确使用API,所以我一直在扫描互联网上的实际使用的代码示例,但我找不到一个模型试图用来设置我的工作。 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.
我做了。这是我想到的用法,但API让我感到困惑。 I did. It is what I thought of useing, but the API just confuses me.
它只允许你设置位或重置它们;单个位或它们的一个范围。 你也可以使用''或'',''和'',''xor''以及两个完整的位集。 你只需要简单的东西:得到第一个没有设置为真的位并设置 a位为真或假。将它与boolean []数组进行比较,除了BitSet比这更聪明。 亲切的问候, Jos
It just allows you to set bits or reset them; either single bits or a range of them. You can also go fancy and ''or'', ''and'', ''xor'' and whatever with two entire bit sets. You just need the simple stuff: get the first bit that wasn''t set to true and set a bit to true or false. Compare it with a boolean[] array except that a BitSet is more clever than that. kind regards, Jos
更多推荐
JList中的整数字段...重新编号
发布评论