java

Swing Large Files Performance

Hello, We need to load and display large files (rich text) using swing, about 50mb. The problem is that the performance to render the files is incredibly poor. We tried both JTextPane and JEditorPane with no luck. Does someone have experience with this and could give me some advise ? thanks, ...

How can I make my development workflow more "enterprisey"?

I'm the sole developer for an academic consortium headquartered at a university in the northeast. All of my development work involves internal tools, mostly in Java, so nothing that is released to the public. Right now, I feel like my development workflow is very "hobbyist" and is nothing like you would see at an experienced software dev...

How to know which URLs are mapped in the current servlet context in a Spring 2.0 Controller method?

In Spring 2.0, is there a quick way to have a list of the current servlet context's mapped URLs from inside a Controller method? I'm writing a method called getMappedUrls(), and the purpose of this method is to show what urls are mapped in the current servlet context. This method is to be used to generate an small online doc of availab...

What does the 'static' keyword do in Java?

To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it gave an error like 'Cannot access non-static field in static method main'. So I changed the declaration of clock to this: static Clock clock ...

Variable naming conventions in Java?

In PHP, we (at least the good programmers) always start general variable names with a lower-case letter, but class variables/objects with an upper-case letter to distinguish them. In the same way we start general file names with a lower case letter, but files containing Classes with an upper case letter. E.g: <?php $number=123; $string...

Is there a good Java networking libary?

Hi folks! I'm currently searching for a Java networking library. What I want to do is sending XML, JSON or other serialized messages from a client to another client and/or client to server. My first attempt was to create an POJO for each message, plus a MessageWriter for sending and a MessageReader for receiving it. Plus socket and err...

Are Apache Ant Javadocs Included in the Eclipse Plugin?

I was trying to add Ant libraries to a project in eclipse, and I used the ones that were part of eclipse's plugins folder. When I tried to associate them with Javadocs, I couldn't locate them in the plugin folder. I searched for them online, and I found this page, in which they say the docs are not provided online because they are part o...

Java keyboard input parsing in a console app

I've just started messing around with JLine to parse character input in console mode. It seems to work well, but I'm wondering: Is there a nonblocking way in JLine to find out if characters are available? (i.e. like kbhit() in Windows.) I suppose I could always wrap keyboard input in its own thread which then offers the keyboard charac...

Synchronizing eclipse save action rules

My team has a fairly rich set of formatting rules and save actions and these rules are evolving. We're looking for a mechanism to define the centrally and propagate them automatically. We don't want to reformat the code base, but we expect the formatting to improve incrementally over time. We're using Subversion for source control, thoug...

Error Dialog Not Being Destroyed

I am working on a project that is using a JTable to display, among other things, a column of dates. We needed validation for the user input for dates, so I have implemented a combination of masking for format validation and parsing for actual date validation. I have done this using a custom CellEditor for the date column. Inside my Mask...

Is it possible to use a primitive type (int) in as a generic type in Java?

Specifically, with a SortedMap<Vector<String>, int> I get "dimensions expected after this (int) token." Help! ...

Is there a CRUD generator utility in Java(any framework) like Scaffolding in Rails?

Is there a CRUD generator utility in Java like Scaffolding in Rails? Can be in any framework or even plain servlets. Must generate controllers + views in jsp, not just DAO code... ...

Any way to further optimize Java reflective method invocation ?

I am wondering if there are any additional optimizations I can implement to improve the speed of reflective invocations in Java. Not that the performance is prohibitive, but I get the willies when thinking about some piece of code in a library I am writing being implemented in a tight loop somewhere. Consider a utility method to invoke ...

How to build your own lexical analyzer for StringTemplate?

Hmm, sounds easy enough but after looking at the ones that come with StringTemplate, there is no way this is easy for me the average developer. Where does one start? From doing some more digging it seems to accomplish this one would also have to learn the ANTLR tool to create the language file? Is that correct? Or can I just copy one t...

The Google Maps Wikipedia Layer

Is there a way to programmatically list all geo-tagged Wikipedia entries within a radius of a long/lat point? I'm thinking this is possible with the google maps API but I am interested in any method. NOTE: I do not want to display a googlemap. ...

JMenus caused JOGL GLCanvas canvas to flicker

Clicking through JMenu options is causing my JOGL GLCanvas to flicker. The JMenu has the setDefaultLightWeightPopupEnabled set to false. I don't want to use JGLPanel because it runs slower (the application needs to run in full screen mode). Interesting, the flicker stops if I set sun.java2d.opengl=true on the command line. However,...

Strange behavior of Java's TreeMap put() method

I have the following code, which splits up a Vector into a string vector (to use as a key) and an integer at the end (to use as value). payoffs.put(new Vector<String>(keyAndOutput.subList(0, keyAndOutput.size() - 1)), Integer.parseInt(keyAndOutput.lastElement())); The TreeMap in question is constructed using a Comparator with the foll...

Quick, Petty Java Question: Parenthesis around SQLException

try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... } What does surrounding sqle with parenthesis do? Anything? Just curious. ...

How do you make a unit test when the results vary?

I am building an application that queries a web service. The data in the database varies and changes over time. How do I build a unit test for this type of application? The web service sends back xml or a no search results html page. I cannot really change the web service. My application basically queries the web service using HTTPU...

How do I make Tomcat stop caching my servlet responses?

I'm learning Servlets programming, using Apache Tomcat 6 on a Ubuntu 8.10 machine, and I'm running with a very annoying issue -- apparently, related to caching. This is what I'm doing: I write a servlet, put it in a nice directory structure and deploy it using the Tomcat Web Application Manager. It works as expected. Then I edit the ser...