Article View: borland.public.jbuilder.java.swing
Article #7741Re: What is wrong with this code: Combo box displays incorrectly?
From: Reid
Date: Sat, 06 Jan 2001 03:23
Date: Sat, 06 Jan 2001 03:23
207 lines
9751 bytes
9751 bytes
Rich, I have started another thread for this topic in the borland.public.jbuilder.applet-issues newsgroup because it no longer relates to this thread as far as the thread's name is concerned. The new thread is called "Painting an image on a JPanel". My latest message contains the complete code to the applet and how I was attempting to paint the image using a component that decends from Canvas. It is of course not complete and eventually the image will get painted as the user selects a title from the drop down list. The problem I am having is that the helper class I am using that decends from Canvas has a paint method and that paint method never gets called from the "setImage()" method of that object. If you get a chance to look at it and configure it out please do. If not you have been a great help and I thank you again. Reid Rich Wilkman wrote: > Reid: > > You can get a graphics object off of anything coming off Component. Your Applet > examples probably just use this.getGraphics(), but you should be able to do it off > of any widget that descends from Component. Off of JComponent you have the stuff > from Component plus items like getComponentGraphics (which may just delegate to the > old one). You can also get a Graphics2d context from somewhere that memory fails > me at the moment. > > -Rich > > Reid wrote: > >> Hello, >> >> Ok point taken. >> >> I will alter the tag before I deploy it. >> >> I am now trying to figure out how to draw images on a canvas of a JPanel >> of an applet. Or whatever other means to use to draw the image on a >> portion or the applet's area. >> >> So far any references in the books I have for drawing images in applets >> seem to be through the paint method where the "g" parameter coming in >> holds the context of the whole applet. >> >> If you have any clues on this that would be fantastic.. >> >> Reid >> >> Rich Wilkman wrote: >> >>> Reid: >>> >>> I was banking on the case sensitivity -- it get's everyone at least twice. >>> :-) >>> >>> Tor is correct. Only NS6 and Opera (neither of which are in huge deployment >>> at the moment) support a modern JDK with the normal <Applet> tag. Older and >>> more widely deployed browsers with the plugin must have the HTML converted to >>> let the Plugin work. In those browsers, even with the plugin, your Applet >>> would choke because your HTML hasn't been converted. >>> >>> -Rich >>> >>> Reid wrote: >>> >>>> Rich, >>>> >>>> I have now got this applet working correctly. >>>> The problem was that I was not paying enough attention to the case >>>> sensitivity issue. >>>> >>>> You mentioned in your previous post .. >>>> >>>> <<< >>>> If you are running it with the plugin, the APPLET elements needs to be >>>> changed into OBJECT (for MSIE) or EMBED (For Netscape 4). >>>> >>>> I have not altered the <APPLET> tag at all except for the case >>>> sensitivity change and it seems to run fine. >>>> >>>> Is there a problem I am not seeing? >>>> >>>> One strange thing is that the drop down does not display in the correct >>>> place when dropped down in the HTML file is loaded or viewed inside >>>> JBuilder's IDE. But does when using Netscape 6.0. >>>> >>>> Reid >>>> >>>> Rich Wilkman wrote: >>>> >>>>> Reid: >>>>> >>>>> Applets are not for newbies so don't kick yourself or be surprised if it >>>>> takes you 20 more hours to get the pattern and steps correct. >>>>> >>>>> You say you are using the Plugin. If that is the case then the Applet >>>>> tag you posted won't activate the plugin (you have to run it through the >>>>> HTML converter first). >>>>> >>>>> The class you need must be in the jar in your archive parameter. Open >>>>> up the jar file that you've built and look inside. If it's not there, >>>>> go through the docs on the Archive Builder (or use the old Deployment >>>>> Wizard addin from Code Central). If the jar file does contain your >>>>> class then it's time to chase other items (and we'd need to see your >>>>> *real* applet tag at that point along with a description of the >>>>> directory layout on the server -- remember that Java is case sensitive >>>>> so MyArchive.MyAppletClass.class is not the same as >>>>> myarchive.MyAppletClass.class. As an aside, the norm is for a lowercase >>>>> package name with mixed case class names -- something that JBuilder >>>>> doesn't enforce but is the pattern that it suggests in all it's wizards. >>>>> >>>>> You also might want to stop and do some quick homework to provide you >>>>> with a sanity check to show you that it is possible to deploy an applet. >>>>> >>>>> http://www.got.net/~rwilkman/java for the basics and tutorials (sadly >>>>> not updated for the Archive Builder yet). All of this info, however, is >>>>> in the online docs (search on Applet). Almost verbatim, in fact, but >>>>> the Pubsters at Borland have to be, uh, more neutral in their >>>>> presentation than I have to be. >>>>> >>>>> -Rich >>>>> >>>>> Reid wrote: >>>>> >>>>>> Thanks for the response. >>>>>> >>>>>> I have been at this simple task for 20 hours or more.. >>>>>> >>>>>> You say "Only if I select the JBCL option in the wizard" .. >>>>>> >>>>>> As a newbie I don't know if this is required or not... I am just >>>>>> trying to get an applet to run outside the JBuilder IDE. I do know >>>>>> that I want to have an applet that uses swing. I need the archive >>>>>> builder to build an archive of the current applet's class and ALL the >>>>>> other dependencies so that the thing will actually run!! ( I am >>>>>> assumming that the archive builder will optimize this by only >>>>>> including what is actually needed) >>>>>> >>>>>> I know that the browser attempting to load the applet either cannot >>>>>> find the VerticalFlowLayout class or what appears to be "all the rest >>>>>> of the classes". I know that an applet's world is defined by that >>>>>> applet's <TAG>. I have tried different settings the properties of >>>>>> the <TAG> with no success. I have taken others advice, read pages and >>>>>> chapters on this topic and still have had no success. >>>>>> >>>>>> For instance if the applet is called "MyAppletClass.class" and that >>>>>> class and all others needed were included in the .jar file I would >>>>>> assume that the <APPLET> tag would just need to be something like .. >>>>>> >>>>>> <APPLET >>>>>> CODEBASE = "." >>>>>> ARCHIVE = "MyArchive.jar" >>>>>> CODE = "MyArchive.MyAppletClass.class" >>>>>> NAME = "TestApplet" >>>>>> WIDTH = 400 >>>>>> HEIGHT = 300 >>>>>> HSPACE = 0 >>>>>> VSPACE = 0 >>>>>> ALIGN = top >>>>>> >>>>>> </APPLET> >>>>>> >>>>>> And if the MyArchive.jar archive was in the same directory as the HTML >>>>>> file that loads it that all would be well. Well it's not. ;) >>>>>> >>>>>> Because I am a newbie to Java I am not 100% sure of what the &*^% is >>>>>> going wrong here. >>>>>> >>>>>> Even if I use the "Include All" options of the archive builder dialog >>>>>> on each tag and end up with a 1.2 mg .jar file it still doesn't >>>>>> run.... :( >>>>>> >>>>>> What I need is someone to send me a small project that is a JBuilder >>>>>> applet that USES JBUILDER CLASSES (like VerticalFlowLayout, Swing, >>>>>> etc..) with a .JAR file that contains EVERYTHING and an accompanying >>>>>> HTML file that will load it correctly in a browser. (I have the Java >>>>>> Plug in I need). >>>>>> >>>>>> Sorry for the shouting, it's just that I am getting sick of trying to >>>>>> do such a small task unsuccessfully over, and over, and over ... >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Reid >>>>>> >>>>>> >>>>>> Tor Iver Wilhelmsen wrote: >>>>>> >>>>>>> Reid <reidr@buzybee.com> writes: >>>>>>> >>>>>>> >>>>>>>> But doesn't the Archive Builder create an archive that contains ALL >>>>>>>> the classes necessary for running the applet? >>>>>>>> >>>>>>> Only if you select the JBCL library in step 3 in the wizard and >>>>>>> choose >>>>>>> one of the "include required classes" options for it. >>>>>>>
Technical Details
Message-ID:
<3A568FAC.9050107@buzybee.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!dnews!165.121.119.6References:
<3A4BAE85.6010902@buzybee.com> <92i49k$qai3@bornews.inprise.com> <3A4CCC64.8050402@buzybee.com> <3A4E6174.39CAF201@formlessvoid.com> <3A4E72EF.9070703@buzybee.com> <3A4EACB3.9080406@buzybee.com> <3A5015E6.F611EC11@formlessvoid.com> <3A50184D.1070902@buzybee.com> <3a539841_2@dnews> <3A53DCE6.2090709@buzybee.com> <uwvcbaeyk.fsf@sds.no> <3A54ABC9.7090409@buzybee.com> <3A54AFAB.4782042F@formlessvoid.com> <3A555B80.9080701@buzybee.com> <3A56052D.92BFAA49@formlessvoid.com> <3A566430.8070504@buzybee.com> <3A566D4E.6F4E4F2D@formlessvoid.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,67e3718c633b6313 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-05 19:18:24 PST Message-ID: <3A568FAC.9050107@buzybee.com> Date: Fri, 05 Jan 2001 19:23:24 -0800 From: Reid <reidr@buzybee.com> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: What is wrong with this code: Combo box displays incorrectly? References: <3A4BAE85.6010902@buzybee.com> <92i49k$qai3@bornews.inprise.com> <3A4CCC64.8050402@buzybee.com> <3A4E6174.39CAF201@formlessvoid.com> <3A4E72EF.9070703@buzybee.com> <3A4EACB3.9080406@buzybee.com> <3A5015E6.F611EC11@formlessvoid.com> <3A50184D.1070902@buzybee.com> <3a539841_2@dnews> <3A53DCE6.2090709@buzybee.com> <uwvcbaeyk.fsf@sds.no> <3A54ABC9.7090409@buzybee.com> <3A54AFAB.4782042F@formlessvoid.com> <3A555B80.9080701@buzybee.com> <3A56052D.92BFAA49@formlessvoid.com> <3A566430.8070504@buzybee.com> <3A566D4E.6F4E4F2D@formlessvoid.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 165.121.119.6 X-Trace: 5 Jan 2001 19:14:42 -0800, 165.121.119.6 Lines: 208 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!dnews!165.121.119.6