comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * 1.4.2 translate errors - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec * Map that takes a pair of keys? - 9 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8bfed67959eb893 * background process: existing jsp/servlet or new applet? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22361eba54ae92f9 * To create an EXE file in Java - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee3427d831f71d73 * Java pattern matching queries - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db1c59777de1709 * Am I the only one who questions JSTL, Struts Tags, XSL Tags? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d * How do I make my JDialog's buttons respond to enter key? - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42d85a46a4a0b455 * GUI - GUI value passing - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/427d1d7372619486 * Experienced programmer: where to start with Java? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92371952fdc705d2 * Can someone use invokeLater() to call a public method from a JPanel? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 * Newbie question: handling arrays in separate class - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 ========================================================================== TOPIC: 1.4.2 translate errors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec ========================================================================== == 1 of 2 == Date: Fri, Oct 22 2004 5:36 pm From: "Yogo" <n o s p a m> "Paul Lutus" wrote: > >> >> "Paul Lutus" wrote: >>> Your system has a bug -- it made you post the exact same post in two >>> different newsgroups. This is called "mutiposting" and it is universally >>> unacceptable. >> >> Is being off topic without mentioning it _clearly_ acceptable ? > > Usenet rule discussions are always on-topic, and you just revealed your > total ignorance of Usenet rules of behavior. > So, not knowing one of the rules of something means total ignorance? Sorry to say so but I think it's pretty stupid to think so. And who says that discussions about usenet rules are always on-topic besides you? I indeed never heard such a rule since I know usenet... Anyway, I wasn't talking about that message in particular. You often reply with off-topic messages and that just adds unnecessary noise to the group and is also a waiste of time for readers/writers who expect on-topic messages... > > Learn something before posting again. > Try to do the same. == 2 of 2 == Date: Sat, Oct 23 2004 12:55 am From: Paul Lutus <[EMAIL PROTECTED]> "Yogo" <n o s p a m> wrote: > "Paul Lutus" wrote: >> >>> >>> "Paul Lutus" wrote: >>>> Your system has a bug -- it made you post the exact same post in two >>>> different newsgroups. This is called "mutiposting" and it is >>>> universally unacceptable. >>> >>> Is being off topic without mentioning it _clearly_ acceptable ? >> >> Usenet rule discussions are always on-topic, and you just revealed your >> total ignorance of Usenet rules of behavior. >> > > So, not knowing one of the rules of something means total ignorance? Find the quote where someone other than yourself took this position. Yes, that's right, only you said this, no one else. > Sorry > to say so but I think it's pretty stupid to think so. So you have quoted yourself, then laid judgment on it. So be it. > And who says that discussions about usenet rules are always on-topic > besides you? Rent a clue. > I indeed never heard such a rule since I know usenet... You know, you can keep your ignorance a secret. No one needs to know. http://www.talkaboutprogramming.com/group/comp.lang.cobol/messages/127949.html "By longstanding Usenet convention, discussions of topicality are always topical." http://www.dbforums.com/archive/index.php/t-318674.html "Nope - topicality is always topical. Thats one of the rules by the way." http://www.woodworking-forum.com/woodworking/OT_Why_I_hate_political_threads_962009.html "* Topicality is always topical * " http://coding.derkeiler.com/Archive/General/comp.programming/2003-11/2006.html "... second, topicality is--by definition--on topic on amUSENET." And so on, for hundreds of posts. -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: Map that takes a pair of keys? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8bfed67959eb893 ========================================================================== == 1 of 9 == Date: Fri, Oct 22 2004 7:43 pm From: marcus <[EMAIL PROTECTED]> This is a tough one to google hehe Is there code available, or a coupla good hints, for a fast map that takes a pair of keys to produce a value? I have two keys that together map to a single (non-unique) value, but not in a particularly logical manner. This is for a personal project and doesn't have to look pretty, so I can hard-code loading the map. Pulling the values out, though, I don't want a hundred or so nested if statements. Hmm, can I set up a map of maps? the first key returns a value, which itself is a map of possible second keys? *shudder* == 2 of 9 == Date: Fri, Oct 22 2004 9:20 pm From: Jacob <[EMAIL PROTECTED]> marcus wrote: > This is a tough one to google hehe > Is there code available, or a coupla good hints, for a fast map that > takes a pair of keys to produce a value? Just bundle the two in a class and use that as your key. > This is for a personal project and doesn't have to look pretty, ... Always try to make your code look pretty. It makes the programming experience more enjoyable and will give you good programming habits in the long run. == 3 of 9 == Date: Fri, Oct 22 2004 9:01 pm From: marcus <[EMAIL PROTECTED]> Jacob wrote: > marcus wrote: > >> This is a tough one to google hehe >> Is there code available, or a coupla good hints, for a fast map that >> takes a pair of keys to produce a value? > > > Just bundle the two in a class and use that as your key. huh? > >> This is for a personal project and doesn't have to look pretty, ... > > > Always try to make your code look pretty. It makes the > programming experience more enjoyable and will give you > good programming habits in the long run. > == 4 of 9 == Date: Fri, Oct 22 2004 9:36 pm From: Chas Douglass <[EMAIL PROTECTED]> marcus <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > > Jacob wrote: >> marcus wrote: >> >>> This is a tough one to google hehe >>> Is there code available, or a coupla good hints, for a fast map that >>> takes a pair of keys to produce a value? >> >> >> Just bundle the two in a class and use that as your key. > huh? > [snip] Create a new class that contains both of your keys. Use it as a key in HashMap. public class TwoKeys { private Object key1; private Object key2; public TwoKeys(Object key1, Object key2) { this.key1 = key1; this.key2 = key2; } // getters() and setters() omitted for clarity } Refactor the key1 and key2 object types appropriately. Now you can: HashMap<TwoKeys, Object> hashMap = new HashMap<TwoKeys, Object>(); hashMap.put(new TwoKeys(key1, key2), new Object()); Once again, refactor "Object" to be something appropriate for your application. (WARNING: code typed on the fly, not guaranteed to compile without typos) If you want to use one of the ordered collections, you'll need to implement Comparable in TwoKeys. Chas Douglass == 5 of 9 == Date: Sat, Oct 23 2004 12:13 am From: marcus <[EMAIL PROTECTED]> if I create a second object with the same parameters as the first object, it is a different object and won't pull the same value, will it? or am I misunderstanding. I was planning on using immutable objects, like String. > > [snip] > Create a new class that contains both of your keys. Use it as a key in > HashMap. == 6 of 9 == Date: Sat, Oct 23 2004 12:15 am From: marcus <[EMAIL PROTECTED]> Hmm -- I could concatinate the strings -- that should work == 7 of 9 == Date: Sat, Oct 23 2004 12:32 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> Chas Douglass <[EMAIL PROTECTED]> writes: > Create a new class that contains both of your keys. Use it as a key in > HashMap. Note that you will also want to implement equals() and hashCode(), plus possibly toString() for readability. The most basic equals() is return key1.equals(arg.key1)&&key2.equals(arg.key2); == 8 of 9 == Date: Sat, Oct 23 2004 12:42 am From: marcus <[EMAIL PROTECTED]> Tor, Jacob, Chas -- thanx! I was just reading up on the use of non-immutable objects in a hashmap and the key (sick) was implementing an equals method, so I was posting that I had a baby Eureka moment. I think I am down to 4 levels of indirection, so all is well. Cheers! -- clh Tor Iver Wilhelmsen wrote: > Chas Douglass <[EMAIL PROTECTED]> writes: > > >>Create a new class that contains both of your keys. Use it as a key in >>HashMap. > > > Note that you will also want to implement equals() and hashCode(), > plus possibly toString() for readability. > > The most basic equals() is > > return key1.equals(arg.key1)&&key2.equals(arg.key2); == 9 of 9 == Date: Sat, Oct 23 2004 12:18 am From: Oscar kind <[EMAIL PROTECTED]> Chas Douglass <[EMAIL PROTECTED]> wrote: > marcus <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: >> Jacob wrote: >>> >>> Just bundle the two in a class and use that as your key. >> huh? >> > Create a new class that contains both of your keys. Use it as a key in > HashMap. > > public class TwoKeys { > > private Object key1; > private Object key2; > > public TwoKeys(Object key1, Object key2) { > this.key1 = key1; > this.key2 = key2; > } > > // getters() and setters() omitted for clarity > > } > > Refactor the key1 and key2 object types appropriately. Also don't forget to override both equals() and hashCode(). If you don't, then to retreive a value you need the exact same key object (or another one at the exact same memory location, as that is how Object#hashCode() works). Assuming you use an object like String or a subclass of Number as your keys (which already override those methods), something like this probably suffices: public boolean equals(Object o) { // An object is always different from null. if (o == null) { return false; } // The first key is empty, but it's counterpart is not. if (key1 == null && o.key1 != null) { return false; } // The second key is empty, but it's counterpart is not. if (key2 == null && o.key2 != null) { return false; } // The first key is not empty, but differs from it's counterpart. if (key1 != null && !key1.equals(o.key1)) { return false; } // The second key is not empty, but differs from it's counterpart. if (key2 != null && !key2.equals(o.key2)) { return false; } // Found no differences. return true; } public int hashCode() { int hash1 = key1!=null ? key1.hashCode() : 0; int hash2 = key2!=null ? key2.hashCode() : 0; return hash1 ^ hash2; } -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: background process: existing jsp/servlet or new applet? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22361eba54ae92f9 ========================================================================== == 1 of 2 == Date: Fri, Oct 22 2004 8:07 pm From: [EMAIL PROTECTED] (robert) Bryce <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On 22 Oct 2004 11:25:30 -0700, [EMAIL PROTECTED] (robert) wrote: > > >- post to the controller servlet which spawns a thread to do the db > > update, then sends a response back to the browser. all using the > > existing infrastructure. adv.: the application comes back fast. > > disadv.: one loses contact with the db update, so confirming that > > it worked is some work. > > We do exactly this (using ThreadPools and worker threads). You lose > track in that its an asynchronous transaction. A status page retrieves > the data, to view if the transaction was successful. that was my inclination. i guess i'll have to fight to the death to kill off the applet wave. not that applets are necessarily bad (another system is applet based), but mixing one in just to get threading seems foolish. after i posted, and continued chewing on the problem, it seems that threading in an applet presents an issue with killing off the thread in the client if the user closes the browser or windoze locks up (not much chance of that, right). server side threading looks the better way. == 2 of 2 == Date: Fri, Oct 22 2004 8:11 pm From: [EMAIL PROTECTED] (robert) "John C. Bollinger" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > robert wrote: > > > given an existing code base of jsp/servlet ala Struts; how best > > (efficiency of execution secondary, getting the code done primary) to > > support background processing: spec. database writes?? > > > > - post to the controller servlet which spawns a thread to do the db > > update, then sends a response back to the browser. all using the > > existing infrastructure. adv.: the application comes back fast. > > disadv.: one loses contact with the db update, so confirming that > > it worked is some work. > > > > - add an applet, which spawns a thread to do the db update. adv.: the > > applet can keep track of the update, and can respond with update > > status with a bit less work. disadv.: integrating the applet with > > the existing L&F of the jsp. > > > > oddly (it seems to me), i can't find any discussions of these alternatives, > > either on c.l.j or various servlet texts. > > You sure have a slow DB update going on if the servlet can't just wait > until the update is done to respond. Are you sure you're not making > work that doesn't need to be done? Does the client actually need to > know when the background job has finished? > > Supposing that you really do need to do this sort of thing, a solution I > have seen before is that the server sends a page containing an "in > progress" message to the client; the page auto-refreshes every few > seconds until the background work is complete; and then the client gets > a page with a "job complete" message. I would recommend against trying > to work up an applet specifically for this task; it would be way more > trouble than it's worth. > > > John Bollinger > [EMAIL PROTECTED] i think two options: write to a session object and poll it on each page transition, updating an icon in the jsp/html; write to a status table in the database, and so forth. and yes, the nature of the system is that a *lot* database work can get spawned from a relatively small amount of data sent over the wire. back when it was a host/terminal system, not so much of a big deal. ain't wrapping legacy code a gas????? oy ========================================================================== TOPIC: To create an EXE file in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee3427d831f71d73 ========================================================================== == 1 of 3 == Date: Fri, Oct 22 2004 8:13 pm From: "Mr Frank" <[EMAIL PROTECTED]> "Gulapala" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want to install the application in the client so that the souce code is > hidden. > Its like creating an exe file in VB or Cand giving it to the client.How to > do it? > > > I want to note that Using the jad tool we can also construct the source > file from the class file > Gulapala, There are some products that generate an EXE from Java but they are either commercial or in the case of free ones somewhat out of date. (Sun pump out new Java version faster than these guys can keep up). Obfuscation is the way to go but then again it is not free. Zelix is excellent and well priced, DashO is ok but expensive. Are you sure you can really write classes that your client can reverse engineer for a great profit? I reckon not! Regards. == 2 of 3 == Date: Fri, Oct 22 2004 9:07 pm From: Jacob <[EMAIL PROTECTED]> Gulapala wrote: > I want to install the application in the client so that the souce code is > hidden. You can use an obfuscator to do this, but it is probably not worth the effort. Bundle your applcation as a .jar file. A .jar is an executable file and equivalent (or superior really) to a .exe file for all practical purposes. == 3 of 3 == Date: Fri, Oct 22 2004 9:01 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Sat, 23 Oct 2004 06:07:12 +0200, Jacob wrote: (snip advice re obfuscation) > Bundle your applcation as a .jar file. A .jar is an executable > file and equivalent (or superior really) to a .exe file for all > practical purposes. Absolutely. For further information.. <http://www.physci.org/codes/javafaq.jsp#exe> <http://www.physci.org/codes/javafaq.jsp#jar> -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ========================================================================== TOPIC: Java pattern matching queries http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db1c59777de1709 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 8:20 pm From: [EMAIL PROTECTED] (Earth) Hi all, I am new in using the java pattern and having problem to match the following <body>bb <table> <banner> it is a banner </banner> it is table1 </table> from <body>bb <table> <banner> it is a banner </banner> it is table1 </table> <table> it is table2 </table> </body> I have tried the pattern (<body>[\\x00-\\x7F]*)</table> but fails. The (<body>[\\x00-\\x7F]*)</table> matches all. My goal is to match all text from the start to the first </table> Please enlighten me. Thanks in advance for you inputs. Eclifeww ========================================================================== TOPIC: Am I the only one who questions JSTL, Struts Tags, XSL Tags? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:01 pm From: Steve Sobol <[EMAIL PROTECTED]> John Harlow wrote: > *shrug* Ok, but not sure why you say it's a "kludge" . It does what it's > intended to do in a very straightforward and intuitive way. I guess it's just not transparent enough for me. I like Sitemesh *so* much better and Sitemesh (since it runs as a filter) can decorate static pages OR JSPs. It'll apply templates to HTML pages without me having to do anything. -- JustThe.net Internet & New Media Services, http://JustThe.net/ Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED] PGP Key available from your friendly local key server (0xE3AE35ED) Apple Valley, California Nothing scares me anymore. I have three kids. ========================================================================== TOPIC: How do I make my JDialog's buttons respond to enter key? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42d85a46a4a0b455 ========================================================================== == 1 of 4 == Date: Fri, Oct 22 2004 9:01 pm From: [EMAIL PROTECTED] (Paul Tomblin) In a previous article, "Bryan Cooper" <[EMAIL PROTECTED]> said: >Did you try out this solution? Not yet. I was hoping there was an easier solution first. I mean, JOptionPane guis do it, native guis do it, and the "setDefaultButton" thing does it, so why would it be so complicated in JDialogs? The source code for JOptionPane is pretty simple, but it looks like all the complicated stuff is in plaf/basic, and it seems to do something almost as complicated as yours. -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ Documentation: Cryptic, lacking, erroneous. Pick any three. -- Arvid == 2 of 4 == Date: Fri, Oct 22 2004 9:04 pm From: [EMAIL PROTECTED] (Paul Tomblin) In a previous article, Chas Douglass <[EMAIL PROTECTED]> said: >[EMAIL PROTECTED] (Paul Tomblin) wrote in >news:[EMAIL PROTECTED]: >>>JComponent.getRootPane().setDefaultButton() >> Interesting. That makes *a* button respond to the enter key, but it >> doesn't have anything to do with where the focus is. > >I suggest you try it. Based on the way it works in my program (that is I did try it. And if you call "setDefaultButton" on 5 buttons, then it doesn't matter which one has focus, the last one you called it on gets invoked when you hit enter. The only way I could see using this is to have a FocusListener that calls setDefaultButton on any button that gets focus. Hmmmmm..... -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ while true do; mutt -Z; trn; vi; make; done # My typical day == 3 of 4 == Date: Fri, Oct 22 2004 9:15 pm From: Chas Douglass <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Paul Tomblin) wrote in news:clcl91$aud$3 @allhats.xcski.com: > In a previous article, Chas Douglass <[EMAIL PROTECTED]> said: >>[EMAIL PROTECTED] (Paul Tomblin) wrote in >>news:[EMAIL PROTECTED]: >>>>JComponent.getRootPane().setDefaultButton() >>> Interesting. That makes *a* button respond to the enter key, but it >>> doesn't have anything to do with where the focus is. >> >>I suggest you try it. Based on the way it works in my program (that is > > I did try it. And if you call "setDefaultButton" on 5 buttons, then it > doesn't matter which one has focus, the last one you called it on gets > invoked when you hit enter. The only way I could see using this is to > have a FocusListener that calls setDefaultButton on any button that gets > focus. Hmmmmm..... > > You don't have to. Once the default button is set (and since there can only be a single default button at any time, yes, the last one you set it on will be the default button -- you did read the docs, right?) then any button that gets the focus after that becomes the default button until you tab out of the buttons again. Did you try tabbing to the buttons after setting a default? This is the way JOptionPane seems to work, and the way it works in my applications. You only have to do more work if you want something other than buttons to respond to ENTER. Chas Douglass == 4 of 4 == Date: Fri, Oct 22 2004 10:04 pm From: [EMAIL PROTECTED] (Paul Tomblin) In a previous article, Chas Douglass <[EMAIL PROTECTED]> said: >> I did try it. And if you call "setDefaultButton" on 5 buttons, then it >> doesn't matter which one has focus, the last one you called it on gets >> invoked when you hit enter. The only way I could see using this is to >you tab out of the buttons again. Did you try tabbing to the buttons >after setting a default? Yes, that's why I said it doesn't matter which one has focus. I set it, and I tab between the buttons, and it doesn't matter, the last button always gets the enter key. -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ "Nous sommes desoles que notre President soit un idiot. Nous n'avon pas vote pour lui" - French "washing instructions" on a US-made laptop bag. http://www.livejournal.com/users/brooklynite/5659.html ========================================================================== TOPIC: GUI - GUI value passing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/427d1d7372619486 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:30 pm From: Jacob <[EMAIL PROTECTED]> paul.foreman wrote: > From a window created by extending Frame, I have created a new child window > also based on extending Frame. > > I need the user to select a value in the child window which then gets passed > back to the parent window. The child window then is closed. If your parent window *conceptually* owns the child window, simply pass the parent window as parameter to the constructor of the child window and keep it as a class variable in the child. Make the appropriate value setter method in the parent and call that from your child window. If the two are *conceptually* independent, use an event mechanism as suggested by Michael R. ========================================================================== TOPIC: Experienced programmer: where to start with Java? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92371952fdc705d2 ========================================================================== == 1 of 2 == Date: Fri, Oct 22 2004 9:21 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Will Hartung coughed up: > "Dave" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I'm an experienced programmer with a strong background in OOP and I'm >> interested in learning Java. I pick up languages very quickly, so >> the syntax does not concern me, although I suspect, like most >> languages, it takes time to gain experience learning the libraries >> and foundation classes. I'm wondering where to start with Java. >> I'm not talking about the Java For Dummies. I mean what aspects of >> Java should I be learning: applets, programs, wireless? I realize >> it's used in a wide variety of devices and environments, so my main >> question is: I don't even know what I want to do with it yet, I just >> like it - where do I start? > > You need to approach it from the other end. For all the reasons you > mentioned, you should pick "what do you want to do" and start there. The OP has pointed out that he doesn't know what to do with it yet. Therefore given two questions that need to be answered: 1. What do I make? 2. What tools do I use? he has clearly pointed out that #1 is an unknown, so he is answering #2 by picking java out of the air for his own reasons and then asking where within java does he start. Nothing wrong with that at all. IMO, the OP is approaching this perfectly. He wants to learn java. Sometimes you just need to resign yourself to learning the tool, regardless of what you may or may not have to accomplish at that precise moment in time. It's important to learn new tools, languages being among them, even if it's the only goal. ...[rip]... -- Whyowhydidn'tsunmakejavarequireanuppercaselettertostartclassnames.... == 2 of 2 == Date: Fri, Oct 22 2004 9:29 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Dave coughed up: > I'm an experienced programmer with a strong background in OOP and I'm > interested in learning Java. I pick up languages very quickly, so the > syntax does not concern me, although I suspect, like most languages, > it takes time to gain experience learning the libraries and foundation > classes. I'm wondering where to start with Java. I'm not talking > about the Java For Dummies. I mean what aspects of Java should I be > learning: applets, programs, wireless? I realize it's used in a wide > variety of devices and environments, so my main question is: I don't > even know what I want to do with it yet, I just like it - where do I > start? > > Any ideas? IMO, the place to start are java applications. Not strictly server side, not applet, not wireless, but stand-alone java programs. You will be faced with the minimum of these issues: 1. Java's take on statically typed OO 2. Java's threading 3. The various gui packages My advice to you is the same that I give to junior engineers in this regard: pick a utility, design and code it up. You'll come face to face with all the issues pretty quick. -- Whyowhydidn'tsunmakejavarequireanuppercaselettertostartclassnames.... ========================================================================== TOPIC: Can someone use invokeLater() to call a public method from a JPanel? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 11:44 pm From: "***C.Steamer***" <[EMAIL PROTECTED]> Basically I want the application to call invokeLater() to update the view of the gui. This is for a simple card game.I want to call a public method called updateHand(Hand hand) which I pass in a hand then it clears the items in the JPanel and adds a Label representing each of the cards to the Jpanel. For some reason if I call this method from the constructor of the JPanel but the invoke method doesn't work. This is my code in the application layer. Any suggestions why this isin't working? private void updateScreen1() { Runnable updateScreen = new Runnable() { public void run() { Hand handTest = new Hand(); handTest.addCard(new Card(1,1)); handTest.addCard(new Card(2,1)); handTest.addCard(new Card(3,1)); handTest.addCard(new Card(4,1)); handTest.addCard(new Card(5,1)); mainPanel.updateHand(handTest); } }; SwingUtilities.invokeLater(updateScreen); } And the actual method in my main panel is as follows.Note that handPanel is just a panel I added in my mainPanel which is an extension of JPanel public void updateHand(Hand hand) { handPanel.removeAll(); for(int i =0;i<hand.getNumCards();i++) { CardLabel cardLabel = new CardLabel(hand.getCard(i)); handPanel.add(cardLabel); cardLabel.addMouseListener(this); } handPanel.repaint(); } ========================================================================== TOPIC: Newbie question: handling arrays in separate class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 ========================================================================== == 1 of 2 == Date: Sat, Oct 23 2004 1:05 am From: "Tom" <[EMAIL PROTECTED]> Thanks for guidelines. As it was said somewhere else before: I'm learning Java by programing. But it's easier when you know where to look. Tom U¿ytkownik "Oscar kind" <[EMAIL PROTECTED]> napisa³ w wiadomo¶ci news:[EMAIL PROTECTED] > Tom <[EMAIL PROTECTED]> wrote: > > I'm writing a sort of dicionary application for mobile phone and I though of > > having one class with all the data i.e texts sorted in 1dim. arrays of > > strings. The class should return one element from an array after providing a > > name of an array and a number of element in that array. > > That's the problem that I'm facing now and looking for solution. > > In that case, an alternative is to use a ResourceBundle. It allows you to > easily find texts for labels, as used in internationalized applications. > > In you case: > - The labels are not that important, but could be useful. > - As you can enumerate the labels (keys), you can add suffixes to the > labels: original, translation, description > - You can even: > - Use a prefix that specifies the language > - Use a suffix to destinguish between words and descriptions > - Use unified labels to couple words: > english.house.word=House > dutch.house.word=Huis > french,house.word=Maison > To translate from english to dutch, you'd need these labels: > english.house.word > english.house.description > dutch.house.word > > > -- > Oscar Kind http://home.hccnet.nl/okind/ > Software Developer for contact information, see website > > PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 == 2 of 2 == Date: Sat, Oct 23 2004 1:07 am From: "Tom" <[EMAIL PROTECTED]> Thanks for guidelines. As it was said somewhere else before: I'm learning Java by programing. But it's easier when you know where to look. Tom U¿ytkownik "Oscar kind" <[EMAIL PROTECTED]> napisa³ w wiadomo¶ci news:[EMAIL PROTECTED] > Tom <[EMAIL PROTECTED]> wrote: > > I'm writing a sort of dicionary application for mobile phone and I though of > > having one class with all the data i.e texts sorted in 1dim. arrays of > > strings. The class should return one element from an array after providing a > > name of an array and a number of element in that array. > > That's the problem that I'm facing now and looking for solution. > > In that case, an alternative is to use a ResourceBundle. It allows you to > easily find texts for labels, as used in internationalized applications. > > In you case: > - The labels are not that important, but could be useful. > - As you can enumerate the labels (keys), you can add suffixes to the > labels: original, translation, description > - You can even: > - Use a prefix that specifies the language > - Use a suffix to destinguish between words and descriptions > - Use unified labels to couple words: > english.house.word=House > dutch.house.word=Huis > french,house.word=Maison > To translate from english to dutch, you'd need these labels: > english.house.word > english.house.description > dutch.house.word > > > -- > Oscar Kind http://home.hccnet.nl/okind/ > Software Developer for contact information, see website > > PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
