Diego Pedrosa

Greenhorn
+ Follow
since Nov 09, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Diego Pedrosa

Ok, I confirmed that the problem persists... I can only type 1 time each number including the dot.

Example: i can put this 46375.12098, but it won't let me do this: 11.00

I think I'll try with a regular old fashioned, "a la VB", filter... :-(
16 years ago
Thanks guys... I'll try that as soon as I go back to program the GUI (now i got some change requests on the model, like "start over" jaja).
Ernest: my impression is that I won't be able to input more than 1 copy of each number... that's my actual problem... I'll let you know (as I gotta try it).

Anyway... THANKS again both.
[ November 21, 2007: Message edited by: Diego Pedrosa ]
16 years ago
That's exactly what I'm doing, the problem is that I'm using regexp in the inserString() method...



Mabye I could use a simple string filter="0123456789." with the filter.contains(str) method and let in if true... ...though the regexp is more elegant IMHO...
[ November 14, 2007: Message edited by: Diego Pedrosa ]
16 years ago
Hi,

I think you can solve this issue with the 'LIMIT' SQL keyword.
Read this: Paging in SQL
Hello all,

I've been fighting with this problem for a couple of days...

I have some text fields that can only accept number (actually doubles, so "0-9 && ".") to later do some calculations.

What I did try:
-- Using the KeyPressed event (a la VB) to skip anything out of the pattern show above, result: couldn't null the keycode/keychar nor consume the key pressed

-- Using FormattedTextField, but i dont need an input "mask", and it was VERY clumsy (there are easier ways) to implement a filter.

-- Using Patterns as suggested in the "Code Barn" (thanks guys for putting it there), it is almost what i need... now i can't find a regex that works... I looked at Regular Expression Library but when i run the app the fields won't let me enter the dot, or more than 1 copy of a given number.

Does someone has any idea on how to do this? 'couse my brain has already gone down the sink...

Thanks
16 years ago
Hello Steven:

First I would like to note that you have a couple of design problems (too much repeated code, and not following OO principles).

Here is your code with some design corrections (to avoid you MAYOR headaches in the future maintenance), and some notes on what you could do to get the squares moving...




Notes about the Square classes... you had duplicated code for every method of each class (RedSquare and GreenSquare) that is calling for maintenance nightmare in the short run (specially if you'r going to put more squares or other shapes in the app, so I rewrote the code to give you an idea of how you can organize your objects... Notice that i have put every getter/setter (that are common to all Squares) in the Square class, you can improve it further adding a property to the Square class named 'color' and asign it a value in the constructor of the object type you are creating... There are probably hundreds of different ways to do it, so here's mine.

Answering your question, check the comments in the 'mouseEvent' pieces of code.

Hope this helps...
Diego
[ November 11, 2007: Message edited by: Diego Pedrosa ]
16 years ago
if you don't specify a package, the .class files will end up in either the same dir as the source (.java) files or in the dir you specified in javac -d option.

example:
using the default package, and the source code is in /java/src
when you compile it with 'javac MyApp.java' the class file will go to /java src (having MyApp.java and MyApp.class in the /java/src dir)

if you compile this with 'javac -d /java/class' the .class file will go to /java/class (now MyApp.java is in /java/src and MyApp.class is in /java/class)

now if you use a package, say 'package javaranch;':
your .class files will end up in a dir named javaranch (that will be either under /java/src or java/class based upon the '-d' compiler option used)
[ November 09, 2007: Message edited by: CoderX ]
16 years ago
Hello everybody..

I'm looking for a free reporting tool, that I can possibly use in NetBeans (not required), and that doesn't need a database to get data from (I have the data in the app).

I have seen RReport (commercial), JFreeReport (now Pentaho reporting, requires DB) and JasperReport (requires DB).

Thanks.