Posts

Showing posts from February, 2012

Resizable JOptionPane Code Snippet

//1 great tip to make JOptionPane resizable //put HierarchyListener on the component that will be used as the message for the JOptionPane myPanel.addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { //when the hierarchy changes get the ancestor for the message Window window = SwingUtilities.getWindowAncestor(myPanel); //check to see if the ancestor is an instance of Dialog and isn't resizable if (window instanceof Dialog) { Dialog dialog = (Dialog)window; if (!dialog.isResizable()) { //set resizable to true dialog.setResizable(true); } } } });

Extjs4 First Look Review

A really great resource when migrating to Extjs4, and to anyone new to Extjs in general this would be a great place to start. As a pre-release reviewer of this book I can tell you there's stuff in there at the time of reading wasn't readily available on the web. I recommend this when developing in Extjs4 for newbies as it compact a lot of highly useful information into one place. Get Extjs4 First Look on Amazon

ExtJs Portal Example: adding different sized columns

In the examples section for ExtJs4 there's a portal example. The portal panel where all the content can be shown is made up of a column layout, each column is divide with equal distance. I wanted to change this so I could have one really wide column, and the rest of the space would be diveded up equally between the remaining columns. So using the examples from the ExtJs4 package on my localhost, in the 'portal' directory I changed the HTML file so the classes.js link was commented out and that the script on the same page now includes the line Ext.Loader.setConfig({enabled:true}); This means that it will run the code in the individual files. Then by opening up PortalPanel.js and change the beforeLayout as follows I was able to specify one really large column and which column I want that one to be; // Set columnWidth, and set first and last column classes to allow exact CSS targeting. beforeLayout: function() { var items = this.layout.getLayoutItems(), len = i