Jump to content

  • Log In with Google      Sign In   
  • Create Account

Angex

Member Since 16 May 2004
Offline Last Active Jun 08 2014 03:29 AM

Posts I've Made

In Topic: JTextField Overrides KeyListener

12 April 2014 - 02:42 AM

If you only want to know when the enter key is pressed, you can use an action listener instead.

There is a good exmaple in the Oracle documentation.

 

In a nut-shell it's:

final JTextField textField = new JTextField(20);

textField.addActionListener(

  new ActionListener() {

    @Override
    public void actionPerformed(final ActionEvent evt) {

      // Enter pressed.
    }
  
  }
);

If you do need to capture other key strokes, consider using a DocumentListener.

KeyListeners can be troublesome when the registered component doesn't have focus.


In Topic: Problem setting up GLSurfaceView.Renderer

09 September 2013 - 01:31 PM

I can't see anything wrong with your OpenGL setup.

I even tried running your sample code on my phone, and it works okay.

 

Do you get any runtime errors?

Does the device support OpenGl ES 2? Maybe try ES 1 and see if it works.

 

Are you using any other threads? It's possible the flow of execution is stuck some where else in the code.


In Topic: validating JTextField data from result set

05 May 2013 - 01:18 PM

In the validateLog() method, the prepared statement only has 2 placeholders, but you're supplying data to indices 2 & 3.

 

The index for placeholders starts from 1 smile.png


In Topic: error trying to setup slick2d with eclipse

10 January 2013 - 02:24 PM

Are you using 64bit version of Eclipse & Java VM?

 

It looks like Slick2D is trying to load 32bit native dll's.

 

LWJGL does provide 64bit builds; but you will probably need to modify your Slick2D build to load them.


In Topic: method undefined by arraylist

25 August 2012 - 01:50 PM

You can use "List.get(...)", to return the element at a given index in the ArrayList.

[source lang="java"] for(int i = 0; i < BRICKS.size(); i++) { BRICKS.get(i).paintBrick(g); }[/source]

Generic collections can also take advantage of the For-Each loop.

E.g.
[source lang="java"] for (final Brick b : BRICKS) { b.paintBrick(g); }[/source]

PARTNERS