NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Adding an "All Items" field to a jcombobox

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Sofia
Posted via mailing list.





PostPosted: Sun Mar 05, 2017 6:18 pm    Post subject: Adding an "All Items" field to a jcombobox Reply with quote

In the design environment, I am binding a jcombobox to an entity called
Items. I use a custom renderer so that the box shows only the name of every
item currently in the database. Is there a way to add to the same combobox
an extra field called All Items; I have tried adding a field manually, but I
get an exception "Cannot use this method on non-mutable objects". I am using
Netbeans IDE 8.2.



--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Adding-an-All-Items-field-to-a-jcombobox-tp5752184.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
mspence



Joined: 02 Apr 2009
Posts: 18

PostPosted: Sun Mar 05, 2017 10:03 pm    Post subject: Adding an "All Items" field to a jcombobox Reply with quote

When I have wanted to do this in the past, I have sometimes added a row to the query.  You may need to use a union.

(Not syntax checked and assumes Oracle)


select foo from bar union select 'All Items" as foo from dual;


Oracle and I think MySql has a table dual which has one row and one column.  If you are using a different database you may have to use a different table name but the idea is to make the database make a suitable row for you.


On Sun, Mar 5, 2017 at 1:16 PM, Sofia <address-removed ([email]address-removed[/email])> wrote:
Quote:
In the design environment, I am binding a jcombobox to an entity called
Items. I use a custom renderer so that the box shows only the name of every
item currently in the database. Is there a way to add to the same combobox
an extra field called All Items; I have tried adding a field manually, but I
get an exception "Cannot use this method on non-mutable objects". I am using
Netbeans IDE 8.2.



--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Adding-an-All-Items-field-to-a-jcombobox-tp5752184.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo