---
title: WWDC2003 Session 608
framework: wwdc
role: article
path: wwdc/wwdc2003-608
---

# WWDC2003 Session 608

## Transcript

Kind: captions Language: en very exciting I'd like to thank you guys for for coming here so early in the morning and see a crowd like this and I think all right job security so my name is Matt rants and I work in developed at export so for all of you who may be submitting tech support incidents to DTS at apple com there's a 50-50 chance that you'll be talking to me the other chances that you'll be talking to Ted jus civic who will be up here a little later to give the other half of this presentation so what are we doing today what are we talking about so Apple has been trying to convey the message is much possible that we feel that Java applications are first-class citizens on Mac OS 10 we offer a lot of tricks and tips and techniques that you can use to improve the user experience of your Java app on Mac OS 10 make it feel as Mac life as possible and we also have a lot of deployment options for your end user desktop applications that we're going to be talking about today and most of the technical details in this talk will be regarding the 1412 a tu se that's now available for mac OS 10 Jaguar and of course Panther for Jaguar available in software update and there's also a developer update with tools and headers and such that you can get from the ADC website at connect a pecan so what are we what specifically we're gonna be talking about today I'm going to talk a little bit about some some pertinent directories on Mac OS 10 where where where to put certain files and wit fine things I'm going to talk about the aqua look and feel for swing just out of curiosity how many people were at the State of the Union talk on Monday ok a lot of you so I'll run through that since you saw most of it already and I'm going to talk about some cross-platform you I programming techniques that will benefit you on the Mac as well as on Windows or Linux or anywhere else you're looking to deploy and develop and I'm going to talk about some specific things that you can do for Mac os10 to make things adhere better to the Aqua human interface guidelines standards just really make your java app is indistinguishable as possible from a cocoa or carbon application and Ted will come up a little later he'll talk about some of the runtime properties that we have available on Mac OS 10 and all the deployment options available to you as a developer so where things are like I said we're now shipping or we now have available the 14 1 SEK for mac OS 10 if developers are coming over from from other platforms typically we see a lot of shell script based applications and one of the more important areas and locations for running a java app is the concept of a java home so you can get to things like Java and Java Sea and so on and so forth so on Mac OS 10 we have a we have a evilly rememberable and implacable symbolic link that you can see up on the screen here called flash library / java / home and from there you can go down tube in and view Java and Java Sea etc etc and this will always be pointing to the current version of Matt of Java on Mac OS 10 so currently that's one for one previously on 10 dot one that pointed to 131 so that's something that you'll never have to update in your applications you always get the newest version and as far as extensions and day and I directories that's I guess the equivalent all the platforms would be a live x or Java library path on Mac OS 10 you can drop your day ni library of your extension jars in library Java extensions off the route as well as off the home directory the user's home directory so if you have some some jars or de ni libraries that you don't want to vail with the entire system and you just want within the scope of a single user you can drop them there as far as doing jni work or vm indication work with with native code the the vm headers are available inside the Java VM framework you can see the path up here if you're doing development with Xcode or formerly known as project builder all you need to do is add the Java VM framework to your project and the headers will immediately be added and you don't need to do in any additions to your paths or anything like that so let's talk a little bit about the aqua look and feel a lot of you've already seen this since you've been to the State of the Union but I'm going to run through it anyway aqua is the default fling look and feel for java apps on Mac OS 10 we have a we have symmetric weeks in there like the screen menu bar putting the menu bar for J frames like we would like to say where it's supposed to be we animate the default buttons on on J frames and route pain and we animate the indeterminate progress bar but that the just a barbershop stripe animation that you see on a cocoa and carbon apps there's a little bit on component sizing that you might need to get used to in certain places we sighs our components the way you know the aquos that suggests that they be so for example the picture behind me here is of age a combo box and a border layout and you can see the window below is in metal and the jcombobox is button expands to the size of the complete eastern container there the aqua version sums going on over there the aqua version is basically slides down to how you would expect it to look in an aqua application on Mac OS 10 so there's things like that that you might need that you might uh you might see change from platform to platform as we move over to 10 and we do similar things with Jay buttons and with with tabs and jay tabb pans and that's something i'll be showing you in a little while speaking of jay tabb hands one of the other parts of the aqua stats suggest that tabs to no matter how many of them you have being a single row other look and feels like like metal and windows and what's the celestron motif have support for multiple rows of tabs aqua does not does not like that so with our aqua look and feel for swing we made a single grow of tabs and the problem there is if what if you have more tabs and fit on the window that's the whole point of multiple rows so we created a navigation control in 14 that will drop a menu down for all the tabs you can't see and that will allow the user to to jump across to the tab that they may or may not want to see visa these names of the tabs of course aren't very descriptive but so I'm just going to pull up a demo here it shows you all the things i'm talking about understand that we've had quite a few questions about tabs in the last couple days so so i figured we should maybe show off what we've got here in 14 so very simple demo simply showing off what we have here in aqua the tabs look this is a standard font that you would see in a coco application and you know keep in mind that if it's the new OS were to come out and say change the layout font size and type of of all your controls and labels and I can't imagine why something like that would happen you'll get all that stuff for free if you use aqua swing you don't need to really need to give much care to any of that stuff so change the look and feel to the metal and one of the things you notice right away is that the the tab icon size changed over here on on my tab and my menu bar went down to the bottom here so one of the things that Mac os10 does I'll go back to this tab icon this is the icon that I'm using here and it's the same one that I'm using at the top here and that is being shrunk down by APPA to have the tabs a beta stack so you only get one size of tabs I know there are some people who were hoping there were multiple sizes I'm sorry to say that there aren't and left right bottom placement this is just regular Java Java calls I can't remember what the specific college for the tab pain to set the alignment but it behaves as you would expect in aqua and we have toolbar buttons the toggle buttons as you would expect toolbar toggle button we've got the fall buttons and you can see the animation can you oh good that's coming out well and you know as you'd expect I hit the enter key and the the button is activated and so on and so forth and here are my progress bars but my indeterminate products bar seems to that maybe a maybe a bug on my part let's see if I remember to actually turn it on and on well there it is so this is the indeterminate progress bar at the top and and animates as you would expect it to on as the carbon or cocoa application would do and at the bottom we have these determinants progress bar and they still actually animate as you move the window around which is kind of neat that's something that didn't happen in 131 and it's one of our advantages from being a cocoa base you I now instead of a carbon-based do I I think that's enough can we go back to the slide please alright so let's talk a little about cross-platform programming techniques a lot of things that I see working with a lot of developers how many developers we have here that are new to the mac or looking at the mac and and coming over it's immaculate 10 Wow so most of this crowd are people who are primarily naturalist ends all the developers that's great excellent but I'd like to extend a warm welcome to the people who are coming over to last year the last year the crowd was mostly windows and Solaris people coming over the mac so it's great to see a crowd to stick so this this list of the tips and tricks that I came up with basically I put together from working with a lot of developers coming over the platform and looking at some common mistakes or preconceptions that they had that they had in their heads about how Java behaved on every platform and actually some of it I've changed in the last 18 hours just from my experience in in the java lab downstairs so that's how committed I am to you so let's talk a little bit about working with components this is kind of fuzzy but generally you know you want to do as little as possible when you're styling and sizing your components in swing if you if you need to ask if you need to figure out you're making a custom component you want to know how big to make it you want to know what color to make the background you want to know what font to be using or what kind of icons to be using for a tech locks for example or you know get the striped background that you see in all the awkward controls you can usually ask the UI manager what to do for these for these for these kinds of things and all these properties that i have here for example the combo box back around the jtech box menu item check icon those are all swing standard properties those aren't Mac specific things one of the greatest things to do is a swing developer on something that I did very early on when I started to work at Apple is just write a little unit test that called you I manager get the fault and just dump all the keys and values those and and that can do a lot of a lot of good if you're looking to create custom components and you don't know how to make the aqua stripe background for example you don't know what font to use you don't know what I confused for a checkbox for example and far as sizing emplacement really the easiest thing the best thing that I would Matt can tell you to do is use the layout managers layout managers do most of the work for you they take care of spacing they take care of size our layout managers unless you unless you you know customizing typically do their best to size and space things according to the Aqua H i spec and they respect preferred size in the most case you usually want to make sure you're using a layout manager at the lowest level that respect the preferred size of a button for example the one first one that comes to mind is flowlayout obviously so I'm going to talk a little bit about day desktop pain and I don't see a lot of people using it that much anymore but I just wanted to mention it our big mantra is just say no to Jay desktop pain the real reason is there's really no equivalent to it on the Macintosh carbon and Coco have no concept of an MDI in your face and it's very confusing to user and all and I'll show you what I mean in a second there are plenty of alternatives to it you know I'd like I said I don't see a lot of people using it anymore most people are using at least on the Mac either it's just a multiple frame case if you have a document document based application like a text editor or you know with applications like jbuilder limewire project builder itunes all these other ones have not necessarily just one window but you know a single frame that has a bunch of different containers that move in and out and you know navigation tabs and stuff like that and that's perfectly acceptable and we definitely encourage that kind of development so this is what I was talking about a second ago you can see the day desktop paint up here and there's a window over here with the taxi cab and it appears to be of dragged off screen or just over to the right and there's bbedit in the background and you would expect you know my grandmother might expect that you know the other side of that window should be over bbedit but we don't know where that window has gone it's vanished and you know we also to docs here and you know I don't know where I minimize one window to if it's down in this stock in this other one it's really kind of counterintuitive and it doesn't really look like a Mac OS kind application in my opinion so our advice is stay away so talk about menu shortcuts now this is something that I still see a lot i talked about it last year but we have a new generation of developers i guess who maybe weren't here so the biggest one of the biggest things i see with with menu development is that people just typically from doing development primarily on windows see the control key as the shortcut and they hard code the control key is in menu shortcut that's really not the thing to do there's a much easier way of doing it you can just ask the tool kit at the AWC toolkit to get the menu shortcut key mask and it'll return control for you on Windows it'll return control for you on Linux overturn command or meta on the max and this is one call that you need to make you don't need to check your OS version or less vendor or anything like that and you'll get it every time you're basically you know pushing the work off to the host platform which is really what job is supposed to be doing another things another thing we would suggest is checking out the Aqua hoi guidelines to find out what what leverage shortcuts to use things like s4 save and o4 open we've got a big grid there for you know what the standard application things are so you can make your app look exactly like bbedit or Xcode or if that's you want and so what's the other thing mnemonics this is just a cosmetic thing worth mentioning the aqua human interface guidelines really makes no mention of mnemonics and they will work in aqua swing if you use them with the exception of the screen menu bar if you have mnemonics and you're in your menu item from the screen menu bar as soon as it goes up there we're not going to paint them anymore because that's kind of our prerogative to conform to the H I guidelines if you have them you know with other controls or anything like that they'll still be painted but for menu mnemonics we really suggest either conditionally placing them or not using them at all here if you're targeting the mac so contextual menus and mouse clicks right clicks control clicks that's the trick isn't it which is it so it could be either it depends on what kind of math your user has and as a developer you don't know who's going to be using your application so this can get to be a mess fortunately son has provided an easy method for this very similar the menu shortcut mass called is pop-up trigger you ask the mouse event should I be showing a pop up here and it tells you true or false it again defers the works of the host platform that's all you have to do about it no checking for masks or button numbers or anything like that the only trick is that you typically want to in your mouth listener check put this in the mouth press and the mouse the least methods on Windows it does it in one I believe windows doesn't matter least and the mac i believe its mouth press i might have been backwards the idea is used both and you know again control left is not button to so those don't register the same events on the math you know all max come with a one-button mouth so typically the pop-up trigger is a control click somebody buys the two button Mouse later and then they have the right click as the pop-up triggered that is not the same event in java so you really should use this abstracted method because then you don't have to worry about it so I wanted to talk quickly about file access I'm kind of being kind of being a you know really high level and abstract here you know there's different cases all the time but really try not to hard code file paths when you're getting to think use things like file dialogues use you know the user directory in the user home use the file director this file separator system property which gives you either /er backslash or you know whatever whatever is appropriate for the for the host platform if you have things like image files or anything that you need to load into your application it's very easy to just put those on the class app and then get to them using calls like class loader get system resource there are a bunch of equivalent calls like that and basically you can access anything on the class task that'll do that kind of thing and it's really handy to use with things like image icons or images and then you don't have to use any kind of file path at all you just use the file name and that's really handy so a little bit about image formats this is something that's come up this is more of a performance issue but since it deals with platform differences in image formats that i wanted to bring it up the an index color model in particular on mac OS 10 is just not native we're not not acceptable to core graphics so regardless of what we do in java those kind of images are going to perform badly core graphics also prefers images or color models with with with with an alpha value specified when you're working with a bufferedimage we suggest that you use the appropriate methods like create image or the best is create compatible images again that will push the work off to the host platform 22 [Music] oh yeah we'll put some puts the work off to the post platform to create a color model and image format that's that's most most compatible to the host platform and that'll work for you on windows too so and volatile limits has similar there are similar similar methods for that would create volatile image and so on and so forth there's an we're going to talk a little more about this in the the Java performance talk our graphics engineer will be talking a lot about this kind of thing and he probably won't forget what he's talking about so you should just go to that session so I'm going to talk a little bit about coding for Mac OS 10 things that you can do specifically on the Mac without much with without a whole lot of impact on your code base and on the way you deploy or develop and talk about illustrating document changes scrollbar policies toolbar button file dialogs our new extended awt API for doing things like handling the items in the application menu opening documents that you may want to write or save to and I'm going to talk about the Apple extended i/o class also so document changes first off let me notice anybody's working on Mac OS 10 if you're working in BB edit or a project builder or anything like that you notice whenever you have unsafe work you get a little black dot in the in the closed box well believe it or not you can do that with your java application we've added a little client property to j frames and jane i believe Jay internal frames also you just get the root planing the root pain and you set a client property called windows modified to either true or false and then we'll just immediately paint that little black dot in the closed box so if you have a document based application you want to do this kind of thing it's very simple and it's instantaneous is really not a lag or anything like that you don't need to do any kind of threading games to make sure the awt has been updated is pretty instantaneous so scrollbar policies the Aqua age I guidelines talk about if you have a window with scrollable content where it's potentially scrollable content even if your content is not moving off the complete area yet you should show the scroll bars at all times even if that's the time they're disabled so on the Left I have an example of you know somebody who's read the H I guidelines and set their scrollbar policies to true or always for vertical and horizontal because they expect the content will at some point go both down and to the right and on the right is somebody who didn't read the Aqua thi guidelines or fell asleep during this talk and didn't do so so I want to talk about toolbar buttons too if you put a jbutton in a day toolbar in aqua you'll get the square tool bar style button as you'd expect some people want to watch style buttons without a day toolbar and to do that it's another client property simply call quick climb property to and set j button button type to toolbar and in my aqua demo you might have noticed that I had a toolbar buttons floating around in a jpanel there and that's exactly what I did so file dialog this is something that came up in the lab a couple times so a lot of people are inclined to use jfilechooser because they're using swing and this is in the Java x-wing package but we really suggest using the AWT file dialog and the reason for that is that it's you know it very simply it's heavy weight so it's going to use the do s file dialog you're going to get the column view in Jaguar or in Panther out you know i'm not sure what they're calling it in panther anymore but there's a whole new file dialog and Panther and if you use the aw file dialog in your java apps when your java app gets moved on to a system with panther on it you will get that file dialog you won't need to wait for us to rewrite file chooser to local J file chooser to look like that answer dialogue for example and you do that with a simple system property Apple awt use file dialog patches packages by the way I didn't mention this at the beginning and saw if people are inclined to you know write this stuff down furious so you don't need to worry about it because it is all on the web and we'll be giving you a link later so if you've been cursing me from moving too fast please don't worry about and basically this this file dialog packages lets you not navigate inside app and packages file package files and normally those are technically folders so a dump file dialog might try to go into those and navigate the contents and resources and so on and so forth so if you slip this property you can actually select those as files which might be something that you want to do in your application so now I want to talk about our extended AWC api's this is the replacement for the mrj toolkit for those who might have been around long enough to note to know those api's there's basically two real classes that you need to know about there's the Apple II awt application which has two important methods one of them is to set the Preferences menu to enabled and that you know like it sounds enables the Preferences menu item and there's another method called add application listener and what that does is this is your hook into being able to handle all the items in the application menu things like the about application the preferences and the quit menu item and you would do that with the application adapter class there's also an interface called application listener but you know in the standard event model like they have in Java they have adapters for almost every listener we've done the same thing and we really suggest that you extend the adapter class just to make your code a little more readable so as far as handling system Apple events there are some extra some extra methods available to you in the application listener the application adapter there's the open application event which basically once the UI is finished loading and the open application apple event has been received by the the app you can basically register a call back if there's anything you want to do like pull up the tip of the day or a splash screen or anything like that and new to the Java update that was available as of friday there is a reopening application and this is what happens when you click on the dock like if you have no windows open in safari and you focus safari up to the front by by clicking on its dock icon you'll notice that it brings up a blank window or bbedit does the same thing and text editors the same thing and that's a reopen application event so you can receive that reopen application event and decide to put up your own blank window if you want there's also an open file handler which this is kind of cool this is something that really isn't doable to easily on other platforms you know it'll let you register document types to your application if you have a document based app and you want to be able to double click your documents or drag them over the application icon and have the application lon and open in your app this is this is how you would do that this is your hook into that it's basically a hook into launch services and so there's two parts of it you register the handle open file method you implement that method and then you have to go into the info.plist and register your CF bundle document sites which is there's nothing job at specific about that that's just part of the standard Mac os10 documentation so if you go over to the bundle services documentation find out how to tell launch services what kind of document you want to you want to own and then you're ready to go and there's a print file handler so if you're receiving Apple events from another application or from the finder you highlight it and say print this is another hook in for you to handle that event and maybe print to file from the finder one other call worth mentioning is the get mouse location on screen this is in the application class and this basically let's get the coordinates of the mouse anywhere on screen why is that so special well you could use you know a listener on your window or on your components or anything like that to get the location but that's only going to work while the mouse is above that component while it's in the real estate that that component occupied so this method will let you do it anywhere on the screen even if it's not in Java real estate and some application developers especially in education space tend to want to do that kind of thing so one other thing worth mentioning is the the cocoa component class this is something that I think Scott mentioned in the in the state of the union the other day it basically allows you to embed any custom NS view any cocoa component inside your java application so why do things you know some simple native drawing we have we also have a sample code for the QD cocoa component on our developer website and that's actually what scott demoed to you on Monday using the the eyesight and the sequence grabber from quick time and since it's part of our pure Java API is also available to athletes and java web start and find out more about this you can go to our java native integration talk session 6 20 which is on friday i believe ok thursday ok and one last class the extended IO clef the file manager now this is something that if you're new to the platform or if you're ten only it's probably not very interesting to you this is basically our preservation of Mac OS 9 funk functionality for people who needed it the fine folder methods for things like the Preferences folder constant defined in the mac events headers and the applications folder for example set into set and get file creator and file type stuff old resource stuff that's stuff that you don't need to do on Mac OS 10 if you have legacy stuff from Mac OS 9 if you're trying to bring over and you're still dependent on certain things like that this is the class you want to use and it also gives you a method for opening URLs with the default browser but again that's something that you might not really need to do because on Mac OS 10 you can simply pass open and a URL to the terminal and that will talk to launch services and launch whatever browser you want and to get to that from Java you just pass in those two strings to runtime exec and you're done so now I want to do a little demo to you about a just basically show you about use of the the application menu and the application adapter and listeners so this is my little text editor I'm afraid it's not to feature rich but it gets the job done by creating document here simple text editor low WBC and you can see I don't have spell checking in here so I can save this and you know write it out to the desktop here's my awt file dialog you know it doesn't look like it's switched over to native or anything like that but it does look exactly like a Mac os10 file dialog telling receive it on the desktop is test file and there it is on the desktop and so this is part of what I did with the the info.plist and the handling of the open file application so I can quit out of this application now and I can just double-click the document and it will launch out my job app and open up the document as if it were written in carbon or cocoa very simple and really the way that I do this it's not particularly pleasant unfortunately there's a very there's a very simple but you know hard to get used to document format that you specifying the plist here called C and funds will document types and here I've specified an extension of WWDC I created I provided an icon file so that's why you have a little icon there instead of just some blank document and the type name actually isn't necessary but I put it in there anyway and really that's all it takes you just have to add you just have to register a file a file name extension and put it in this info.plist key and of course on the code side to implement the handle open file and then you're ready to go so as far as the reopen application in the reopen event so I'm going to go over to Safari here and now my text editor is not in the background so I'm going to click on the dock and now the reopen applicaiton the reopen event has been passed through and you can see that a new window came up for me that was what I did by registering for the reopened call back i created a new window and you know I tied it up to the preferences so this is what i did i called set preferences menu item enabled and i did a handle preferences brought up my preferences dialog and I've got the reopen preference set here so if I set that it shouldn't create a new window anymore functional preferences and then there's a there's the about handler up here just create a simple about box and last but not least of course is the quit item now the quit menu item will by default call system exit so it's in your best interest to in to override the handle quit application method in case you have things going on with in case you have unsaved work so if I go over to the quit item you know the handle quit method gets called and I bring up this dialog saying i have unsaved work do I want to quit anyway and if I say yes it'll quit anyway and that's just a quick demo of that you know without those without those methods implemented you can lose a lot of look and feel as far as you know Mac OS 10 applications concern you basically have a function lyst application menu that's up there and your users except thing is to work just like any other application so I just showed you a bunch of apple api's at Apple specific api's and some of you might be saying oh great they're locking us in absolutely not there's no reason for you to be able to do to do this and not be locked and be locked into the platform you don't need to worry about client or runtime properties you can set those and you know if the if another platform is not looking for them it's not looking for them nothing's going to happen as far as use of the api's well very simple the easiest thing to do would be just to isolate all those all those handler methods in a separate class that you register with a simple static method and you know like a like a factory type of method that you simply call from reflection either in your main method or in the in the constructor main class wherever your initialization code is just use class.forname to bring it up and you know basically if it's not there then it won't load but if you load the class statically what happens is you know Java will try to to recognize the application adapter that it's extended you'll get a bunch of class no class that found errors on Windows and you don't want that so if you use reflection to load these up things should be fine and we've got a sample that does this it's called OS 10 adapter and it's on our sample code website so at this point i want to bring set up to talk about runtime properties and deployment options the other half to talk Ted great thanks [Applause] alright so what I'm going to talk to you about are just run time properties that you can set on your application without having to recompile so say you've already deployed on Windows or something like that or solaris Linux what these are properties that you can set that will give you an aqua type functionality but you don't have to rebuild and stuff like that these of course will go into the Java properties key in the info.plist or the Java 141 plugin settings application now you can also pass these in on the command line something like that so if you're doing something like a j2ee stuff or something you know you can pass it in but for the most part we prefer application bundles and stuff like that versus a shell script so one of these is the aqua look and feel the screen menu bar all you have to do is set the Aqua laf use screen menu bar to true and it will actually move the screen menu bar or the menu bar up to the screen level normally and say like a swing application it's actually in the frame itself and with this you can actually get this so what you'd expect on Macintosh the resize control down here in the bottom left hand corner you can see I have this little textured surface thing you know you can drag this to resize it you can add that on again with the property by just setting that true and without having to recompile your application in the course if you want the brushed metal look and feel it's just another setting the property true and again like Matt said these properties are all up on the web and our release notes and then we have a great documentation Mac os10 Java that will point you to at the end that has all these so you don't worry about copying them down so graphics rendering by default when you bring up your application you get the aqua look and feel for free unless you have specified another look and feel and actually when you're doing anti-aliasing you actually get anti-aliasing for your text for free in aqua and we enable it by default if you don't like that you can actually set this property to false Apple awt text anti-aliasing and what that will do for you is then your text will look at you want to other platforms but again you don't have to recompile the top one awt anti-aliasing is also is actually false button by default and now i'm talking about the properties over here and there the substitutes for the graphics rendering him and we would prefer if you actually use the graphic rendering hint instead but if you don't want to recompile and stuff we actually have these properties for you now the next three of them you actually you may want to copy down the the possible values for these because we just noticed that they weren't document anymore so I got these out of the source and they're actually case sensitive too they will be documented though we'll put up a Q&A in the meantime until they actually get up there on the web but as you can see there's a couple more properties that you can set to affect your fractional metrics interpolation and how its rendered I'll be a few seconds if you want to talk to that down and if if you didn't get this copied down come up afterwards and we can actually just give you that so full screen mode you know it's a new feature in 141 and we actually have a few properties that you can use when developing your application and also when you're deploying your application the top to fake full screen or the top one what that does is it will give you a window that's the size of your screen but doesn't actually you know grab the whole screen that's useful and debugging to you know if you want to switch to your blogger and stuff like that it's not you not grab them the whole screen the second one the Apple awt full screen space when we go to the full screen mode if you're changing the resolution we actually do a really nice fade to it and stuff like that if you're not changing the resolution we just go straight to full screen mode but if you want that nice fade set this property to true and we'll do the nice fade for you another one the third one the full screen capture all display what that does is and that one's true by default is when you go into full screen mode if you have multiple monitor we also black out those monitor if they like you want to have full screen on one monitor and then have like a borderless window on another monitor to make it look like you have to full screen windows you'd want to set that to fall and then of course if you want if you're going for a full kiosk mode type application and you don't want the cursor up there at all the last property you can set that to fall and that will take care of that for you again these are all documented up on our website so you don't have to write them down if you don't want it so window positioning we we have a couple of properties that that we have set for the aquas to make things work as people would expect on that mac OS 10 but at times they cause problems with the developers when they're writing their software and so we add these properties so that you can actually change how it work so the four-state creation if that was true what it would do is if you were to create the window off screen you can actually set that to true and it would force it to be on the screen and then the second one for safe programming position that one is true and what that does is try to prevent you from accidentally pushing it off the screen the window now some people actually like to push to create Windows off-screen and push screen windows off-screen so that they can do rendering to it and move it on screen stuff like that if so you might want to set this to to fall and then also to keep the user from moving things off-screen we also have a property for that if you want the user to be able to move things on screen and maybe not be able to get to them you can set that to true so all those properties again now you can set that all those properties without affecting you know recompiling your application so if you bring your application over to Matco is tense and you don't want to recompile that's how you can do it and actually that brings us to our next slide the deployment options so what we're going to talk about is with the athletes use swords we have applet support talk a little bit about that java web start we've had since just one is 131 days and then application bundles this is actually our preferred deployment way on Mac OS 10 we do have double clickable jar support but unless you just have a single jar and you don't have any support files it's I mean it'll it'll definitely work but it's just not the recommended way the icon is not custom it doesn't look like an application stuff like that and of course you have shell scripts what we really discourage that unless you're doing some enterprise deployment or something like that and so I'm not really even going to talk about Safari of course one dido you get full jdk 141 support we have the Java plug-in available for Safari and by default you get the aqua look and feel for free as in all apolis this can be affected in the Java plug-in settings application if you want to if you want to set a default property or something like that you can do that in this a job of plug-in settings application is actually in the application utilities Java folder and you can manage your certificates java console jar caching all that in there and actually we have another session tomorrow that you can go to and stop go into more detail about it he'll show you the job of console and all the cool debugging and stuff like that we now have four Safari and one for one so Java Web Start is well i'll go ahead and explain it it's for application deployment it's it's a way that you can actually deploy an application over the web but what you do is you start with a link on a web page eclipse that your user clicks on that link and then the separate application launches you can actually pull your applications out of the browser of your applets it's really kind of nice if the browser is causing the issues you can just have a separate deployable application another cool thing is that if the user is disconnected from the web is the application setup properly he can steal them or they can still run the application your icon that you set in the jnlp file we actually will use that in the dock when you're running your application and there is also a preference application for the java web start it's also in the application utility Java folder called the java web start and it's just that's what it is and that has a java console just like the applets though you can manager if it gets in there you can also configure when you want to java web start application maybe two or three times what we'll do is we'll actually create one on the desktop for you if that's something that you don't want you can actually disable that in this this application and then you know everything will just work you have to go back to this application to run your java web start applications or click on the link again and again there's more information about this tomorrow and the 619 java in the web to definitely attend that if you want so the next one that we're going to talk about is the application bundle now what this is is like Matt was saying is application bundles on Mac os10 are actually folder and this is actually a one of the folders opened up so that I can get a kind of give you a tour of it in the Java perspective so the first thing on the list is the content folder and pretty much everything goes into that and that's just the root folder within the application bundle the top one info.plist I'm going to come back to that that's actually the one that confuse everything and says where everything is and I'll go into detail about that one the next one down the java application which is in the mac OS folder what that is is actually a native stub that we used to launch the JVM read the properties and the info.plist and stuff like that and get your application up and running if you use jar bundler or Xcode we place that for you we actually have documentation for where you can get that if you want to create your own bundles or something like that next one the package info that's your type of creator on Mac OS 10 it's not java specific but it's something that you'll definitely want to look look into and then underneath that as the resources directory now if you've gone to any of the localization talk for mac OS 10 you'll see that you know if you have these folders in your resources directory what will happen is when you launch your application we actually look at the international settings of your anier system preferences and we kind of go down the list that you have in your system preferences and when we find a match with one that you have in this folder will actually invoke the JVM with that look how that font the the keyboard all set up for you and so you can actually set up your application so that if you have the fonts and you have a dialogues all set up for say Japanese or French or something like that that uncommon a system where they want it to come up in French it'll just happen and i'll just work in very macintosh way down also in that resources folder is the java folder now this is essentially where everything Java related goes of course and this one I only have my jar but you know if you have tools that support your application or files or something like that you also put them in that folder I'm going to show you that in a demo a little bit and show you how you can actually set it so your working directory is that jar java folder the nice thing about it is you just have a single application icon you don't have a bunch of different app icons in a folder and the end user doesn't have to figure out which file to double-click on also when they move things around there just dragging a single application and stuff and so what we encourage you to do is put everything in that folder if you want like see utilities preferences etc and i'll be showing you that again and then of course there's a java application icon what that is if that's the icon for your application lights on the desktop we have a default one that we actually provide for you and i'll be showing you that so this is the info.plist and this is the one I told you I be coming back to so this is the one that actually controls everything for this is it I mean it's it's also system-wide where you can set like your bundle name your icon and stuff like that but inside of there there's actually a Java dictionary and that Java dictionary is useful for setting your your classpath your main class your properties arguments to main stuff like that now there's two I guess short test for macros that we use in there the app package and that is a when you use this within the info.plist within the Java dictionary that is the path to the inside folder of your application package so if the person moves things around on your hard drive you always have a path to it on their hard drive so if they decide they don't want this in the Applications folder they want it in on their desktop or something like that it's not you'll still be able to find everything relative now the job of root what that does that actually points to the Java folder inside the application bundle and so a lot of times what you'll do is you'll use this for on your classpath because you'll use Java route / and then jars for your classpath and then that way it's always pointing to the Java folder and so the working directory is a key that typically the when you double-click your application the either property that your working directory is just inside the application package now it's what you can do is set the working directory to the Java root and that will make it so everything is in the job of foliar like I was telling you earlier and so you complete your support files and stuff like that I'll actually be showing you that in my demo but it I pretty much always set that but we leave you the option so that if you didn't want to set that as your working directory you can set it to something else now the JVM version is the next one this key that's very key it actually you can pick which Java verte vm that you actually want to run the format is the same as java web start and i have a lift up here that kind of shows how things would would work so if you only specify one for one then you would only run on one full one if you won 3-1 same thing only 131 if say you wanted to run in all variations of 14 you can use the one dot 4 star and if you want to run on one dot for 1251 got six on and on you can use the one dot 4 plus now this is something that you're going to have to think about because you know it as job and move forward some things change occasionally things like between 12 and 13 some things need to be set to visible and stuff like that so you want to be careful about what you think what you actually set that too now the reason I have the X is on the 14 1 and the 131 is because say you have the 131 value in there and 132 comes down 131 will no longer be available on your system and if you lock yourself into 131 or say 14 and then when an updated version of Java comes out your application will no longer run so that's why I have those X's on their thing probably don't want these so localization I talked a little bit about this one is describing the application bundle you know in the international panel of your system preferences you can set your preferred locale and the hierarchy and and stuff and then I showed you the El proj folder and the resources now you don't have to actually have anything in those folders all you have to do is create the folder and then we just assume that your application is a capable of handling those double clickable jar just get the default locale for the top one that they have selected in their international preferences and say they have Japanese selected then a double clickable jar will automatically be invoked in the Japanese with a Japanese swamps and keyboard and all that so now the info.plist we used to have a property that we would set for your application name in the upper left-hand corner of the application window or the menu bar but we're actually recommending now that you just use the scandal standard info.plist bundles CF bundle name and if that value is set will actually grab that value the cool thing about using the CF bundle name is its localizable so you can have your English name of your application up in the menu bar on an English system and then you can have the french or german one on the other systems and so it all just looks like what you they expect it to also if you use the local ICF bundle names their names will actually change on the desktop to reflect that the same thing so the name in the menu bar matches what's on the desktop so Xcode they haven't been focusing on Java bet they will for the future bills at X and but it still works great for developing and deploying applications for mac OS 10 I use a lot and it's got the gdb and JTB integrate into it or a variation of the JDB and so you can develop native code and Java code in the same application we actually have quite a few samples on a developer website that show that if they you want to debug java and native code at the same time what people typically do is they'll use the gdb jdb the Java debugger in in Xcode and then gdb from the command line and so that you can attach the processes you can actually be step into your native code and then when you could cross the jni bridge step through the Java code also of course Xcode has the graphical interface 4gb and JTB so that's really nice i mean i have used the command line version but this is much easier than trying to remember things you if you have jars that you want to include in your application you can either have them included in the application bundle within that Java folder or you can actually have it merged the jars in so you can have just one giant jar in your application folder and of course Xcode is available for deploying applications applets jars you can do well just pretty much anything with it you can do java web start but we don't actually have like a template for doing web start stuff but of course he can do any java our native code so jar bundler I don't have many lines on it but it's actually a great tool and I'm going to give you a demo about it this is our application builder this is the one that was telling you about if you didn't want to recompile your stuff this is the application that you'd want to be used to package up your application one of the things that we have done is if there's a developer that we're very interested in bringing to our platform if their applications written in pure java we'll invite them over for a meeting and will download their windows application or their linux version of their application copy all the jars over to Matco 10 use jar bundler to package it up and then when we're meeting with them to discuss them bringing their application to Mac os10 we actually show so I'm running on it it's quite influential when you do that so like I said it's a quick port solution so let's go over to the demo machine and I'll actually show you a version of that so this is robo code I don't off the web it's actually a pretty cool application that after WWDC I'm gonna actually learn to use and write some tanks for but as you can see this folder is how on most platforms that applications are deployed you know and for some people it's not exactly clear that you know if you double-click this jar you know this is how you launch the application so as you see it is coming up we we picked the name of the domain class for the application name but none of these properties are set for aqua you get the aqua look and feel but you don't get the screen menu bar and stuff like that with a jar you know so let me actually show you how we can package this up and make an application that somebody would expect on Mac OS 10 and then we can also add the properties and stuff like that to move the screen menu bar and do well I'll show you all that so this is jar bundler this is in the developer tools for the 141 update and what you can do is say alright we know that the main class is in the is in the robotoid jar so let's just go ahead and select that jar it actually picks the the main class for me I think it reads it out at the manifest and then if not it'll actually search through there and there's actually it's searched through and found a couple of other means that we'll just go with the real one there's arguments the main that you want to pass in you can set these in here we of course we want the screen menu bar simple checkbox but this what this is doing is it's actually setting that property for you that I talked about earlier to use the screen menu bar and then this is the jvm version for this one I'm fully expecting it to work with 15 16 and beyond so I'm going to leave it with 14 plus again if you want to restrict it to this one for dot X he's the 14 * so this sets up the classpath and that and as you can see is I have the Java route the robotoid jar that's how will be defined in the info.plist if there's properties that you want to add say like if you want to add say the brushed metal or something like that you can add it in by using this button right here we just set the key value and stuff like that so the CF bundle name that's what I was talking to you about it's a localizable property that for the application name we'll just call this robo code I'm going to set the working directory to inside the application package so it's actually inside the jar folder and then if you want to set the heap size that the maximum heap size these are all strings for the info.plist that are Mac specific for your type and creator and think stuff so and as you saw I'm not using the about menu name property anymore we're actually recommending people use the bundle name instead so let's go ahead and create this application on a desktop Robo ok let's actually put it on the desktop and this is going to create an out the double clickable application package for you now this package is something that you could just put on a CD or something like that and they can just drag install to the Applications folder air everything again is relative to the application package so wherever they put it it doesn't matter now what I'm going to do is copy this these the rest of these files and support files into the application bundle and using the pop-up you select show package contents contents resources and Java and let's just grab this all I'll just replace that same jar that I actually already copied over so now if I had actually written the robotoid application I would probably know which of these files actually need and which I don't but since I didn't write it I just threw everything in there and it's not an issue but if you're deploying your application you know you'd want of course not to throw in extra stuff because it's just more to download and stuff like that so now you can see without actually recompiling their application I now have the screen menu bar up there and you know we have the about robocode this was a default about box that created for you I didn't set the I didn't recompile it so I didn't add like a preferences and you or something like that so let's go ahead and actually just go ahead and run this thing and you'll see why I want to play around with this afterwards and then I heard that there was a way yeah go ahead and start this out let's kind of remind me of the old core war game except it's much more graphical basically write applications or little tanks that go around and shoot each other and stuff like that now I'm running on top of that the 102 developer update and you can see that graphics performance is getting much better i'm a colo stone so if you're having any problems with the graphics performance i definitely recommend downloading that update from connectable calm and try it out so that's the end of the demo let's go back to slides so where's this documentation that we have been telling me about so that you don't have to write things down if you go to our ADC home connecta alpha calm you can actually download the documentation from there you can also if you go developer.apple.com flash java i try and keep all the the web page up to date with the latest documentation that our text pub people put out but if for some reason I fall behind click on the documentation link and you'll have all their stuff including the history for the previous releases there's a great faq that Matt maintains and this will save a lot of people time if they just read this it a lot of the questions are asked on java dev list they've already been answered on there I'd recommend looking at before really doing any development at all other resources enterprise Java and Mac OS 10 this is the course on the developer apple com / Java page but there's also that the direct link to where the file is the ADC developer site developer apple com so I stralla that's one like I maintain try and keep up to date for you and then just a Java developer documentation just go to developer apple com click on the documentation and then they'll be a link to the java stuff so what next later we have the desktop and server migration to Mac os10 job and native integration on Mac os10 deploying on xserve and the feedback form you have issues questions stuff like that bring it to the feedback form we definitely want to hear all your comments at the ad platform through the contact if you have more questions stuff like that if you have business questions you're running into issues you know you go ahead and send something to Alan Samuel Bob Fraser they'll hook you up with the right people probably with a mat and I we actually we have the page I've been repeating about the developer apple com flash Java page that's where like if any new updates are posted or something like that we announce it on that page and then this is an invaluable tool to develop our mailing list at list I'll calm the java dev mailing list I keep an archive of every single email on that list and working in DTF it's actually kind of funny we'll get a bunch question a little get questions that in that people have answered on that list before and so rather than waiting for us to answer the question if people just search the archive or kept in archives most of the questions are actually answered on there when that happens we just usually send the answer back to the people and I'm don't charge
