| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> do you think that using premade pictures of the letters would be a good idea? <1> i dont know, im not that smart <1> sounds good <1> have to scale them properly <0> yeah <1> why woudlnt it work? <0> I don't know, I'll have to try it out and do some tests :) <1> that would be fun <1> count me in <1> im going to download the image and get to work <1> ive never done anything with graphics before <0> somebody else suggested me to put that in my resume if I can break it hah ;) <1> lol <1> have you ever written anything in java? <0> yeah, something to encrypt <0> and an SSL session simulator
<1> i jes looking <2> espaol aqui o ingles ? <2> que es eso de *.net *..spli <2> ? <3> When using graphics I find myself p***ing the name of the Graphics object around all the time. Is there a way just to get the name, or does it have to be p***ed this way? <3> I tried setting a Graphics aliasname; and then in the PaintComponent method setting aliasname = (name it uses of Graphics object) but it doesn't work, I guess the internal id changes per repaint()? <4> hobophobe, little example code? <3> well in this case I have a paintComponent(Graphics g) method calling update (g); and then update is overridden to g.drawImage() ... so I'm bouncing the g all around it seems like it could get hairy if someone wrote a program that needed others to refer to its graphics without having it p***ed to them explicitly <4> don't resort to "global variables" - if this is just about sparing yourself a bit of typing. what you buy in return is to not have to think about as much where you are mucking around with that global variable and causing hard to see side effects. <4> hard to understand, rather <3> I don't want to use global variables. I just have a hard time understanding how to implement a timer/event-based function within a paint call... it doesn't make any sense to me. The event should be isolated from the painting, and should be calling on the painting, but if the only references to the Graphics object are within the painting they have to call out. It's like if the only way you could order a pizza is for the pizza guys to call <3> you first. <4> hobophobe: possibly related or hinting at what to do: Event Dispatch Thread, the thread that drives the swing gui. See http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html for a tutorial on swing and threads <4> i don't think the idea is to keep a reference to that graphics object around. but rather to have the timer initiate a paint by calling repaint() or so - and having everything set up so beforehand so that the code in paint(...) draws the right thing. <3> you're right, of course. I guess that just seems counterintuitive to me. In what I'd done previously I would just put the drawing right in the event, but that doesn't make it nearly as... polymorphic as it could be and leaves a fixed object name all over which makes it less maintainable <4> i ***ume by "object name" you mean a pointer/reference to an object? <3> yes..., the alias of it. in that case it was page, and it being known I didn't have to worry about p***ing it to each method, so I didn't, I hard-coded it. <4> java does not have aliases. <4> there are primitive data types and reference (pointer, kind of) types. and there are variables. the name of a variable is usually not called an alias, if that is what you did. <3> well I've had other java channels not like what the book I use says about this subject either. I'm still too much of a neophyte to grasp the intricacies completely... Heading: Aliases... 'one important implication of aliases is that when we use one reference to change an object, it is also changed for the other reference because there is really only one object" and so on. <4> yeah, one object and many references "pointing" to it. so regardless of which reference you use to modify the object - all other access to the object reflect the changes. <4> do you have to use that book? <4> because there are a few which are more terminology compliant, and proven useful, too. <4> BEGINNERSBIBLES Download these two bibles (free of charge): 1) Sun Java Tutorial (http://java.sun.com/docs/books/tutorial/) 2) Bruce Eckel's "Thinking in Java" (http://www.bruceeckel.com/) <4> it makes communication a bit hard if the terminology is off or needs be clarified at the start all the time. <3> I don't have to use it. I don't particularly like any book that goes through three or more editions with an asterisk that has no footnote. <3> Java must get a lot better when you learn threads and the extent of processor management it allows. My first attempts at animated graphics required using all the available cycles to slow it down enough, like they used to do with old video games. You play them on modern hardware and they move too fast to play. <3> Anyway, thanks for the insight and the material Clackwell, I'll try to learn some about threads <5> hi <5> i have a quick question: if the catch clause throws an exception, will the finally clause still be executed? <6> morning <7> Im trying to write a small bit in java, im familar with perl, but cant seem to use the same concept in java. <7> @colors = ("red","blue","red","green","green","red"); <7> foreach $color (@colors) { <7> $colorcounter{$color}++; <7> } <7> foreach $color (keys %colorcounter) { <7> print "the total of $color is $colorcounter{$color} <br>\n"; <7> } <7> the point im trying to do use use LABLES instead of NUMBERED subscripts in java <7> everything i read in java points to only using [1], [2], etc, not ['red'], ['blue'], etc <6> SAC_Admin: that's javascript, not java <6> big difference <7> no, the codes i pasted is perl <8> or php <7> i want to know how to get the same effect out of java .jsp <7> can you use LABEL subscripts in java? <7> or does it have to be numbered? like $myvar[1] <9> SAC_Admin you can use a hashtable with a string key <7> or can i use $myvar['lable'] <9> hashtable.get("blue2") <7> okay, i google hashtable, brb <4> while at it, look up collections in the sun java tutorial, then try to use the modern variants (not Vector, not Hashtable). <10> this should be pretty trivial. You can even write this up in Java using an array and a enhanced for loop. <% <code> %>. <10> hmm, or an ArrayList. might be more flexible. <4> hi lion <7> well yes, i just want to use aray/subcript using a lable instead of a number <7> thats the simplest way? cause hastables looks like using a stick of dynomite to kill a fly lol <10> Clackwell: ey there. <10> SAC_Admin: why focus on labels? <7> because i want to run a counter on an unknown list, i will capture the name of each 'item' in the loop
<4> SAC_Admin: it's just different syntax. <10> simple. Use a for loop, increase the variable and use that as index. <7> say i have a loop with a varible that with each p*** of the loop will change to different value of a color, i want to count the colors <10> or I'm missing something here... I fail to see the reason to paste the code you did since I can read Java (to a certain extend) but am not familiar with perl and the likes :P <7> okay, let me talk the loop in english... <4> SAC_Admin: you want to look up something based on a string? <7> okay, start the loop <7> each p*** of the loop the var $color will be giving a new value like "red" "blue" etc <7> but each time we run the loop we dont know what the colors will be <7> i want to count the colors <7> ++; <7> when the loop is done, i want to output "you had 3 reds" <4> what is ++; for? <7> "you had 4 yellows" <7> sorry, in perl $counter = $counter + 1; is written the same as $counter++; <10> I think you don't even need a loop for this. Not 100% sure but I think that ArrayList (or Array) has a method to count the occurances of certain elements. But I'm not too sure here. <7> lion, i already have a loop, im just trying to add a counter to the loop, to count how many times the same vaule comes up <4> well, i don't know perl. these bits don't strike any ***ociation <7> okay, let me try this approach <7> say you have a file <7> you open the file <7> you make a loop to read in the lines one at a time <7> each line read you asign to a $var <7> each line read from the file will be a color <7> red <7> blue <7> yellow <7> blue <7> red <7> etc <7> i want to count how many times each color comes up <10> if ($read_line.equals("red")) red++; <10> and at the end: System.out.println("The color read was encountered " + red.toString() + " time(s).");. Pretty trivial IMO. <7> but without first knowing the colors? doing it that way wouldnt you have to know all the colors in the file before you read it? what if you get a new color one day like purple? <10> SAC_Admin: ach so. NOW I see. <10> thats basicly storing a found instance and checking if it appears again. Hmm. <7> yes, and i cant find a simple array function in java to do tihs <7> my thought is using lables <7> like... $counter['red'] = $counter['red'] + 1; <7> but ofcourse $counter['$read_line'] = $counter['$read_line'] + 1; <10> Well, there are several ways to tackle this. You could, for example, store everything in an array and then check for multiple occurances. Or simply store the values in such a way that there can be no doubles. So whenever one occurs you can increase a counter. <10> intruiging <4> HashMap with int[1] which you keep counting up. issue solved. <4> who's next? <10> Clackwell: wow. indeed, even better. <5> hi <5> does anyone know what the default value for SO_TIMEOUT (timeout for Socket) is? <4> daYZman: no clue. depends on OS or tcp/ip standards? <5> right.. <5> thanks <4> daYZman: what does getSoTimeout() say? <5> Clackwell, i'll try that. <4> hm, 0, must be connected i guess. <7> okay, im looking at hashmap, not clear on the correct syntax <7> if i want to store a key=value like red=2, what would be the syntax? <4> SAC_Admin: http://www.google.com/search?hl=en&q=hashmap+example&btnG=Google+Search <7> are you sure the key part of the hashmap can be a string? <4> it can be an Object. <7> in the examples they are using integers <4> since String extends Object....that makes a String an Object, among others. <4> there is no cl*** called "integer" in java. <4> and there are many examples. <4> i don't think you have look at all of them. <4> SAC_Admin: consider looking at the java 1.4.2 api docs. in 1.5 generics got introduced which kind of ****ed up the standard lib javadocs. :| <4> SAC_Admin: TUTINDEX Quickly locate information about your topic of interest in the *big* tutorial index: http://java.sun.com/docs/books/tutorial/reallybigindex.html <4> SAC_Admin: perhaps check the collections trail. <4> EXAMPLES http://www.acme.com/java/software/ http://www.rgagnon.com/howto.html http://javaalmanac.com/egs/ <4> esp. the java almanac tends to be somewhat useful. <4> brute force searches through the almanac aren't so useful when you are looking for a specific cl***, at times. it seems better to go to their java.utils section manually in this case. <7> i see some examples for storing the key=value into a map, now i just have to keep looking how to loop the results back out <7> and i have not figured out if its better to use .add or .put
Return to
#java or Go to some related
logs:
#linuxhelp javascript + document.scrolldown #php #MissKitten the war script for dalnet #linuxhelp #AllNiteCafe root de flood undernet.xs4all.nl resimtakasi
|
|