Jump to content

Recommended Posts

Posted

Hi all. I'm working on a little simulation-like game, basically an excel spreadsheet on steroids that relies on player interaction and creativity for the fun bits. Ignoring whether or not the game itself would be fun, I've come across a couple of questions. If you need more information, feel free to either ask for it here or check out the pertinent posts on my blog to see if you can see where I'm going.

 

First question is about JButtons. I have a series of buttons, standard "add one," "fill," "subtract one," and "empty" buttons. They're to be labeled simply with "+", "+ +", "-", and "- -" respectively. The problem is it seems that the JButton is set to have a default requirement for distance-from-edge for the text. In other words, it looks like it needs 15 pixels from the edge to the start of the string, 10 pixels per character, and another 15 pixels from the end of the string to the last edge. If it doesn't have this minimum, Java has been truncating my string down to "..." for whatever reason, despite the fact that I'm almost certain "+" is shorter than "..." physically. I've worked these numbers out on the premise that the minimum size for a properly displayed add-one button is 40 pixels, and the fill button (with the space between the plus signs) must be 60 pixels.

 

I'm trying to get it down to have both of the buttons simply be little squares with these strings in them. Is there no way to change these defaults? I'm thinking the only method is to make a custom graphic for the button, which I'll do eventually but it takes a while for me because I'm good at coding, not graphics ;)

 

Second question is about databases. I'm planning on hooking this up, via JDO, to a database structure. I've found a convenient e-book, available for free online here, that is really helping me to understand what I need to do on my end, and everything tells me there's not much that needs to be done to set up the database for it. But I have the problem that everything assumes I understand the basics of Java database connectivity and setup. While I have researched a good deal of MySQL back before I settled on JDO, and know some of this, I would like a nice guide for the initial setup of a JDO-compatible database, if you've got any suggestions. Thanks!

 

Thanks for any and all help, in advance!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.