From: Brett L. <wak...@ea...> - 2005-03-07 23:05:03
|
>>I haven't investigated the feasibility of this, and its a few years since >I >>last dabbled in Swing, but I recall that layout managers can be nested, >and >>though complex, GridBagLayout is a *very* powerful layout manager. >> >>Given that the stock chart itself is basically just a collection of >square, >>numeric fields, would it not be possible to use a JTextField for each >"box" >>and control the layout with nested layout mangers. Switching on borders= to >>get the grid effect is relatively simple. > >Yes, this is the right thing to do. If you regarc a hexagonal gird as a >rectangular >one with alternate rows (or columns, depending on the grain direction) >offset by >half a cell, you can do that too. You can use a JPanel for cell, and then >drop >JLabels in for things like the price, and even for the tokens. You should >be >able >to set borders and background colours without too much difficulty. I've been playing around with this a bit. It looks like you guys are right. >I haven't looked at the Graphics-2D API yet, I've produced sufficient with >Swing >for what I've done to date. My original 18xx map rendering was done with >AWT >rendering, since I wrote it pre-Swing: you can see it on my home page: >http://www.cosgor.demon.co.uk . <aside>The 1998 (c) refers to the last >modification, >which was the water symbol rendering, the original Java code was late 1996 >or early 1997 (and the original C code even older than that).</aside> > >ISTR some of this code is not how I would write it now, but I should be >able to dig up the source for the applet if it's of interest. Reusing existing code is always a good thing. I doubt it would take much= work to update your old code to work with some of the newer (faster) objects in Swing and= Graphics2D. Once we get the stockmarket functional, let's definitely take a look at= using some of your existing code, Iain. ---Brett. |