Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Play & Game Design / ActionListeners for an array of JComboBoxes... on: 2005-04-22 21:50:15
Hi,

In my program, each user has a JComboBox. However, the number of users varies depending on how many users are specified at the start of the game.

As a result I decided to make an array of JComboBoxes:
private JComboBox[] characterBox;

Then, later I specify the size of the JComboBox:
characterBox=new JComboBox[size];

I have no problem creating the JComboBoxes or adding them to the JPanel.

The problem occurs when I try to make actionlisteners. The following code is in a for loop that runs the number of users in the game.

characterBox
  • .addActionListener(
         
                        new ActionListener()
                        {
                                 public void actionPerformed( ActionEvent event )
                               {
                                              
                                         String picNum = (String)characterBox
  • .getSelectedItem();
                                         
                        
                                }
                             }
                         );//END Listener

    The problem is that the compiler tells me x must be final. However I can't have it final because I am looping the creating of the Listeners. I know the actionlistener code works but I can't figure out how to create all of the listeners in a for loop. Any thoughts? Thanks.
2  Game Development / Newbie & Debugging Questions / Re: JScrollPane Question... on: 2005-04-18 14:41:02
Is there a way to directly control a JScrollPane? So if you want the pane to automatically show the bottom right is there a way to set the scroll to 80%x and 80%y?
3  Game Development / Newbie & Debugging Questions / Re: JScrollPane Question... on: 2005-04-13 14:11:41
Thanks for the tip. That is actually what I am trying to do, but the problem is that i can't figure out how to implement it. I know hod to do set up listeners for the keyboard, but I can't fiugre out how to manipulate the scrollbar positions.
4  Game Development / Newbie & Debugging Questions / JScrollPane Question... on: 2005-04-12 18:06:45
Is there a way to use the Keyboard to scroll a JScrollPane? I can't figure out what the JScrollPane scroll methods are so that I can re-define them.

Thanks for any help.
5  Game Development / Newbie & Debugging Questions / Re: Background Image question... on: 2005-03-21 13:13:36
I figured it out...

I was trying to add the MenuBar and was also setting it. Getting rid of the 'add' fixed the problem.
6  Game Development / Newbie & Debugging Questions / Re: Background Image question... on: 2005-03-20 18:34:51
Hmmm... that is basically what I have too (although I have my MenuBar as an extended class.

Maybe I do have something extra.

Do you think having JPanels with a setbounds (a,b,c,d) would make a difference?

I'll try it...
7  Game Development / Newbie & Debugging Questions / Re: Background Image question... on: 2005-03-20 17:50:22
Thanks for the tip.

I actually have another question too...

Is it possible to have the JFrame be set as
setUndecorated(true)

while also having a JMenuBar with JMenu's?

I tried putting it on, but there is a wierd effect where a white box appears above teh JMenuBar?

Any ideas?
8  Game Development / Newbie & Debugging Questions / Background Image question... on: 2005-03-20 00:01:34
Hi,

I am creating a program where I need a background image to be scrolled.

I have a class that extends JFrame and in that class, I have several JPanels.

For one of the JPanels, I want a background picture. However, the JPanel will be a smaller size than the picture and I want the user to be able to scroll over to the right or left and view the rest of the image.

Also, I am not doing any animation in this program.

Any suggestions would be greatly appreciated.
9  Game Development / Newbie & Debugging Questions / JFrames and Resolution... on: 2005-03-02 16:37:02
Hi. I am creating a basic board game with JFrames and I have a few questions...

First, I want to set the resolution to 800x600 which I did with a setsize(800, 600). However, if I drag the window, everything gets messed up. Is there a way to solve this?

Also, I thought that one way to solve it might be to change the monitor resolution in the game. Does Java have a easy way of doing this? Thanks!
10  Java Game APIs & Engines / Java 2D / Project Design... on: 2005-02-17 16:13:04
I have decided to create a Monopoly type game in JAVA. I am thinking of using JAVA just because the graphics are easy to implement. My questions are for graphics:

Are JFrames the way to go?
If so, is there a way to get fullscreen resolution?
Would you suggest Animation?

Thanks for any suggestions.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (32 views)
2014-07-18 06:55:21

Zero Volt (28 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (25 views)
2014-07-16 23:30:00

Cero (40 views)
2014-07-16 00:42:17

Riven (42 views)
2014-07-14 18:02:53

OpenGLShaders (29 views)
2014-07-14 16:23:47

Riven (29 views)
2014-07-14 11:51:35

quew8 (27 views)
2014-07-13 13:57:52

SHC (63 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!