Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Brian Batson

+ Follow
since Jun 15, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brian Batson

Thanks, Paul. In your experience, is the switch from Swing to servlets and JSP an enormous undertaking, or does an understanding of core Java concepts lend itself to a fairly quick and easy transition?

Also, do you think servlets/JSP is the best web application framework, or do you prefer a different framework?
8 years ago
Thanks, Kemal. I am now downloading the full version of NetBeans to take advantage of the GUI builder that you mentioned. Also checking out OSGi.
8 years ago
Hello all,

I have been teaching myself Java for about a year now, and I am happy with what I've been able to accomplish thus far, but I feel like I've plateaued, and I want to get to the next level. I can make very good Swing applications using object-oriented concepts, and I use JDBC extensively to interact with well-designed underlying databases.

I use Eclipse Indigo as my IDE. For my Swing applications, I hard code all of the panels and tabs and such using the various layouts, which can get time consuming, but it works. I am looking to do two things:

1) Increase the speed of which I am able to deploy applications. I want to stick with Java, but when I see other developers using .NET and simply dragging and dropping objects from a toolbox Visual Studio, I get pretty envious of how easy that approach seems. Does anyone have any tips on this front?

2) I want to take my applications online. I've written a lot of clean code for my Swing applications, but my users are always asking for new features and such, and I have to create a new .jar file each time for deployment. I know this is not the best route to go for deployment. I would love to have the code on some type of server so that I can make the change and, once tested, have it effective immediately in their application. What are my first steps for shifting into an environment like this one?

Many thanks for any input you can provide.

8 years ago

I have created a view on SQL Server 2008, which I am accessing through ODBC in my Java code. The view has around 20 columns, and around 6,000 records. It runs in under a second within SQL Server.

However, when I loop through the ResultSet to populate a DefaultTableModel, which feeds a JTable, it is horribly slow. It actually takes about 8 to 12 seconds just to return 100 records or so, which renders the application just about useless.

I tried the approach outlined here: , but it actually seemed to run even slower.

My approach/pseudo code right now is:

I think this is a pretty standard approach, right? Or hopefully I am doing something very wrong to cause a 1-second view to take more than 10 minutes to load into a JTable? I'm pretty stuck. Any advice/guidance is very much appreciated.


That's what I thought, too, but the book suggests otherwise. I'm not sure what a "stand-alone" class really is or how it would be useful.
8 years ago
I am reading a book preparing for the SCJP exam and it mentions that a programmer should strive for loose coupling but in practice classes will have some degree of coupling to actually be a functioning program. This makes sense. However, the chapter is cryptically concluded by the statement that "Of course, some classes, such as String and Math, are stand-alone classes and have no coupling to other classes." This makes no sense to me. If I use these classes in my class, aren't they coupled to that class? Does anyone have any thoughts on this?

8 years ago
Awesome, thanks, Rob. Somehow I missed SpringLayout in my initial cursory review of available layouts. The SpringForm mentioned about 3/4 down the following webpage addresses my needs completely:

Thanks, again.

8 years ago

I am using a GridLayout to display a variety of information. It's working just fine but I really wish I could set the width of the columns (like a JTable) for the columns within the GridLayout.

See the attached screen shot for a sample (assume the JLabels are different from the first and second columns).

As you can see, the GridLayout evenly spaces the columns, although I would prefer for the columns holding the JLabels to be much smaller than the size for the columns holding the JTextFields.

Any guidance that you can provide is very much appreciated.
8 years ago

Madhan Sundararajan Devaki wrote:On observing the query, I guess, MS Access is treating the JOIN operation as an Aggregation functionality.

Thanks for the reply, Madhan. What makes you suspect that one of the JOIN operations is being treated as an aggregation functionality?

For what it's worth, I was able to get around this by simply embedding a SELECT * from the query object itself but this obviously isn't ideal (selecting all records from a query feels quite redundant).
Hey! I am struggling with a SQL statement that I have embedded in my Java code. This is the first time I've ever had problems with a SQL statement that works fine in Microsoft Access but does not compile in Java. A screen shot of my SQL is attached. It's pretty long, that's for sure, but not too complex.

The error I get is: "You tried to execute a query that does not include the specified expression 'ID' as part of an aggregate function." This is confusing because, as you can see in the SQL statement, this is not an aggregate statement. There's no grouping of any kind.

Any ideas? Like I said, works just fine in Access, but generates the above error in Java.

Thank you for any help you can provide.

Has anyone ever used the Desktop.mail(URI) method to generate an e-mail and successfully used HTML within the e-mail body?

I know this is possible using the JavaMail API, but I'm running into problems with that given my firm's implementation of heavy security around Microsoft Exchange.

Right now this is my simple code:

However, the body of the e-mail actually shows the HTML tags and does not format the text as intended. I feel like I'm missing something obvious. As a side note, I really wish attachments were possible using the Desktop.mail(URI) method.

Any guidance is appreciated very much.

Thank you,
9 years ago