Tic Tac Toe
December 22, 2005 on 12:42 am | In Swing | No CommentsI’ve been working on a simple Tic Tac Toe game. Most things going well, but I’ve been working on the painting of the X’s and O’s within the insets of a given JButton. In the end, the calculation that actually centered it drove me crazy: I had to use 2 * the width of paint stroke.
Anyway, I’m looking for a cleaner way to draw the X and O Icon within a JButton. Here’s the current image; it currently resizes well, but there’s gotta be another way. Any suggestions? Thanks in advance. Here’s the paint code:
public void paintIcon(Component c, Graphics g, int x, int y) {
if (!CLEAR_SQUARE.equals(type)) {
int strokeWidth = calcStrokeWidth(getWidth(), getHeight());
int strokeWidthX2 = strokeWidth * 2;
Insets insets = getInsets();
int width = getWidth() - strokeWidthX2 - insets.left - insets.right;
int height = getHeight() - strokeWidthX2 - insets.top - insets.bottom;
int left = insets.left + strokeWidth;
int right = left + width;
int top = insets.top + strokeWidth;
int bottom = top + height;
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(getStroke(strokeWidth));
g2.setColor(getForeground());
g2.setBackground(getBackground());
if (X_SQUARE.equals(type)) {
g2.drawLine(left, top, right, bottom);
g2.drawLine(left, bottom, right, top);
} else if (O_SQUARE.equals(type)) {
g2.drawOval(left, top, width, height);
}
}
}
Apprentice
December 17, 2005 on 4:06 pm | In General | 13 CommentsI’ve seen a few posts saying either that Donald Trump choose the wrong apprentice. These posts have a hint of something other than logic and reason.
If you just went off of productivity, he was the better choice. Let’s take for granted that he is more educated. However, let’s not overlook his experience. He put it exactly right when he said he “runs businesses, while she just writes about themâ€. Randall is the CEO and founder of BCT Partners (bctpartners.com) a successful small business.
As project manager, Randall won 3 out of 3 tasks. On the other hand, Rebecca has only won 1 out of 3 tasks as a PM. In addition, her one winning task had a good deal to do with Randall being her only teammate.
Also, loyalty is a great thing, but she showed throughout that she would allow it to possibly sabotage her (even bringing Toral back at the end).
In the same vein, I have never seen so many fired contestants praise one person so much. Not to mention, when there was a chance to trade a teammate, time and again, teams always choose Randall.
So, exactly why was Randall the wrong choice?
Lastly, in response to Randall not agreeing to their being a second apprentice: why should he have? In a past season, there was a “close†race between Bill and Kwame (guess who’s the black guy). Kwame was from Goldman Sachs, and had a Harvard MBA. Bill was an entrepreneur who started cigarsaroundtheworld.com. Most people thought it was a tight one, but Kwame had the credentials to take it all the way. Obviously, Trump felt differently. Oh well, it’s seems to have worked out because Trump has extended Bill’s contract. So, why was Randall selfish?
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^

