Copy Paste Not supported ? ? in CheckComboBoxDropDown

Created a custom Check combo box drop down component.

this appears as a column in my table.

when i select a row in the table, copy it and paste it in xls or word, the value for the column appears like this --> [Ljava.lang.Object;@cdc74

Say there is a country dropdown, and if my application has INDIA as the selected value for this dropdown when i launch the UI,

when i copy this row, and paste it ... i should see INDIA not [Ljava.lang.Object;@cdc74

how can this be resolved ?

Note : the values stored in my dropdown are "Objects". i use the renderer to display INDIA (country name)

[631 byte] By [VidhyaShankara] at [2007-11-26 16:54:12]
# 1
> how can this be resolved ? To have the model store Strings?
kirillga at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 2
If you want to store non String Objects then you need some custom code. This example gives two approaches: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=613731
camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 3
Wow ... i think the toString() implementation of the class will greatly help me.let me try it out tomorrow.thanks a ton.:-)
VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 4

The toString() approach worked BUT with one exception.

Doesnt work for multiple selection combobox.

If i select say 5 countries, i select 5 country objects. I show the comma seperated 5 country codes.

Now, the object returned to the renderer is an Array[] of my Country Objects. Not a single Country object so that i can override the toString() method to show what i want.

so there is a problem still !!!! :-)

VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 5
> so there is a problem still !!!! :-) So then fix it, don't look at me to write your code. You where given two options and I told you which one was more flexible....
camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 6

hey listen.

what the H**** ? whats ur problem ?

if you feel you are a genius keep it with you. there are ppl better than us.

ppl come here to get help for the problems they face. not for someone like you to show off.

if you dnt know say i dnt know and shut the thing and go.

none is standing upon ur head and begging you for a soln k ?

VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 7

Sorry you are the one with the problem. I guess you don't want help in the future which is fine by me.

I gave you two solutions. You choose the use the "easy" solution even though my example said there was a more flexible solution. So know its up to you to go back and understand the other solution and make the changes.

I'm not going to write the code for you. Besides you question doesn't make sense, so I'm not going to guess what you are doing.

Notice how my example had fully compileable and executable code so you could see the behaviour.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.

camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 8

dear...

this is not a one to one forum.

when i come here, post my problem, i expect many views.

it is not that i am replying upon YOU ALONE to get my problem solved.

a forum is a place to share thoughts and grow knowledge.

this is not a place for a single teacher and students.

so many like me might have come across simillar situations. when they read this they might try to give some tips. or if someone has a simillar issue they will continue to watch this thread ...

so this helps everyone to understand where is the problem and what could be a possible solution.

when i said theres still a problem i dint laugh at you and say hehehehe ur code dint work. i meant that i still have problem areas to address.

hope you get my point clearly. and thanks that you took your time to provide pointers. continue the good work.

VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 9
> i meant that i still have problem areas to addressAnd I gave you a suggestion on how to address the problem. I don't appreciate the tone of your response when all I did was try to help you. I am under no obligation to provide working code.
camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 10

oh my gosh ...

you are not understanding what i am saying.

i dont want any solutions from you anymore. i am not looking at you for help.you gave some pointers thats fine. thanks. i am not asking you for any working code. i am not asking you for any help on the problems i still face. please understand what is a forum first !!

if i myself is gonna get a solution for this i am gonna post that here so that others will get benefited.

for your first reply i said thanks and i had put a smiley. dint you like it ?

the other one is cuz of the way you responded.

VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 11

> the other one is cuz of the way you responded.

And I responded because of the way you responded. You said it still wasn't working. The implicatoin being you wanted us to provide you with more help. So I suggested you do a little work on your own and use the "more flexible" solution I provided you with earlier rather than rely on the "easier" solution. In other words I wanted you to do some thinking for yourself and not rely on use just because you came across a problem.

You didn't provide any detail about what you where doing and expected use to come up with a solution.

<> i am not asking you for any help on the problems i still face.

Stating you still have a problem imples you want more help.

> please understand what is a forum first !!

I think I know what a forum is.

camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 12

i'm telling you again ... repeatedly.

working on their own. or to get a quicker help or anything is one's wish.

none has to teach none how to learn or how to work or how to address issues. ppl know.

"You didn't provide any detail about what you where doing and expected "us" to come up with a solution."

what is that "us" "us" "us" ? is that "us" the ppl employed by sun microsystems to answer questions and teach ppl how to work on issues ?

this is a forum ... come on pal. come on ... i had provided tons of solutions to ppl in the area of sturts and servlets and JSPs and EBJs

but i never felt like you ... "oh no ... dnt come to me you silly boy ... go learn ... apply thought ... do something ... dnt be lazy".

ok now here is the end. i'm stating clearly that i dnt want anymore pointers on that issue from anyone. especially u k ? u dnt have to waste your time in replying this thread. instead .... oh wow its time to sleep.

bye n good night bro.

VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 13
lets not waste time and space. -- THIS TOPIC ENDS HERE. THE AUTHOR OF THIS TOPIC WILL PROVIDE WITH A SAMPLE CODE ON HOW TO GET THESE KIND OF PROBLEMS RESOLVED
VidhyaShankara at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 14

> lets not waste time and space.

I agree. I don't know why you keep responding. You should be creating a SSCCE so we know what you are talking about and can better understand your problem.

The point I'm trying to make is that is the suggestions don't work, then you are doing something unusual. If we don't know what you are doing then we can't help.

camickra at 2007-7-8 23:21:50 > top of Java-index,Desktop,Core GUI APIs...
# 15

oooppssss.

u dnt seem to be giving up.

ur first solution is to override the toString() -- the easy way.

second one is creating a custom renderer, which i have already in my code. i have my own renderer to display what i want when i select one or more items from the combo box.

it is like this. assume a currency dropdown.

it has an associated model - the class Currency

Currency {

String code;

int country;

String isoCode;

...

...

...

}

the dropdown will have n number of such models.

clear till here ?

now, this is a multiple selection combo.

say when you select USD, CHF, JPY, AUD, EUR there will be 5 models selected.

then when u have your own renderer and when you select all these 5 models will goto the renderer to decide what to display. the renderer will get these 5 models contained within an Array[]

say the renderer has a method to iterate through these currency objects, takes out the iso currency code, seperates them with a comma and sends it for display....

clear ?

so when i select 5 currencies ... i see the 5 currency codes in the label of the combo box..

clear ?

but when you select this and press ctrl C... when you copy ... what would be the copied object ?

think abt this in the perspective of an end user. i see 5 currency codes ... when i copy them and paste them in textpad or excel or word i should get the comma seperated curency codes pasted.

write a SSCCE for yourself and see what you get. you will get the array which contains those 5 currencies. toString() will be applied on that array and all you get is something which you can not interpret.

clear ?

now. by telling such a long story, i am not asking you how to get rid of this issue. please understand. no obligations. when i come up with a solution i will come back here and say what i did and what worked.

oooopppssssss .... ppl ...

VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 16

> write a SSCCE for yourself and see what you get.

What nerve you have. This is your problem, not mine. I don't understand the verbal description of the problem. I have told you several time I am not going to guess what you are doing because the solutions I suggested work just fine with a normal combo box.

If you want an answer you make the effort. Now you know why my tone was a little harsh earlier. You are not making any effort whatsoever to provide us with a SSCCE so we can see exactly what you are doing.

You already have the code written. You just have to package it as a SSCCE. Why would you expect us to start frome scratch and create a SSCCE that trys to copy what you are doing?

> now, this is a multiple selection combo.

There is no such thing in the standard jdk, so how are we supposed to write a SSCCE anyway?

camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 17

<<What nerve you have. >>

well what nerve you have ?

<<. I don't understand the verbal description of the problem >>

First you understand the basic english words - I said "

I DO NOT WANT YOUR HELP.

I DONT WANT YOU TO THINK ABT THISS.

I DONT WANT YOU MR CAMICKR TO SPEND TIME ON THIS.

I DONT WANT YOU TO GIVE ME A SOLUTION FOR THIS

I DONT WANT YOU TO ... COME ON ...

I CANT EXPLAIN IT SIMPLER.

JUST BUZZ OFF'

DNT GET ON TO MY NERVES.

EASY.

FORGET THERE IS SUCH THING - COMBO BOX EXISTS IN SWING.

OK ?

ERASE THIS TOPIC FROM YOUR MEMORY K ?

DNT THINK ABT THIS.

DNT THINK ABT ME.

THIS FORUM IS NOT OWNED BY YOU.

LET OTHERS HAVE A LOOK AT IT.

NO MONOPOLY HERE. I DONT WANT YOUR COMMENTS HERE.

UNDERSTAND ?

LEAVE THIS THREAD ?

YOU WANT ME TO START ONE MORE ? DO YOU ENJOY FIGHTING HERE ?

DO IT ALONE ... I WILL GO OFF. K ?

VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 18

> DNT GET ON TO MY NERVES.

Then learn how to ask a question with all the information needed to solve the question.

> THIS FORUM IS NOT OWNED BY YOU.

Never said it was.

> LET OTHERS HAVE A LOOK AT IT.

Others are free to answer the posting and help you solve the problem. No one else has. Is that telling you something?

> NO MONOPOLY HERE. I DONT WANT YOUR COMMENTS HERE.

Like you said its a forum. I am free to express my concerns about your attitude.

> LEAVE THIS THREAD ?

You are the one who keeps responding and attacking me even though I'm trying to help.

By the way your "Caps Lock" key is stuck. That is considered shouting on the forum and most user don't respond well to shouting.

camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 19
oooppppsssss-- THE END -
VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 20
You are still wasting time when you could be working on your SSCCE.Learn how to post a real question instead of all your comments that don't add anything to your question. Thats how you get an answer.
camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 21
look enough of your advices.i do not want to take them. means nothing to me
VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 22
But you need the advice. Nobody else is willing to help. Apparently you don't want to get this problem solved, but the advice might come in handy the next time you post a question.
camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 23
problem solved now.i think u need advice now, keep ur head right on top of your shoulders.if you think you are flying then slow down ... lower the altitude ... come down a lil bit. learn how to behave in a forum. learn how not to provoke.
VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 24

> problem solved now.

See, it wasn't that difficult to solve the problem on your own given a suggest approach now was it?

Now maybe you should post your solution so others can benefit, just like I did in my original response. Thats what a forum is about...sharing.

> learn how not to provoke

I don't provoke. I responded to provocation by you. Just because I don't write the code for you gives you no right to throw insults at me. I will contiue to respond to individuals who respond in an incorrect manner.

camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 25
none of the approaches were helpful to solve this issue anyway. see you are still on the wrong leg. did anyone ever ask you a working code ? how can you say that i wanted to get a working code from you ? who asked u ? did i ?
VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 26

> none of the approaches were helpful to solve this issue anyway.

Well you haven't posted the code for the benefit of others so I wouldn't know. Apparently you still haven't learned to share.

> how can you say that i wanted to get a working code from you

You asked a follow up question. The implication is that you want/need more help.

I gave you more help by suggesting you look at the "more flexible" way to do the rendering. I didn't understand your requirement so I couldn't give a more detailed suggest, which is why I asked for a SSCCE. You didn't like that suggestion and where not willing to make an effort to create a SSCCE, so I was not going to make any further effort to help you. Looking back at your question, if I understand what you are asking then it could have been solved in about 5 lines of code but I guess we will never know because I have no way to test my idea?

camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 27

was that ever a problem of rendering ? ? ?

certainly not !!!!

i had never had a rendering issue in this.

rendering is to decide what you should see when you select items from there. i have my own custom renderer to do that job.

wasnt the problem i stated was about what the combobox actually contains in the back and what comes out when u press ctrl+c ? ?

so you dint even understand the problem and started suggesting ?

were you simply wasting time here ? or doing some timepass to show off that you are a great master ?

VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 28

When I look back at the question I missed the part about the table. Your question was about a combobox.

However, my original suggestion seemed to work. So I continued to answer the posting based on my original understanding of the question.

It wasn't until your 15th posting that you mentioned something about "Ctrl-C". By that time I was fed up with your attitude and really wan't paying attention to your question.

> so you dint even understand the problem and started suggesting ?

I admitted I needed a SSCCE to see what you where attempting to do. How many times did I ask for one? You refused to post one or provide any information relevant to your problem instead you started a "shouting" match. I will not accept that language or tone from anyone in the forum.

You still haven't posted your solution. You are still unwilling to share knowledge in the forum.

camickra at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 29

<<Note : the values stored in my dropdown are "Objects".

i use the renderer to display INDIA (country name) >>

Sir.

This is my first, very first post in this topic.

It says that I AM USING A RENDERER !!!!

were there any confusions here ?

<< until your 15th posting that you mentioned something about "Ctrl-C".>>

Please read the title of this topic.

It says, Copy Paste not supported ? ? ? ?

what did this meant to you ?

Problem was copying a cell(which is a combo box) and pasting it in excel or word.

VidhyaShankara at 2007-7-21 16:53:34 > top of Java-index,Desktop,Core GUI APIs...
# 30

I told you I misread the question because the question was confusing.

Remember the link I provided you?. It dealt with a combo box and only a combo box. You said the suggestion worked. So that reinforced my belief that you where working with a combo box as the topic title suggested.

> It says that I AM USING A RENDERER !!!! were there any confusions here ?

The confusion is that your question talks about two components. A combo box and a table. Both components can use renderers. You do not state which component you are using a renderer for. Again I thought your question was about a combo box, because that is what your title is about.

> what did this meant to you ? Problem was copying a cell(which is a

> combo box) and pasting it in excel or word.

Its a confusing statement. A cell is not a combo box.

The TableModel stores data. The data in the TableModel is an Object of some kind.

It doesn't matter whether the editor for the cell is a combo box, a text field or another component. The data is used in the copy function not the editor (or the renderer).

So again I was confused because you said the problem was with the combo box. When in fact the problem was with the data in the TableModel.

So you think you asked a clear and concise question, but in fact it wasn't very clear at all.

Remember you have the code in front of you and know exactly what you are trying to do. I don't have that benefit, which is why I, several times, asked you to post a SSCCE so I could see exactly what you where doing.

camickra at 2007-7-21 16:53:38 > top of Java-index,Desktop,Core GUI APIs...
# 31
But... He used BOLD words... I can't understand why nobody else was interested in his question... I mean they were BOLD!!! They're supposed to attract ATTENTION!!!! OMG!!!
kirillga at 2007-7-21 16:53:38 > top of Java-index,Desktop,Core GUI APIs...