|
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 |
# ¿ Mar 6, 2008 01:59 |
|
|
# ¿ Apr 27, 2024 12:15 |
|
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.
|
# ¿ Apr 17, 2008 22:49 |
|
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.
|
# ¿ Apr 18, 2008 01:22 |
|
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.
|
# ¿ Apr 20, 2008 22:48 |