Remove Swing Component Using Validate or Revalidate
Whenever I remove and add swing components from say JPanel, shall I perform call on validate or revalidate? ...
Whenever I remove and add swing components from say JPanel, shall I perform call on validate or revalidate? ...
Why String.indexOf do not use exception but return -1 when substring not found? The purpose of this question is: when we start custom exception. I believe avoid the need to return special error code is right design path. What's your opinion? ...
Hi, I have been messing around with recursion today. Often a programming technique that is not used enough. So.. I set myself the task to recursively reverse a string, heres what I came up with : //A method to reverse a string using recursion public String reverseString(String s){ char c = s.charAt(s.length()-1); if...
For people suggesting throwing an exception: Throwing an exception doesn't give me a compile-time error, it gives me a runtime error. I know I can throw an exception, I'd rather die during compilation than during runtime. First-off, I am using eclipse 3.4. I have a data model that has a mode property that is an Enum. enum Mode {on(......
Hi I have a 3rd party JAR file that is compiled using Java 1.4. Is there a tool that can make the jar file compatible with Java 1.6? (Something like 'retrotranslator' but what does the reverse of it). I tried decompiling the class files and re compile them in 1.6 but it fails. Here is the issue: My project uses 'rsadapter.jar' for wa...
How can I determine the address in memory of the Java heap for a JVM running in the current process? That is, get a void* pointer or equivalent to the contiguous area of memory that the JVM has allocated for the heap, using Java, C, or other calls? Matlab has a JVM embedded in its process. The memory the JVM allocates is unavailable for...
I've written this java servlet which inserts items into a table however it fails. I think it might be due to my insertion and deleting which got me in trouble some how. The java servlet runs an insert statement into sql server. In my error log, it says: com.microsoft.sqlserver.jdbc.sqlserverexception: cannot insert duplicate key row ...
May I know how can I determine whether a component is found in JPanel? boolean isThisComponentFoundInJPanel(Component c) { Component[] components = jPanel.getComponents(); for (Component component : components) { if (c== component) { return true; } } return false; } Using loop is not efficient...
I have an application the requests a media stream from a server, however the request needs to include a cookie or else the server returns a 500 error. MediaPlayer does not have the functionality to send a cookie along with a URI request. My way around this is to have Android proxy the requests. I'll have the MediaPlayer make a request t...
Hi I'm developing a swing app which suits the MVC pattern and I'm wondering about the best place to store settings such as width/height, xml files location... Should those settings be avaiable also only through the Model? Should I use a global static class? A singleton? Thanks in advance ...
Does the US Federal Government have a coding style guide for C# and or Java? If there isn't, I think there should be given the amount of time they put into the Federal Enterprise Architecture and Document Standards. ...
I have jdk1.6.0_13 installed, but when I try to find a javax.servlet package, or press ctrl+space in Eclipse after Servlet I cannot get anything. Where can I download this package, and why isn't it included in standard distribution for developers? ...
The situation is as follows: page.jsp?var[0]=foo&var[1]=bar How can this be retrieved in an array in Java? The following: page.jsp?var=foo&var=bar I know can be retrieved using request.getParameterValues("var") Any solutions for the above though? ...
I've found a sample for a sorted JList, but my application is powered by an embedded H2 database so I'm wondering if there isn't a better way to implement this with that in mind. Especially considering the table in question could become enormously large, and duplicating all that data in a JList's list model seems to kinda defeat the poi...
I'm looking for an Open Source Project for delivering a course trainings and to manage courses, instructors. I need something similar to Moodle but in Java. Thanks ...
I'm attempting to compile Java 1.4 code that was created by IBM's WSDL2Java on Java5 without recreating the stubs and saw this error in Eclipse. I'm under the assumption that the stubs created should just compile as long as the runtime jars are available (they are). Access restriction: The type QName is not accessible due to restriction...
In benchmarking some Java code on a Solaris SPARC box, I noticed that the first time I call the benchmarked function it runs EXTREMELY slowly (10x difference): First | 1 | 25295.979 ms Second | 1 | 2256.990 ms Third | 1 | 2250.575 ms Why is this? I suspect the JIT compiler, is there any wa...
How would I go about creating an HTTP Proxy in Java for use recording and playing back HTTP Sessions? This would be for entirely legitimate performance monitoring purposes. Are there any classes in the standard JDK or does anyone know of any examples that are available? Thanks. ...
I'm looking for the best way to run a java app as a Windows Server 2003 service. What are my options, and what's the basic general process for going about doing this? Thanks much. ...
After some experience with functional languages, I'm starting to use recursion more in Java - But the language seems to have a relatively shallow call stack of about 1000. Is there a way to make the call stack bigger? Like can I make functions that are millions of calls deep, like in Erlang? I'm noticing this more and more when I do Pr...