Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
GameCube
Nov 21, 2006

Ugh, I feel like a retard asking this here, as it seems like a question for Google, but either this is more complicated than I expected or Google's just being stupid.

I've got an assignment to write a simple paint program using a Swing panel, where you left-click and drag to paint and right-click and drag to erase. I got the left-click just fine with a MouseDragged event, but now I can't figure out how to do something different for a right-button drag. Once I figure out how to check for the right button in the first place, I should be able to throw some if statements around stuff and get the rest on my own. Any advice?

EDIT: Never mind, got it! Was busy messing with some bitwise crap I found on this page, when right above that was an easy set of boolean methods to use. http://www.leepoint.net/notes-java/GUI-lowlevel/mouse/20mousebuttons.html

GameCube fucked around with this message at 02:27 on Mar 6, 2008

Adbot
ADBOT LOVES YOU

GameCube
Nov 21, 2006

Popping in not for Java coding help, but NetBeans: Anybody know how to set the contents of a JComboBox from an array or list? There's a box to type your "pre-generation code," but I really don't know what to put there, and it's surprisingly hard to find clear instructions online.

GameCube
Nov 21, 2006

ShinAli posted:

Like every other Java Swing component, you'd have to jump through hoops and set up a model for ComboBox. Luckily, there is a default model that'll just take in an array of Strings in the constructor. Declaring or using an DefaultComboBoxModel object in the custom code text box should make it work.

Thanks. While waiting for this answer, I was screwing around with some other part of my project, and just happened to glance at some auto-generated code that helped me figure that out for myself, but having the full answer here helps, too. Now I've graduated to trying to make a table model for a JDBC connection. Fun stuff. :suicide:

GameCube
Nov 21, 2006

Anybody here know a good guide to using Derby/JavaDB? I've been following instructions to the t, yet I still can't connect to my friggin' database.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply