Ben Wood

Ranch Hand
+ Follow
since Aug 14, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Wood

Hello,

I am interested to know what is the best equivalent to the JavaRanch in the .NET world? I need some info from the Dark Side

thanks,
Ben
13 years ago
I have used this one before, works quite well, I think it is Open...

http://sourceforge.net/projects/jazzy/

I haven't used the API on this for a while so I don't remember if it provides any search/indexing stuff.

If not, I think you will need to find a way of indexing all of the entries in the dictionary using some form of tree structure perhaps, so that for a given sequence of letters you can quickly drill down through the dictionary entries to focus on possible matches, rather than brute-force searching all dictionary entries until you find a match.

http://en.wikipedia.org/wiki/Tree_data_structure

13 years ago
Craig,

I think at least to begin with you should create your GUI code 'by hand', without special tools, otherwise you could get confused. Building reasonable GUIs in Swing by hand is really not too difficult and you will soon get the hang of it....maybe then you can move to a GUI tool if that's your preference.

I work a lot with Swing and also the Java2D graphics API developing fairly complex GUIs and, after several years of doing this, I still prefer to code by hand. Just dig in and build some stuff!
13 years ago
Hi Veronique,

I work a lot with scaling 2D graphics in this way and I often handle the zooming myself, rather than use scaling. What I mean is that I transform the drawing coordinates of the various shapes "manually", rather than scaling the Graphics context.

I generally do this by multiplying or adding to the raw shape coordinates at the time they are drawn. This also enables me to handle panning/dragging as well as zoom.

The reason that I do this is because scaling affects the appearance of the shapes. For example, if you add these two lines to the end of your paintComponent() method:



you will see that the line thickness changes according to the zoom level. Maybe this is not a problem for your application, but for me the lines etc must always be the same thickness on the screen, regardless of the zoom setting.

Ben
13 years ago
Hi Veronique,

I think that sounds like a good solution. As a general comment, in case you do not know about it, if you are doing a lot of work with 2D geometry - testing for distances, intersections, point-on-line etc) - there is quite a lot of functionality in the Java Topology Suite that you might find useful.

http://tsusiatsoftware.net/jts/main.html

cheers,
Ben
13 years ago
Hi,

I am very new to animation in Swing, and I'm having a problem understanding the best way to implement a pause button.

I have implemented a class which extends JPanel and which uses a Timer to do some animation. When the Timer calls actionPerformed(), a call to repaint() is made. In the paintComponent() method I am simply drawing random shapes which change each time, so the whole panel animates.

I have placed an instance of the animated JPanel into a JFrame, alongside a JButton which can be used to pause the animation. The pause button has an ActionListener registered to it - the actionPerformed() method of which will call a pause() method on the animation panel which looks like this:



This works fine...unless the animation is running with a very fast small ms delay. When this happens the pause button will not respond all the time - the faster the animation runs, the less chance you have to actually get the pause button to do anything. Am I correct to presume this is to do with both the animation repainting and the pause action running on the EDT, so the user never gets enough time to actually cause the button's actionPerformed() to be called?

I have read about the concept of the worker thread, which seems like something I might use for the animation so that the pause button will be responsive, but I don't understand how to get a non EDT thread to actually drive the animation - i.e. how can I get another thread to repaint() the panel? Or is there a proper way to do this with the Timer?

Does anyone have any pointers, or links to tutorials which might set me off on the right track please?
13 years ago
I believe Adeel and Frank just gave you some suggestions of possible ways of doing this.

Have you looked into any of these? What about writing the values to a shared database as Adeel suggests?
[ November 25, 2005: Message edited by: Ben Wood ]
18 years ago
By the way, there is a web services forum on the site
18 years ago
You will need to download Axis from that site and then browse the documentation (e.g. the user guide).

Specifically take a look at this section:

http://ws.apache.org/axis/java/user-guide.html#WSDL2JavaBuildingStubsSkeletonsAndDataTypesFromWSDL

which will tell you how to use the wsdl2java tool to generate some Java classes which you can then use in your stand-alone application to call the webservice. It generates these classes for you based on the WSDL of the web service in question, so that you end up with stubs for the object types and associated method calls for that particular web service.
18 years ago
Whoa, how can anyone say that debugging an errant web.xml is trickier than debugging a load of JSP scripts! You have my sympathies, but do try the above suggestion - it might allay their fears when you pull it off.
18 years ago
Sandy,

This one probably belongs in the Servlet forum, but here goes. Yes, if the browser will not accept cookies you will have to fall back to URL rewriting, passing a jsessionid with each URL. Take a look at encodeURL() in HttpResponse
18 years ago
Jim,

Just thought I would add a note about object orientation when learning Java. Make sure you spend as much time getting your head round those concepts as you do figuring out code/syntax. When I was learning I spent the first few months worrying about syntax and writing procedural code and can see now that I didn't put enough effort into learning the OO concepts at that time.

Also, when reading about things OO (encapsulation, interfaces, polymorphism, inheritance) be wary as a lot of resources plug the inheritance side of things when encapsulation and polymorphism are arguably more key concepts.
18 years ago
Prashant,

Take a look at the Apache Axis project http://ws.apache.org/axis/. This will give you the tools for working with web services.

With Axis comes a tool called wsdl2java which will generate the necessary code for communicating with a web service. You simply run it with the URL to the web service as an argument.

You can then use the classes it generates to call methods on the web service.
18 years ago


becomes...

18 years ago
Alex,

Firstly, if you want to make a graph you can use Java2D, I'm sure if you search around you will be able to find a basic tutorial to get you started.

If you want to put data ina table take a look at javax.swing.JTable. You can construct one of those by passing in two arrays for example



where data is a two dimensional array of your data values (like a grid of rows and columns), and columnNames is a 1 dimension array of column names.
18 years ago