comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * applet's call comportement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c * How to update Gui data from application code? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5ed9fff31421c42 * Reading resources from JAR file - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8337347a2d143e44 * Can these two statements be made into one statement? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b46830783d9cc8b0 * development tools - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92585bb2efd8fce7 * draw UML for java application - 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85657acd2418278b * Bitmask & Graphics Question - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e71e0de5e98faaa2 * jdeveloper project file structure - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f23ff9ae612cd6b5 * Interface design question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9a07ca46c4217868 * import JavaBeans question - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffe416c3e6f4500c * Newbee Question about random numbers - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5332da2a87b1a4a * peculiar JMF portability problems - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3127aa6a3aacbc9f * Character encoding between Win and *nix - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d00907704bee1888 * reference to a jar file inside another jar file - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7dab58f45ecad79c * What's the best way to acess the model from the view in a MFC approach? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1e891af3d3a7da1d * Java application developped under Linux running ridiculously slow under Windows - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9 * Oracle JDBC XA question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ded1e7f0747a226 * How tom create a NEW class online - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1552191b47783f48 * Challenge: Triangles puzzle - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0 * How to know if a CD is inserted in the cdrom drive from java ? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5d0b1b8567b852 * internationalization & localization - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6740a8dfcd250166 * how to convert "BigInteger" into "Integer"? how to print out a BigInteger binary value? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adbd22198c0e7422 * How to starthandshake with client browser?? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d41b9d8f6879f8b * How use java.util.logging.config.class? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f086cadd5f41a7 * System.load("..."); - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a44e35955f7f8cf ========================================================================== TOPIC: applet's call comportement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 5:37 pm From: "Emmanuel Freund" <[EMAIL PROTECTED]> > You want random applets to automatically use your custom subclasses of > certain AWT / Swing classes instead of using the superclasses that they > actually specify? yes, more or less > I don't think you can do this even with ClassLoader > magic or by modifying the platform library. The classes you want the > applets to use themselves depend on the classes that the applets > actually specify, so you have no way to make the former impersonate the > latter. well, i think there's to be somewhere an address where the applet find the classe frame for example. So if we do a child myFrame of frame, and we change the address of frame by the address of myFrame, the applet will use the function of myFrame instead the ones of frame i suppose. I mean, this could be one possibility, but since i don't know where to find this address... I don't want to change the platform library, just add some classes on it. > I find the whole idea rather odd, anyway. What is the > objective you wanted to accomplish by this approach? To simplify, say that we have developped a full screen browser in java, where new windows are oppened in some panels, and we can navigate through those panels by clicking some buttons. The problem is when we open a page with an applet making a call to Window or one of its child (generally JFrame), the whole idea of this browser is lost cause the applet will open an OS-depedent window... I hope you see what i mean. If you have any idea, it would really help. -- Emmanuel [EMAIL PROTECTED] ========================================================================== TOPIC: How to update Gui data from application code? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5ed9fff31421c42 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 6:07 pm From: "Dacleaver" <[EMAIL PROTECTED]> So for this event manager, do I have to call the notify method from within a runnable class using invoke later, or should I update the notify method itself to encapsulate the Event dispatch thread. Or do I need to do anything to make sure the Event thread is the one actaully doing the update? Thanks "Jacob" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dacleaver wrote: > >> So does this controller system consist strictly of using the Obeserver >> pattern or is that just one type of implementation. Also, are you aware >> of any example code that you could recommend to help understand it in a >> practicle way. > > EventManager/EventListener is an implementation of the Observer pattern, > but slightly different from the JDK Observer/Observable implementation. > > Read the EventManager documentation; This is a *very* simple API remember. > ========================================================================== TOPIC: Reading resources from JAR file http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8337347a2d143e44 ========================================================================== == 1 of 3 == Date: Mon, Oct 25 2004 6:30 pm From: "MikL" <[EMAIL PROTECTED]> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 25 Oct 2004 20:29:26 +1000, MikL wrote: > > > The following code works fine when the resource is a free-standing file, but > > when it's packaged up in a JAR it can't find it. > > Where in the jar do you put it? How do you reference it? > > >..What methods should I use > > to read it from a JAR? > > > > BufferedReader r > > = new BufferedReader( > > new InputStreamReader( > > getClass().getResourceAsStream("clientSchema.sql"))); > > What do you do with the exceptions you are getting? > > In any case, break this down and find the resource first. > > // ensure the capitals are exactly the same > URL resource = getClass()("clientSchema.sql"); > System.out.println("URL to resource: " + resource ); > > BufferedReader r .. > > -- > 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 Found it. My (three) errors, of course. 1) It was a different piece of code running - hard to tell when the "uncaught error" stack trace only lists 5 com.sun.imageio.* method calls. 2) The code was using getSystemResource() which doesn't find things that getResource() does. 3) The code didn't validate the URL before handing it to Toolkit.getDefaultToolkit().getImage(vURL); Thanks for your help. It was of course while producing an executable example that I found error #1 above, which of course led to finding #2 & #3. (smites forehead, mutters "always create an executable example FIRST".. :) == 2 of 3 == Date: Mon, Oct 25 2004 6:32 pm From: "MikL" <[EMAIL PROTECTED]> "Alex Kizub" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Two points for attention. > 1) you use realtive path. > clientSchema.sql > so this particular file should be in the same directory where is class located. > So, if you have this method in class abc.xyz.Test then clientSchema.sql should > be in directory > abc/xyz starting somewhere in your classpath. > It's better idea to use absolute path. > For example /config/clientSchema.sql > It will work if you have directory config in the roor of your jar file. > > 2) Always use package or at least one step down in your directory structure. > For some reason /clientSchema.sql doesn't work when /config/clientSchema.sql > works fine. > > Alex Kizub. > Alex, I totally agree. It turns out my errors were elsewhere. Thanks for your input. == 3 of 3 == Date: Mon, Oct 25 2004 10:23 pm From: [EMAIL PROTECTED] (hiwa) "MikL" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > The following code works fine when the resource is a free-standing file, but > when it's packaged up in a JAR it can't find it. What methods should I use > to read it from a JAR? > > BufferedReader r > = new BufferedReader( > new InputStreamReader( > getClass().getResourceAsStream("clientSchema.sql"))); If your clientSchema.sql is in your JAR file's top-level, i.e. root, then you have to write "/clientSchema.sql" not "clientSchema.sql". ========================================================================== TOPIC: Can these two statements be made into one statement? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b46830783d9cc8b0 ========================================================================== == 1 of 4 == Date: Mon, Oct 25 2004 6:49 pm From: "Oxnard" <[EMAIL PROTECTED]> I'm still trying to beome a bit more comfortable with abstract classes. Here are the statements: FontMetrics fm = c.getFontMetrics(c.getFont()); int i = 2 * (fm.getMaxAscent() + fm.getMaxDescent()); Thanks == 2 of 4 == Date: Mon, Oct 25 2004 7:27 pm From: Paul Lutus <[EMAIL PROTECTED]> Oxnard wrote: > I'm still trying to beome a bit more comfortable with abstract classes. > Here are the statements: > > FontMetrics fm = c.getFontMetrics(c.getFont()); > int i = 2 * (fm.getMaxAscent() + fm.getMaxDescent()); Why do you want to combine them? They look entire reasonable and readable as they are. The shortest code expression is not necessarily the best. -- Paul Lutus http://www.arachnoid.com == 3 of 4 == Date: Mon, Oct 25 2004 8:28 pm From: "Ann" <[EMAIL PROTECTED]> how about a 'for' statement for(FontMetrics fm=c.getFontMetrics(c.getFont()),int i=2*(fm.getMaxAscent()+fm.getMaxDescent());i<0;;){} "Paul Lutus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Oxnard wrote: > > > I'm still trying to beome a bit more comfortable with abstract classes. > > Here are the statements: > > > > FontMetrics fm = c.getFontMetrics(c.getFont()); > > int i = 2 * (fm.getMaxAscent() + fm.getMaxDescent()); > > Why do you want to combine them? They look entire reasonable and readable as > they are. The shortest code expression is not necessarily the best. > > -- > Paul Lutus > http://www.arachnoid.com > == 4 of 4 == Date: Tues, Oct 26 2004 12:12 am From: Paul Lutus <[EMAIL PROTECTED]> Ann wrote: > how about a 'for' statement > > for(FontMetrics fm=c.getFontMetrics(c.getFont()),int > i=2*(fm.getMaxAscent()+fm.getMaxDescent());i<0;;){} A perverse piece of code, but I think you knew that. :) -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: development tools http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92585bb2efd8fce7 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 7:38 pm From: [EMAIL PROTECTED] (Kiyu) Hello- I am an accomplished programmer ( scripter...? ) in PHP. I started off using vi and DreamWeaver to code and then, after years of using those tools "discovered" Zend Studio - an IDE for PHP. I slap myself every time I think about the stupid things I wrote to debug my code when I really needed a good tool that had a debugger. I am familiar enough with the syntax of Java to code in it and have written some simple stuff. I am now at the point that I want to do some serious work in Java and don't want to slap myself in 5 years after I've been using the wrong tools. I have looked at Java development offerings from Sun and Borland, but there are so many tools; I'm really not sure what I should buy. Also, although I am willing to spend what it takes, I don't want to spend a couple grand on a tool I won't ever really need. I am sure the reader's next question will likely be: what kind of development are you going to do? My answer is this: I am working towards extending/working with the Sun Java System RFID (Radio Frequency ID tags which will eventually replace barcodes). I plan on writing server-side code as well as some interfaces. This leads me to another issue: Sun has what seems to me to be a dizzying array of various server softwares that all seem to somehow work together, but is there somewhere that Sun outlines how it all should work together or what can be omitted? Guidance and opinions are welcomed. Thank you. -Kiyu ========================================================================== TOPIC: draw UML for java application http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85657acd2418278b ========================================================================== == 1 of 5 == Date: Mon, Oct 25 2004 7:40 pm From: "HS1" <[EMAIL PROTECTED]> Hello all I have to draw UML (class diagrams) by using Rational Rose for a java application (like a small supermaket application). Could you please give me some suggestions to do that: where to start, what I need.... Please note that I am not the person who developed the software. Thank you S.H1 == 2 of 5 == Date: Mon, Oct 25 2004 11:53 pm From: "Dag Sunde" <[EMAIL PROTECTED]> "HS1" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all > > I have to draw UML (class diagrams) by using Rational Rose for a java > application (like a small supermaket application). Could you please give me > some suggestions to do that: where to start, what I need.... > Please note that I am not the person who developed the software. > You could try to download jBuilder X Enterprise trial version from Borland, load the sourcecode into it, and click on the UML tab at the bottom of its editor window... (Just to see what JBuilder suggests...). -- Dag. == 3 of 5 == Date: Mon, Oct 25 2004 11:55 pm From: "Richard Chrenko" <[EMAIL PROTECTED]> On Tue, 26 Oct 2004 15:40:36 +1300, HS1 <[EMAIL PROTECTED]> wrote: > Hello all > > I have to draw UML (class diagrams) by using Rational Rose for a java > application (like a small supermaket application). Could you please give > me > some suggestions to do that: where to start, what I need.... > Please note that I am not the person who developed the software. > > Thank you > S.H1 > > What exactly is your question? Do you want to develop a new application from scratch by designing its class structure in UML and then generating the corresponding Java code? Or do you want to use UML to visualise the structure of an existing Java project? Either way, Rose can help you. == 4 of 5 == Date: Tues, Oct 26 2004 12:27 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> "HS1" <[EMAIL PROTECTED]> writes: > I have to draw UML (class diagrams) by using Rational Rose for a java > application (like a small supermaket application). Could you please give me > some suggestions to do that: where to start, what I need.... The people to told you you "had to" use Rational Rose has probably seen fit to provide you with that expensive resource hog, so just install it, and create a new project there, with Java as the default language. == 5 of 5 == Date: Tues, Oct 26 2004 12:23 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> HS1 wrote: > Hello all > > I have to draw UML (class diagrams) by using Rational Rose for a java > application (like a small supermaket application). Could you please give me > some suggestions to do that: where to start, what I need.... (a) Learn UML - at least the most important diagram types (b) Learn object-oriented analysis and design, the UML way, or any other well established way. (c) Learn how to operate Rational Rose (d) Learn Java (e) Design your application > Please note that I am not the person who developed the software. This is bad. The whole situation is bad. You are apparently inexperienced, so the poor programmer will get something of questionable quality as input. There is an old rule: "Garbage in, garbage out". So better don't expect a real good application as the result. I will spare you my critics of UML (UML is helpful in some cases, but is definitely not the silver bullet, and has some week areas), but UML might well contribute to your problems. And please don't believe that using a tool will allow you to skip learning UML and OOA/OOD. Good luck, I think you need it. /Thomas ========================================================================== TOPIC: Bitmask & Graphics Question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e71e0de5e98faaa2 ========================================================================== == 1 of 2 == Date: Mon, Oct 25 2004 8:55 pm From: Rod Nibbe <[EMAIL PROTECTED]> I wrote a simple program several years ago that reads a Targa graphics file (.tga) and displays it. It works fine, but today I had occasion to resurrect this code and for the life of me I can't figure out what I did in setting the rgb values. The entire program is below. The part of the code I'm struggling with is here, where I set the rgb value for each pixel used to populate a BufferedImage: bi = new BufferedImage(image_width, image_height, BufferedImage.TYPE_INT_RGB); byte [] image = new byte[npixels*3]; int rgb = 0 ; for(int i=npixels,r=2,g=1,b=0; i>0; r+=3,g+=3,b+=3,i--) { // WHY NOT SIMPLY THIS...? rgb = image[r] << 16 ; // rgb = image[r] << 16 ; rgb |= (image[g]&0xff) << 8 ; // rgb |= image[g] << 8 ; rgb |= (image[b]&0xff) ; // rgb |= image[b] ; bi.setRGB(x,y,rgb) ; // increment x/y ... } If I mask the green(g) and blue(b) pixels with 0xff (8 bits of ones) before the left bit shift, the picture displays perfectly. If I don't mask first, the picture is produced but the colors are hokey. Here's where I'm confused. Performing a logical AND (&) with 0xff on a given value just returns the value. So why... ...isn't this ----> rgb = image[r] << 16 ; rgb |= (image[g]&0xff) << 8 ; rgb |= (image[b]&0xff) ; the same as this? ----> rgb = image[r] << 16 ; rgb |= image[g] << 8 ; rgb |= image[b] ; Thanks in advance, -RKN <code> package Targa; import java.io.*; import java.awt.image.BufferedImage; import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.BorderLayout; public class TargaReader extends JPanel { BufferedImage offs = null ; Graphics2D g2 = null; public TargaReader(){ super(false); } public void paintComponent(Graphics g) { super.paintComponent(g) ; g2 = (Graphics2D)g; if(offs == null) { return ; } g2.drawImage(offs,0,0,this) ; g2.dispose() ; } public AppFrame getFrame() { AppFrame app = new AppFrame("Display Targa File") ; app.getContentPane().setLayout(new BorderLayout()); app.center(); app.setContentPane(this) ; return app ; } public static void main(String [] args) { DataInputStream tr = null; String filename = null; BufferedImage bi = null; int lsb,msb,image_width=0,image_height=0; short xorigin,yorigin,width,height ; byte pixeldepth,imagedesc; if(args.length > 0) { filename = new String(args[0]); } else { System.out.println("Usage: java TargaReader targafile"); System.exit(-1); } try { tr = new DataInputStream(new FileInputStream(filename)); tr.read() ; // ID Length <1 byte> tr.read() ; // Colormap type <1 byte> tr.read() ; // Image type <1 byte> tr.skipBytes(5); // Colormap indicies, not used here. <5 bytes> tr.skipBytes(4); // X and Y origin, ignore. <4 bytes> lsb = tr.read() ; msb = tr.read() ; image_width = ((msb << 8) | lsb) ; System.out.println("Image Width: "+ image_width ) ; lsb = tr.read() ; msb = tr.read() ; image_height = ((msb << 8) | lsb) ; System.out.println("Image Height: "+ image_height); // Assuming 24-bit pixel depth with no alpha channel. System.out.println("Pixel Depth: "+tr.read()) ; // Pixel depth <1 byte> System.out.println("Image Descriptor: "+tr.read()) ; // Image descriptor <1 byte> int npixels = image_width*image_height ; int rgb = 0; int x = 0; int y = image_height-1; bi = new BufferedImage(image_width, image_height, BufferedImage.TYPE_INT_RGB); byte [] image = new byte[npixels*3]; try { tr.readFully(image) ; //fetch image data, rgb <24-bit> } catch (EOFException eofe) { System.out.println( "EOF:" + eofe.toString() ); } for(int i=npixels,r=2,g=1,b=0; i>0; r+=3,g+=3,b+=3,i--) { // WHY NOT THIS?... rgb = image[r] << 16 ; // rgb = image[r] << 16 ; rgb |= (image[g]&0xff) << 8 ; // rgb |= image[g] << 8 ; rgb |= (image[b]&0xff) ; // rgb |= image[b] ; bi.setRGB(x,y,rgb) ; x++ ; if(x == image_width) //New scanline { x = 0; y--; } } } catch (FileNotFoundException fnf) { System.out.println("File "+filename+" Not Found") ; System.exit(-1); } catch (IOException ioe) { System.out.println("General IO Exception\n" + ioe.toString()); //System.exit(-2); } TargaReader targa = new TargaReader() ; targa.offs = bi ; AppFrame jf = targa.getFrame() ; jf.setSize(image_width,image_height); jf.center(); jf.setVisible(true); } } </code> == 2 of 2 == Date: Mon, Oct 25 2004 10:16 pm From: Babu Kalakrishnan <[EMAIL PROTECTED]> Rod Nibbe wrote: > I wrote a simple program several years ago that reads a Targa graphics > file (.tga) and displays it. It works fine, but today I had occasion to > resurrect this code and for the life of me I can't figure out what I did > in setting the rgb values. The entire program is below. > > The part of the code I'm struggling with is here, where I set the rgb > value for each pixel used to populate a BufferedImage: > > bi = new BufferedImage(image_width, image_height, > BufferedImage.TYPE_INT_RGB); > > byte [] image = new byte[npixels*3]; > int rgb = 0 ; > > for(int i=npixels,r=2,g=1,b=0; i>0; r+=3,g+=3,b+=3,i--) > { // WHY NOT SIMPLY THIS...? > rgb = image[r] << 16 ; // rgb = image[r] << 16 ; > rgb |= (image[g]&0xff) << 8 ; // rgb |= image[g] << 8 ; > rgb |= (image[b]&0xff) ; // rgb |= image[b] ; > bi.setRGB(x,y,rgb) ; > // increment x/y > ... > } > > If I mask the green(g) and blue(b) pixels with 0xff (8 bits of ones) > before the left bit shift, the picture displays perfectly. If I don't > mask first, the picture is produced but the colors are hokey. Here's > where I'm confused. Performing a logical AND (&) with 0xff on a given > value just returns the value. So why... > > ...isn't this ----> rgb = image[r] << 16 ; > rgb |= (image[g]&0xff) << 8 ; > rgb |= (image[b]&0xff) ; > > the same as this? ----> rgb = image[r] << 16 ; > rgb |= image[g] << 8 ; > rgb |= image[b] ; > Actually I would like to see even the first value (image[r]) also to be and'ed with 0xFF before the shift. (May be the code works because the setRGB operation discards the top 8 bits). Since image is an array of bytes, the values held by it are assumed to be in the range -128 to +127. So if you don't perform the "&" operation, Java will sign extend the byte while performing the promotion to integer, and the MSB 24 bits will end up being "1" in case bit 7 of the byte value was 1. When you and with 0xFF, the sequence of operation is : "promote both values to int and perform the & operation to produce an integer result". So even if the top 24 bits become 1 during the promotion, the and operation will null them to zero. BK ========================================================================== TOPIC: jdeveloper project file structure http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f23ff9ae612cd6b5 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 9:00 pm From: "nooobody" <[EMAIL PROTECTED]> I am just starting with Jdeveloper 10g and would like to be able to create a file structure in a project or import files into a project while retaining the existing file structure. I get source files arranged in packages correctly but everything else, such as images and jsps end up as "miscellaneous files". It appears that Jdeveloper is providing a pseudo-view that hides the actual file tree. Also, I have not found a way to add an empty directory to a project without also adding a file in the directory and have had to sometimes resort to putting in a dummy file just to create the directory. This is all quite frustrating, to say the least. Any instructions or suggestions would be appreciated. ========================================================================== TOPIC: Interface design question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9a07ca46c4217868 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 9:09 pm From: Martha Goys <[EMAIL PROTECTED]> I may be over-thinking this, but had a question regarding best design of a interface. The function of this interface is very simple: take an object and produce another object from it (input and output are different types, but this is not important here). I'm debating on one of the following approaches: A) SomeClassA getOutput(SomeClassB input) or B) void setInput(SomeClassB input) SomeClassA getOutput() The plus I see with approach A is its simplicity, and that the flow is very obvious. The pluses I see with approach B is the use of bean syntax, which is very useful in reflection, etc. I suppose what's throwing me is that since this is currently just an interface, it's hard to see if there's really much difference in the two approaches above. Any words of wisdom? Thanks, M ========================================================================== TOPIC: import JavaBeans question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffe416c3e6f4500c ========================================================================== == 1 of 2 == Date: Mon, Oct 25 2004 9:19 pm From: "HS1" <[EMAIL PROTECTED]> Hello all I run a simple java class copied from a book (only one class). However, there is an error in a line of the code: import javax.ejb.*; Could you please help to to fix this (I think that I did not install JavaBeans into my IDEs) Many thanks S.H1 == 2 of 2 == Date: Tues, Oct 26 2004 12:28 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> "HS1" <[EMAIL PROTECTED]> writes: > import javax.ejb.*; You need to attach the J2EE classes to your project, either a vendor-specific jar or the j2ee.jar from Sun's J2EE SDK. ========================================================================== TOPIC: Newbee Question about random numbers http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5332da2a87b1a4a ========================================================================== == 1 of 2 == Date: Mon, Oct 25 2004 9:24 pm From: marcus <[EMAIL PROTECTED]> Jacob -- if I had looked a little deeper I would have seen tor is a regular and usually more careful but . . . giving an API instead of encouraging thought is -- believe it or not -- bad for everyone. Jacob wrote: > marcus wrote: > >> it is a kind of thing in this ng to not give homework answers > > > There is no such "kind of thing". > > If you don't like to post answers to assignments, then > don't. Others will decide for themselves what to do. > > Anyone can ask questions or launch discussions. If the > feedback solves an academic or an enterprise problem > should be the same. > > In general: Respond to *good* problems and ignore *bad* > ones. This encourage good questions and discussions and > will keep the quality of the stream high in the long run. > == 2 of 2 == Date: Mon, Oct 25 2004 9:24 pm From: marcus <[EMAIL PROTECTED]> nope Alex Hunsley wrote: > marcus wrote: > >> tor-- it is a kind of thing in this ng to not give homework answers, >> buddy >> > > Can you please not top-post Marcus? > ta > alex ========================================================================== TOPIC: peculiar JMF portability problems http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3127aa6a3aacbc9f ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 9:31 pm From: [EMAIL PROTECTED] (dev null) Dear JMF wizards: I'm having a serious portability problem between Solaris and Windows. A simple program together with platform and Java version info is below. I have two questions which I would be much obliged if you can help answer. First, what is going on under Windows that causes the JMF to think it took more than 96 hours to realize the player as opposed to about a second on Solaris running the same class file? Is there any work-around available? This is really amazing (and really annoying)! Second, when I ran the JMF's exe installer on the Windows machine under my user account and in my user-controlled space, I could not run this program in spite of setting all my shell vars as the Readme file instructs. But, when I asked a System Administrator to do the install, the program ran fine (except for the above mentioned Time problem). This will be a serious drawback to my user community if an Administrator has to be found to run the install on every Windows machine they want to run my app on. Is there any work-around for a regular Windows user to run this install and not get Access Denied and ClassNotFound (on classes in the JMF's lib) errors? TIA. Example program and results follow. // file: Test.java import java.io.*; import java.net.*; import javax.media.*; public class Test implements ControllerListener { Player player = null; public Test (String file) { try { URL url = new URL (file); MediaLocator ml = new MediaLocator (url); if ((player = Manager.createPlayer (ml)) == null) throw new NoPlayerException ("player"); player.addControllerListener (this); player.realize (); } catch (Exception e) { e.printStackTrace (); } } public void controllerUpdate (ControllerEvent event) { if (event.getSource ().equals (null)) return; System.out.println ("\nnew event: " + event.toString ()); if (event.getSource ().equals (player)) { synchronized (player) { try { if (event instanceof RealizeCompleteEvent) { System.out.println ("\ncurrent Time offset: " + player.getTimeBase ().getTime ().getSeconds ()); player.setTimeBase (null); System.out.println ("after setting to null: " + player.getTimeBase ().getTime ().getSeconds ()); player.start (); } else if (event instanceof StartEvent) { System.out.println ("\nexiting"); System.exit (0); } } catch (Exception e) { e.printStackTrace (); } } } } public static void main (String args[]) { new Test (args[0]); } } /* on Solaris: % uname -ir 5.8 SUNW,Sun-Blade-100 % java -version java version "1.4.1_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06) Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode) % wc -c jmf*sh 4778152 jmf-2_1_1a-solsparc.sh % java Test file:///home/data/movie.mpg new event: [EMAIL PROTECTED],previous=Unrealized,current=Realizing,target=Realized] new event: [EMAIL PROTECTED],[EMAIL PROTECTED] new event: [EMAIL PROTECTED],previous=Realizing,current=Realized,target=Realized] current Time offset: 1.8250000000000002 after setting to null: 1.8290000000000002 new event: [EMAIL PROTECTED],previous=Realized,current=Prefetching,target=Started] new event: [EMAIL PROTECTED],previous=Prefetching,current=Prefetched,target=Started] new event: [EMAIL PROTECTED],previous=Prefetched,current=Started,target=Started,[EMAIL PROTECTED],[EMAIL PROTECTED] exiting ================= on PC: from Control Panel -> General: System: Microsoft Windows 2000, 5.00.2195, Service Pack 3 Computer: Intel(R) Pentium, (R) 4 CPU 1.70 GHz, AT/AT COMPATIBLE, 523,696 KB RAM C:\> java -version java version "1.3.1" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24) Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode) C:\> dir /b jmf*.exe jmf-2_1_1a-win.exe 1 File(s) 5,251,218 bytes C:\> java Test file:\\data\movie.mpg new event: [EMAIL PROTECTED],[EMAIL PROTECTED] new event: [EMAIL PROTECTED],previous=Realizing,current=Realized,target=Realized] current Time offset: 346248.34 after setting to null: 346248.341 new event: [EMAIL PROTECTED],previous=Realized,current=Prefetching,target=Started] new event: [EMAIL PROTECTED],previous=Prefetching,current=Prefetched,target=Started] new event: [EMAIL PROTECTED],previous=Prefetched,current=Started,target=Started,[EMAIL PROTECTED],[EMAIL PROTECTED] exiting */ ========================================================================== TOPIC: Character encoding between Win and *nix http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d00907704bee1888 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 11:29 pm From: [EMAIL PROTECTED] So wait up, I should make a backup of the entire message then, because I need it to locate the encoding specification... BTW what do you mean by directly or indirectly reading the content? To determine encoding I would parse the entire message using any given charset, since the specification would be in plain old ASCII anyway... Whether or not the client is providing a correct char encoding specification is not my concern. I (the server) am acting acccording to the specifications... Thx, Piet PS: for further explanation of my problem, take also a look at http://groups-beta.google.com/group/comp.lang.java.programmer/browse_frm/thread/8d7da38f00e609e9/ca03e45987b8aafa?_done=%2Fgroups%2Fstarred%3F&_doneTitle=Back+to+overview&#ca03e45987b8aafa ========================================================================== TOPIC: reference to a jar file inside another jar file http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7dab58f45ecad79c ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 11:31 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Mon, 25 Oct 2004 18:20:54 +0200, JML wrote: > ...My > idea is getting a single jar file which contains all the needed jar files. Let us know how that goes, pop back if you have any questions. -- 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: What's the best way to acess the model from the view in a MFC approach? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1e891af3d3a7da1d ========================================================================== == 1 of 3 == Date: Mon, Oct 25 2004 11:35 pm From: "***C.Steamer***" <[EMAIL PROTECTED]> Say I got a class that extends JPanel and I want to update the model class from within the JPanel class, what is the best way to do that. I already implement an Observer pattern to update the GUI from the model but how do we go the other way. Basically I will be clicking on an area of the panel and based on which object I select I want to change something in the model class. Should I just pass in all the classes that the GUI will need? I don't like this method cuz then you have to have the classes already instantiated before you build the gui and it makes for intermixed code. Or should I make the model class into Singleton so I can statically access the class from anywhere? Thanks for your help? == 2 of 3 == Date: Mon, Oct 25 2004 11:38 pm From: "------Dacleaver------" <[EMAIL PROTECTED]> "***C.Steamer***" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Say I got a class that extends JPanel and I want to update the model class > from within the JPanel class, what is the best way to do that. I already > implement an Observer pattern to update the GUI from the model but how do > we go the other way. Basically I will be clicking on an area of the panel > and based on which object I select I want to change something in the model > class. Should I just pass in all the classes that the GUI will need? I > don't like this method cuz then you have to have the classes already > instantiated before you build the gui and it makes for intermixed code. Or > should I make the model class into Singleton so I can statically access > the class from anywhere? Thanks for your help? > Ops, I mean the MVC approach not the MFC. Sorry == 3 of 3 == Date: Tues, Oct 26 2004 12:34 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> ***C.Steamer*** wrote: > Say I got a class that extends JPanel and I want to update the model class > from within the JPanel class, what is the best way to do that. Do you really expect to get answers after Message-ID: <[EMAIL PROTECTED]> ? Oh, and changing you name doesn't help. But when you do, consider removing the "I-am-cleaver". It also doesn't help to post to the wrong group (well after the above referenced post it also won't help you to post to the right one) and it doesn't help using slang like "cuz". Trust us, you don't look cool. /Thomas ========================================================================== TOPIC: Java application developped under Linux running ridiculously slow under Windows http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9 ========================================================================== == 1 of 1 == Date: Mon, Oct 25 2004 11:47 pm From: [EMAIL PROTECTED] (Matthias Ernst) "hshdude" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > "Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > There are programs called profilers that tell you exactly where an > application > > spends its time. Get one of these and use it. > > Thanks, I'll look into that! While in the end the output may be very nice, I always find profilers a little difficult to set up. I mostly use poor man's sampling: hit CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some thread dumps (with many threads, these will be long). Often it's easy to tell where the bottleneck is. If you still have no idea after a minute, then go get a profiler ... Matthias ========================================================================== TOPIC: Oracle JDBC XA question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ded1e7f0747a226 ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 12:13 am From: Lee Fesperman <[EMAIL PROTECTED]> spiderbug wrote: > > > Good! Your response made me dig a little. I had mostly just consulted > > the XA spec, which was vague in that area. Looking deeper, I checked > > our (FirstSQL/J ORDBMS) XA code, which does support mixing global and > > local transactions in this manner, and checked the JTA spec. > > > > Section 3.4.7 "Local and Global Transactions" in my JTA spec (1.01B) > > encourages a resource adapter (JDBC Driver & RDBMS) to support local > > transactions on a connection after being 'disassociated' from a global > > transaction with end(). OTOH, the section does also permit an RDBMS > > to disallow it and throw a native exception. > > > Hmm - thanks for your response...But even if the resource adapter > decides to not allow mixing of transactions, it should support > subsequent transactions one after the other and without committing the > previous one (committing, not ending - it definitely has to be ended). > xares.start(xid1) > xares.end(xid1) > xares.start(xid2) > xares.end(xid2) > ....prepare..commit....etc etc.. Agreed. In the JTA spec (prior section: 3.4.6), it states that resource adapter must be allow mixing of global transaction branches (Xid's) on the same XAResource in the manner above. > Anyway I checked a few other XA drivers - they all differ in their > behaviour as far as mixing is concerned. So I guess that's it. But > even then, Oracle's error messages leave a lot to be desired. It seems that a number of RDBMS vendors are not compliant in their XA implementation. That's the sense I've gotten talking to Transaction Manager vendors. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: How tom create a NEW class online http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1552191b47783f48 ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 12:36 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Tor Iver Wilhelmsen wrote: > Reflection is for analysing and using existing classes. You want to > synthesize a class, there are tools/APIs for that, though I cannot > remember any at the moment. http://jakarta.apache.org/bcel/ /Thomas ========================================================================== TOPIC: Challenge: Triangles puzzle http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0 ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 12:43 am From: "Tayssir John Gabbour" <[EMAIL PROTECTED]> Frank Buss wrote: > [EMAIL PROTECTED] (Chris Dams) wrote: > > Did you reach any interesting (or uninteresting) conclusions from > > the solutions? > > yes, but it is not a new conclusion: The language doesn't matter, > if you have a good idea. The useful thing was though, that I didn't have any conscious idea of what I was doing. Usually with my previous languages, I always made my thoughts explicit (for example, on things like paper). Being in control. After being inspired by the video, I am now experimenting with trying other extreme, which is like falling backwards in the expectation that I can actually levitate. Maybe I'm just weakly and slowly groping around, but I liked the moment when I thought, "Hmm, so that's what I'm doing." For example, if there were something tricky about it, I might have signalled a warning and left restarts for later. Meat & potatoes stuff which has nothing to do with what Lisp is hyped for (and didn't appear in the code), but quietly takes away intellectual issues so you can do as you wish. I certainly don't want my code to be any representative example of Lisp, in the eyes of the public, but I thought it was fun and edumacational. I kind of hope no one tries drawing any lessons from what I did. ;) On the other hand, I liked that Literate Haskell answer. Sort of the opposite approach. MfG, Tayssir ========================================================================== TOPIC: How to know if a CD is inserted in the cdrom drive from java ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5d0b1b8567b852 ========================================================================== == 1 of 2 == Date: Tues, Oct 26 2004 12:50 am From: [EMAIL PROTECTED] (Toni) I would like to know if there is a way to handle the cdrom drive from java, like to know if a CD is inserted and maybe know some specifications about the cd inserted like if it contains data or if it is CD-R or CD-RW.Thank you. == 2 of 2 == Date: Tues, Oct 26 2004 1:11 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Toni wrote: > I would like to know if there is a way to handle the cdrom drive from > java, No, not without native code. This is almost an FAQ. Which reminds me, I don't know the current state of this group's FAQ. I haven't seen one posted for a long time. /Thomas ========================================================================== TOPIC: internationalization & localization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6740a8dfcd250166 ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 12:48 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Praveen wrote: > Hi..All, > > I am newbie to "internationalization & localization" concept. From a > Oracle DB how do I read the data & display in any language the user > requests for. Any pointers to website(s) / help would be really appreciated. What about starting with the related parts of the JDK documentation (you did download it with the JDK, didn't you?). As part of the documentation you find: http://java.sun.com/j2se/1.5.0/docs/guide/intl/index.html /Thomas ========================================================================== TOPIC: how to convert "BigInteger" into "Integer"? how to print out a BigInteger binary value? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adbd22198c0e7422 ========================================================================== == 1 of 2 == Date: Tues, Oct 26 2004 1:18 am From: [EMAIL PROTECTED] (nick) 1. bitstring=new BigInteger("1010",2); System.out.print(bitstring); the print out answer will convert to decimal ,how to print out a binary value? 2.how to convert "BigInteger" into "Integer"? thanks! == 2 of 2 == Date: Tues, Oct 26 2004 1:22 am From: [EMAIL PROTECTED] (nick) 1. bitstring=new BigInteger("1010",2); System.out.print(bitstring); the print out answer will convert to decimal ,how to print out a binary value? 2.how to convert "BigInteger" into "Integer"? thanks! ========================================================================== TOPIC: How to starthandshake with client browser?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d41b9d8f6879f8b ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 1:20 am From: [EMAIL PROTECTED] (Jakekeke) I am using JSSE to write a TCP socket program. The task i need to do is reveice a CONNECT response from a browser, ie HTTPS. And then my program need to communicate with the destinated server. My program can named as Proxy Server,however, it is a simply proxy server what it should do is: communicate between browser and server, and log down all the data transfer, including the request and response header. So, would anyone can tell me how to solve the problem i mention above? You may provide some program statement for me to follow, or describe what the 3 bodies, client/proxy/server should do in each timeslot. Thank you. p.s. It is very urgent ========================================================================== TOPIC: How use java.util.logging.config.class? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f086cadd5f41a7 ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 1:25 am From: Tobias Besch <[EMAIL PROTECTED]> I want to use java.util.logging togehter with Web Start. Since specifying a configuration file with the system property java.util.logging.config.file does not work with Web Start (because you cannot specify a file path) I'd like to try java.util.logging.config.class and put that class into the classpath. As I searched the Internet I found examples for specification of configuration files. But I couldn't find any example on how to specify logging properties in a class. Could you please help me? Kindest Regards, Tobias ========================================================================== TOPIC: System.load("..."); http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a44e35955f7f8cf ========================================================================== == 1 of 1 == Date: Tues, Oct 26 2004 1:57 am From: Michael Wiedmann <[EMAIL PROTECTED]> Do I have to configure - on a Unix-like system - the configuration file of the dynamic loader (/etc/ld.so.conf) with the pathname of the shared object to be loaded by System.load("...") or does the VM all by itself? Example: System.load(/path/to/file.so); Michael ======================================================================= 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
