| |
| |
| |
|
Page: 1 2 3 4 5
Comments:
<0> Ahh it <0> it's good to have X back again. <1> hey there. ive got a frame with a button (using swing). i want when i press the button the frame's setVisible option to be set to false. how do i implement that sort of thing in the actionPerformed command ?:/ <1> anyone ?:/ <2> Meddi: ... actionPerformed(...) { aReferenceToTheFrameObject.setVisible(false); } ... <1> reference as the name? <1> because i think i tried but it didnt work <1> Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: <1> window cannot be resolved <1> window is the name of the button's frame <2> that does not look like a javac compiler error. make sure to use javac, which is *the* standard tool for compiling java code. <1> i am using eclipse to run it <1> i get some more errors though (about 10lines) when pressing the button <2> it sounds broken. <1> actually it runs
<1> but when i press the button i get this error <1> plus 10 more lines of errors <2> i have never seen "Unresolved compilation problem". <1> want me to paste me code in pastebin ? <2> if you would be using standard java and a standard IDE i could possibly help. no clue about eclipse and co. <1> hmm :/ <2> i have no idea what would cause that error that you get. i suspect that eclipse or one of the tools used for your gui program screwed up. <1> though do u mind checking the code? <1> i might have done a mistake or anything <2> is that standard java code? <2> how many lines? <2> is it formatted properly? <1> 105 .. but lots of spaces and a few comments lines <1> i think so <2> url? <1> let me paste it mate <1> http://www.pastebin.ca/339207 <1> here it is <1> (there are 4 buttons but they are all useless for the time being.) <2> Meddi: do not try to run your application until you have fixed all compile errors. <2> that code does not compile. <1> mine compiles fine when i try to do it with eclipse hmmm :/ <2> if you run it before fixing all compile time errors you may be running with old .cl*** files generated by previous compile runs. <2> if that really compiles with eclipse, eclipse's java compiler is severely broken. <1> yeh i even get the programme running <1> but when i press gthe button i get some error <1> s <2> i am not going to explain the part about using old .cl*** files again. <2> Meddi: if you can't fix eclipse (by way of updating it, etc.) you'll have to resort to using javac on the console, else you'll stumble from compile time issue into compile time issue. the idea is that compiling the code ensures that you are not going stop-motion like that. <2> hi dave, cal <3> hi <1> ok i tried compiling it with something else now and it wont compile. though i get a cannot find symbol - variable 'window' errror <2> Meddi: yes, as you should. <4> aaah, all is back to normal now. Good, good.... <4> Clackwell: I take it we can ask HellHound to do its doggy doodoo some place else now? ;) <2> Meddi: at some point you will have to learn about and use instance variables. <1> is it possible to help me sort this thing out now though ?:/ please? <2> Lion-O: yes, with x being here, the ops re-enlisted, i think we can. <4> there we go.. <2> Meddi: i told you about "instance variables". <4> oh wait, I forgot <2> Lion-O, Revenger, thank you for lending the bot. <1> hmmm <1> anything specific i should check for in the API? :/ <4> :-) <2> Lion-O: make sure to remove all of them users in hh, etc. i guess :) <4> Clackwell: I'm pretty sure to speak on Revie's behalf if I say that we're both glad to be able to have helped out. <2> Meddi: no. this time you'll have to learn another language basic. the language is not described in the api docs. <4> Clackwell: *nod* :) <2> Meddi: http://papernapkin.org/pastebin/view/4437/wicket:pageMapName/wicket-0 <1> *shrugs* <4> Clackwell: but thats for tomorrow or so.. Right now I'm busy fixing things on my companies server farm (got a new job; went back from self-employed to employed) :) <2> Lion-O: ah. unless you are in a sweet spot it's better to be regularly employed, i think. <5> i have a some problem getting my object "out" from a ArrayList after they have been inserted. The object implement a interface. but i dont seam to figure out the best way to show the contents. Using the instanceof apporach doesnt fix my problem <2> brb <4> Clackwell: absolutely. I've had quite a few rough times. This way I have more security. <5> if i post my code, about 40 rows, you think you can help me out? <5> i will be glad if someone can have alook at it. <5> i tryed doing some casting, but iwht no success <6> If you can use 1.5 (?) for the generics then that would make things easier... <6> ArrayList<TheInterface> myArrayList = new ArrayList<TheInterface>(); myArrayList.add( someObjectImplementingTheInterface ); TheInterface someObject = myArrayList.get( 0 ) ;
<6> etc. <5> well, I seam to rembember the comp. telling me something about that. ok, how do check my version? <6> javac -version probably <5> java.runtime.version=1.6.0-b105, java.version=1.6.0 according to Eclipse <6> Yeah, you can use it then. <5> so, what you are telling, is to use Arraylist< myInterface >, ok, thank you , will give it a try <6> Basically what that does is force all the things added to implement that interface, and does the casting for you when you get them back out <5> ok <0> Unless you need to do so, declare it as "List<MyInterface> list = new ArrayList<MyInterface>();" --- You should avoid implementation dependancy if it's unnecessary. Later you might want to change the list implementation and this way it's changed in only one place. <5> dave-e, several object are inserted into the ArrayList. if i wish to print them out, is there another of doing that, i konw i need to check each object <0> The toString method of collection implementations invokes the toString method of the reference they contain... printing list.toString() would be a poor mans printout. <0> Alternatively you can just iterate the list with for(MyInterface o : list) { ...print out o } <6> Talden hmm... if it's not being exposed to anything else, is it really that important? Not arguing, just curious ;) To be honest I normally would have done List<> too, not sure what made me not this time. <0> dave-e if you p*** it to any methods anywhere along the way then it would become important as you're immediately increasing the number of places where you refer tightly to implementation. <6> Guess I kind of ***umed it was never p***ed out directly. <0> To be fair there is (in the Sun VM at least) a minute performance cost to dereferencing interface types over object types (though I haven't looked into why it should be the case). <6> I mean if I was going to p*** it outside of the cl***, I'd probably wrap it with it with the unmodifyablelist thingy anyway... <6> :) <0> If I expect to p*** it out and need it unmodifiable then I usually keep a reference to the public (unmodifiable wrapper) and the private (modifiable implementation) to avoid acquiring a new wrapper each time. In both cases though (unless forced by some external dependency) I use the most general interface practical to minimise coupling. <6> Why's there nothing on TV tonight... :( <5> soory guys for asking, but i was trying the suggestions and Eclipse says: Syntax error, param types are only available if source level is 5.0. That is Eclipse related right? <6> Yeah, there'll be an option to turn that stuff on <5> ok, thanks <0> Yes in the project settings (under java or compiler or some such) you'll see a language or syntax compliance level. That needs to be 5.0 <5> Talden, i will look for it now <5> ok, thank you, very much. <5> casting each object that is returned from the ArrayList would require a lot of if-else, is there a smarter way? i mean , not using the instanceof? each object in the ArrayList implements the Interface. <5> perpaps some pattern? <0> Hi there LLyric <7> :) <7> what would be the proper way of creating an array of charArrays :E <0> char[][] is the declarative type. How you instantiate them depends upon your needs. <7> ay.. i started writnig char[][] cArray = new char[10][??] <7> ?? = i got confused.. <0> If the number and length of char[] instances are known at declaration then char[][] chars = new char[n][m]; does the trick. ***uming you want a rectangular grid. <7> well <7> i have a string[][] <7> that i need to sort alfabethically.. <7> so i thought bout using CharArray <0> String[] or String[][]? You can sort the arrays of strings alphabetically, sorting the array of arrays of Strings is less simple. <7> well.. <7> its String[][] <7> but.. <7> the second is fixed.. <7> so its really like String[] <7> i guess.. <7> String[var][0] for instance.. <0> if you have String[n][m] you have n String arrays of length m. Each of these individually is trivial to sort. <8> Gidday <8> Even though we have X back, is anyone on the auto-op list? <7> Talden thats what i want to do.. <7> i guess.. <8> Hehe <0> ;) <7> it only want to sort the rows.. <7> err <7> columns.. <7> not rows.. <8> You can't use a library function to sort by the major index. <7> no rows.. i just made everything in reverse in code i think :( <0> raki - using the Arrays.sort and a for(String[] a : theArraysOfStringArrays) you can sort each array <8> yeah, what he said <9> I made the mistake of /list <9> heh... it's still going <7> Talden can i sort them by using fixed number for column or do i need to read it into a temporary String[] ? <0> raki... The sort method sorts a given array. you've already specified the size of the array when creating it. <8> heheh <7> i want to be able to sort column i of String[a][i] <7> yes indeed.. <7> im reading up on it now.. <0> raki - no there's nothing that works like that out of the box. <7> ok.. <0> Best performance would be for you to do this yourself. least code (and therefore least complexity) would be to extract a String[] of the given column, sort it and reinsert the sorted results.
Return to
#java or Go to some related
logs:
: What was the famous prison of 18th century London ? sda 1 en linux lejla cass usr 0460 jumpers ubuntu configure firefox and wlan0 pegoeut #php What type of fish is most commonly caught on hempseed bait ?
#squid #mirc
|
|