Wednesday 3 March 2010

MatPolygonDraw: LF More Responsibility, Better Name.

So, naming scheme aside, my "MatPolygonDraw" function is quite a capable function. It defines the vector of colors used to determine the fill color of the polygon in question, it draws the labels for each point, the bounds of the full shape, and the lines connecting each point to the maximum value for that point. In achieving these goals, it takes an input string, checks it for validity, determines its numerical value, converts the numerical value combined with its string position to work out the variable the value applies to and then determine X,Y coordinates of where that point is.

I'm sure it does more, but, meh, I'm still working on it so there's no need to keep explaining it. I updated it today to contain a nested class entitled matButton, a subclass of the JButton. Now, rather than creating a new JButton and assigning it an actionListener to make everything work as it should, the frame that hosts the MatPolygonDraw instance simply calls the getButton class, passes any pertinent information over, and receives a new JButton appropriately configured for the task.

Tomorrow will see the expansion of this concept. Rather than just the the JButton, I'll include the JTextField component and place both of them on a panel. This way I'll just call getInputPane or whatever I decide to name it and I'll receive both of these, properly configured. I'll do the same to create a getEditPane for manipulating the material's properties, and any other panes I may need to accomplish any task I can imagine that requires a material graphic interpretation.

Then I just make the structure for any other objects that need manipulation, I go ahead and follow the same process for getting the necessary interfaces, and voila, simple finished product.

In other words, I think I'm getting this, because suddenly I'm realizing just how little  work I'll have to put into the final assembly of everything compared to the creation of the manipulating classes.

In all, I'm content. It's time for bed though, and that leaves this post open for discussion. Any recommendations for a better name for this class? Preferably something that defines what it does, very concisely. Best name gets immortalized in my code! And... a cyber cookie?

P.S: I'm going to stop going ridiculously overboard on the tags for my posts. They're all about computing, no need to continue labelling that.

No comments: