@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> aaah i need to go out
<0> its a friday night
<0> and im doing java
<0> later everyone!
<0> thanks for the help
<1> hello all
<2> hello
<3> anyone here familiar with the savitchin cl***?
<4> there is no savitchin cl***
<4> just ask your question
<5> hai
<2> lol, savitchin cl***
<2> But it really exists. Named after Walter Savitch, University of California, San Diego.
<6> what is java?



<6> why use java?
<6> how to use java?
<6> help please
<4> Java is a programming language
<4> there is no rational reason to "why"
<4> you use it by programming with it
<7> why use java?
<7> lecturer makes you
<7> wantto make a program
<2> Here is a general overview: http://java.sun.com/docs/books/tutorial/getStarted/intro/index.html
<6> hoo.. arigatou gozaimashu
<8> .
<9> Your Queen is Back
<10> Hey guys. Anyone available to help a newbie with some queries?
<11> probably. just ask and see if anyone answers
<10> Ok, well. What I have is an ArrayList of objects. Each object has values set. What I need to do is loops through the ArrayList, and ***ign the values from the objects to an Array (in order to display them in a JTable). My problem is ***igning the objects to something. I've tried things such as: for (obj a:ArrayList) { a = ArrayList.get(n); } but I get an error stating required obj, found java.lang.Object.
<10> I mean I can loop through the ArrayList fine, just can't think how to ***ign each object to something in order to recover the values set for each.
<11> you can make the jtable read directly from the ArrayList
<10> oh no, really?
<10> but if the ArrayList consists of objects, and it's certain values from those objects I want displayed in the JTable. How would I go about doing that?
<11> http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data
<11> you can make the table model return the value you would like displayed regardless of its source
<11> to turn the list into an array you could have done myList.toArray()
<10> yeh, i've seen the toArray() method. Had no joy with that either. I've been trying to write some test code. If I stick that up, would you have a look for me?
<11> ok
<10> Ok, this is purely test code, just playing around. http://pastebin.ca/315308
<10> That's where I get the incompatible types error. As it requires 'moo' but finds java.lang.Object. Basically all I need to do is ***ign the object to something. Or as you say, figure out how to have my JTable display the values of each object directly. Which, from reading the page you posted am still non the wiser :P
<11> are you using java 1.5?
<10> no, 5
<11> same thing
<10> oh :P
<10> yes then :/
<11> the old 1.4 and less way was myMoo=(Moo)list.get(12);
<11> the new 1.5 way is List<Moo> cows=new ArrayList<Moo>(); myMoo=cows.get(12);
<11> since List deals with Object, which is a supertype of Moo, you have to explicitly say "I know this Object is really a Moo" using a cast "(Moo)myObject"
<10> ohh I see
<10> kinda of
<11> the new 1.5 way lets you say that this is a list full of Moo, so you don't have to specify it all the time
<10> so in the case of my example would be: ar<moo> cows = new ArrayList<moo>(); for (moo MyMoo : ar) { myMoo = cows.get(count); }
<10> ahhh right, I did see you could specify the object used in an ArrayList with <>'s
<11> actually no, myMoo is just a reference, it won't modify the array
<11> you could do something like int index=0; for(moo myMoo : mylist) { myarray[index++]=myMoo; }
<11> or mylist.toArray(new moo[0]);
<10> humm, ok.. let me give this a go. Will probably come moaning again in just a sec :P
<10> in your above example, would 'myarray' be declared like: moo[] myarray ?
<11> yes, and initialised to the size of the list
<10> yes. omg you're a genus! I've been trying to solve this for about 4 hours now and you've just cracked it for me. Thank you so much.
<2> I guess <10> is koala_man, sounds totally like him: http://www.google.de/search?num=100&hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=%22tigercrypt+needs+a+pony%22&btnG=Search
<11> haha
<11> it was me, apparently
<9> who stole the pen ?
<9> koala_man stop playing
<11> never!
<10> You still around koala_man?
<11> yep
<10> Ok, if I have a JTable displaying the results of one of my arrays. When the array is changed, say an extra value had been added. What's the best way to update the JTable accordingly?



<11> juco: if you extend AbstractTableModel, you can use fireTableRowsUpdated(first,last)
<11> or another appropriate method from http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/AbstractTableModel.html
<10> ah right.. the only thing is my JTable is within my GUI cl***, which extends JFrame. Is that a problem?
<10> let me stick my code up again, see if you can make head or tail of it.
<11> it doesn't matter where it is as long as it can detect changes
<10> Well here's my code: http://pastebin.ca/315420 - it's very sloppy, I know. And at the moment the JTable is literally there to look pretty with made up values in the only way I know how
<11> I would suggest writing a table model that
<10> So you mean declare the JTable in a separate cl*** that extends AbstractTableModel and invoke it within the GUI cl***?
<11> no, just create a cl*** that extends abstracttablemodel and give it to the JTable instead of the String[][] directly
<11> you can also use the DefaultTableModel. it supports basic modification of the data
<11> it depends on how coupled you want the table and the underlying data to be
<11> the underlying data being your data source, pings or whatever
<12> hi
<10> oh god, i'm lost. Trying to read the How to use Tables tutorial. What exactly does the Table Model do? I mean what I have is an ArrayList, which I can possibly convert to an Array. And need to get the values of each object in the ArrayList/Array presented in the JTable.
<11> usually your information is not in an ArrayList, that's just something you build with the information you actually have
<12> could someone help me with one question? I have 2 network adapters installed on my PC is there any possibility exists to switch between them in Java program?
<11> but you can use a DefaultTableModel if you'd rather work with ArrayLists and such
<10> I see
<11> ttyv0: you can bind to a specific ip if that's what you mean
<12> and how can i do this?
<11> ttyv0: Socket.bind
<10> so koala_man would you declare a DefaultTableModel instead of a JTable or as well as?
<11> as well
<12> yess it's ok thank u but if i want to determine the IP address appointed to each interface?
<11> new JTable(myTableModel); myTableModel.addRow(new String[] {"lol", "cow"});
<11> ttyv0: InetAddress.getLocalHost()
<12> koala_man: yess it is true but this function returns only one IP
<11> which?
<12> koala_man: of one adapter
<12> and if i want to determine the IP addr of another one?
<11> hmm, there should be one that returns all
<11> how about getAllByName(getHostName())
<12> koala_man: hmm i'll try now
<11> no wait
<12> koala_man: ok
<11> well I dunno
<12> koala_man: thank u anyway
<11> on java 6 there's NetworkInterface
<12> do u mean to use NetworkInterface.getNetworkInterfaces() function?
<11> ah damn. yes. it's since 1.4, not 1.6
<12> koala_man: ok thankx a lot
<9> Your Queen is Back
<13> Hey all
<13> i Just wanna know somthing
<13> When Sun Systems Start Java
<13> which year ?
<13> any one can help
<13> ?
<13> is it in 98 ?
<13> acidjnk
<13> dibblego
<13> koala_man
<14> hello
<14> I have a not java question I figured techinaly minded ppl such as yourselves might have an answer for. I'm wondering in any of you know of software that can cord off bad sectors of a hard drive to prevent further use
<11> [Anthony]: how do you mean?
<11> [Anthony]: if you want to make sure files aren't allocated on bad sectors, that's the thorough scan/badblocks file system check is for
<11> or was for, before disks had that built in
<15> quisiera aprender java
<16> Hey guys. I have a a problem, When I call a method in one cl*** it works fine. When I call it in another cl*** it does everything bar one line. I can't see any reason Why it would be doing this. code is: http://pastebin.ca/315741 - The lines that do and don't work are commented
<10> the line commented 'this line works' adds a new row to the table. However, the line commented 'this line doesnt work' prints out the results, but does not add the row
<10> I am baffled.
<11> juco: you have two different tables
<11> you create one on line 64 and another on line 110
<11> 118]
<10> YES :D
<10> thank you again!


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #java
or
Go to some related logs:

#chat-world
#linux
#kl
#india
#india
chicasinocentes
#india
alev alev ferdun
MKAREZ
cancel onmousedown javascript



Home  |  disclaimer  |  contact  |  submit quotes