As it says in the title, I have a Java app that runs on Windows (using SWT). How can the java app detect if the machine has touch screen capability?
The purpose is to present different UI elements if touch screen is available.
Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.
All entries tagged java.
You can subscribe to an RSS feed of this list.
As it says in the title, I have a Java app that runs on Windows (using SWT). How can the java app detect if the machine has touch screen capability?
The purpose is to present different UI elements if touch screen is available.
I have two inputs:
Using Java, how can I convert the given date value into the corresponding date/time in the local timezone? There doesn’t seem to be any timezone offset function in the Date class.
Thanks!
I have an existing AWT Java desktop application. Is there a library or something I can use to have it respond to multitouch gestures (in Windows 7/8)? I see there’s frameworks like MT4J or JavaFX that have multitouch support, but it seems these are separate UI frameworks that I can’t use with my existing app?
I have a working Java SWING-based desktop application, and I’m being asked if it can be run on the Microsoft Surface Pro or Pro 2. As I understand it, these are using stock Windows 8/8.1 and will be able to run any Windows app normally, is this correct?
Are there any caveats or special considerations when running my app on these devices?
Edit: If it matters, the JRE would be distributed together with the application, so installing Java isnt an issue.
I want to write a servlet that wraps around a set of resources and needs to protect them with basic HTTP auth; the submitted username/pass will be checked against the backend database before serving the file.
Does anyone have any working examples of this? I tried the sample at http://www.coderanch.com/t/352345/Servlets/java/HTTP-basic-authentication-Web-Applications but it kept returning an IllegalStateException
in the sendError
call.
I’m being asked to assess whether we can safely upgrade the java version on one of our production-deployed webapps. The codebase is fairly large and we want to avoid having to regression test everything (no automated tests sadly), but we’ve already encountered at least one problem during some manual testing (XmlStringReader.getLocalName now throws an IllegalStateExeption when it just used to return null) and higher-ups are pretty nervous about the upgrade.
The current suggested approach is to do a source compare of the JDK sources for each version and assess those changes to see which ones might have impact, but it seems there’s a lot of changes to go through (and as mentioned the codebase is kinda large). Is it safe and easier to just review the java version changes for each version? Or is there an easier way to conduct this assessment?
Edit: I forgot to mention the version upgrade being considered is a minor version upgrade, i.e. 1.6.10 to 1.6.33
I’m trying to get a sense of what are the most commonly-used Java web frameworks, with a focus on large, enterprisey projects. I’m interested in which one is most favored by companies/enterprises (which may not be the same as the one most favored by developers or the open source community I guess). I’d also like to be able to cite specific projects used by each framework, preferably big-ticket or well-known ones.
Anyone have any idea about this stuff or can point me in the right direction?
Thanks!
How are you redirecting to the login page? At that point you should store the originally requested URL somewhere (can be in session, or request param that you pass around) such that you can redirect back there after he logs in again
“rowtype” here is an Oracle PL/SQL-specific type, I don’t think it would be supported by JDBC. A quick search of the oracle forums (google “jdbc rowtype site:oracle.com”) suggests the same. You’re probably better off returning a cursor, or just execute the SQL from JDBC directly.
ClassB extends from ClassA which also extends from Object. Therefore ClassB extends Object indirectly, through classA
“Every class extends class Object” just means if you don’t specify the parent class, it takes on Object as the parent class
Not sure how clojure is run, but don’t you just add the jar file to the classpath?
i.e.
/usr/share/java:/home/user/myjarfile.jar
I know the oci driver can perform transparent failover of the database, but does the thin driver have the same capability?
You can assign it a value that is specific to the object instance, which you can’t do with a static class variable.
I’m looking into screen sharing functionality - i.e. allowing remote users to view your desktop in real time, possibly control it and write annotations (text/drawings) on the shared screen. Something similar to what webex allows in its conferencing software. Preferably a Java-based api, possibly to run from an applet.
Any recommendations on a library/api to use?
I would just choose a far-future date as the value for the constant NEVER. Then to check for deletion/expiry, just compare against NEVER.
We’ve always used the BouncyCastle library, I’m being asked if there are other viable alternatives, either open source or not. Or is the BouncyCastle library already the best one to use?
I have an applet that is crashing Firefox on Linux.
Can anyone tell me how I can enable the java core dump log file for this applet and where the file would be generated?
The contents of WEB-INF aren’t publicly accessible resources, why are you putting the other jsps there? Are those other jsps accessible?
If you want to hide the index.jsp, create a servlet mapped to the root path and have it forward to index.jsp.
While testing our setup for user acceptance testing, we got some reports that java applets in our web application would occasionally fail to load. The envt where it was reported was WinXP/IE6, and there were no errors found in the java console.
Obviously we’d like to avoid it. What sort of things should we be checking for here? On our local servers, everything seems fine. There’s some turnaround time when sending questions to the on-site guy, so I’d look to cover as many possible causes as possible.
Some more info: We have multiple applets, in the instance that they fail loading, all of them fail loading. The applet jar files vary in size from 2MB to 8MB. I’m told it seems more likely to happen if the applet isn’t cached yet, i.e. if they’ve been able to load the applets once on a given machine, further runs on that machine go smoothly. I’m wondering if there’s some sort of network transfer error when downloading the applets, but I don’t know how to verify that.
Any advise is welcome!
We have an Applet that can possibly display Chinese text. We are specifying a font for it (Arial), it works fine under both Windows and Mac OSX.
But in Firefox on Linux the Chinese characters are rendered as squares. Is there a way to work around this? Note that we can’t assume the existence of a particular font file on the client.
I have an applet that calls a JDialog that contains a JProgressBar component. I subclass the JDialog to expose a method to update the JProgressBar, something like:
public class ProgressDialog extends javax.swing.JDialog {
public void setProgress(double progress) {
jProgressBar1.setValue(jProgressBar1.getMinimum() + (int) (progress * jProgressBar1.getMaximum()));
}
...
}
I use this dialog in the following manner:
public void test() throws Exception {
progressDialog = new ProgressDialog(null, true);
try {
progressDialog.setLocationRelativeTo(null);
// show the dialog
EventQueue.invokeLater(new Runnable() {
public void run() {
progressDialog.setVisible(true);
}
});
// business logic code that calls progressDialog.setProgress along the way
doStuff();
} finally {
progressDialog.setVisible(false);
progressDialog.dispose();
}
}
It works fine on Windows/any browser. However, when invoking the above function on Firefox 2/3/3.5 on a Mac, the progressDialog is displayed indefinitely, i.e. it doesn’t close.
I suspected that calling setVisible(true) inside the EventQueue was causing the problem, since it’s a blocking call and might block the queue completely, so I tried changing it to:
// show the dialog
new Thread() {
public void run() {
progressDialog.setVisible(true);
}
}.start();
With this change, the progressDialog now closes correctly, but a new problem emerged - the contents of the dialog (which included the progressbar, an icon and a JLabel used to show a message string) were no longer shown inside the dialog. It was still a problem only on Mac Firefox.
Any ideas? I realize it’s probably some AWT threading issue, but I’ve been at this for a couple of days and can’t find a good solution. Wrapping the doStuff() business logic in a separate new Thread seems to work, but it’s not easy to refactor the actual business logic code into a separate thread, so I’m hoping there’s a simpler solution.
The envt is: Mac OSX 10.5 Java 1.5 Firefox 2/3/3.5
Web framework for Java
Have your app create a temp file on startup and periodically check if it still exists. Your batch script can just delete that file to terminate the app.
I have a CRUD maintenance screen with a custom rich text editor control (FCKEditor actually) and the program extracts the formatted text as HTML from the control for saving to the database. However, part of our standards is that leading and trailing whitespace needs to be stripped from the content before saving, so I have to remove extraneous and <br> and such from the beginning and end of the HTML string.
I can opt to either do it on the client side (using Javascript) or on the server side (using Java) Is there an easy way to do this, using regular expressions or something? I’m not sure how complex it needs to be, I need to be able to remove stuff like:
<p><br /> </p>
yet retain it if there’s any kind of meaningful text in between. (Above snippet is from actual HTML data saved by the tester)
Let’s say I have a Java webapp deployed on some Application Server with clustering across a few nodes.
In the webapp, we maintain a cache of some values retrieved from the database, stored in-memory as static variables. Whenever a user performs an update in a particular screen, we clear the cache so that the cached values will be retrieved again the next time they are needed.
Now the problem: Since each node in the cluster is running on a separate JVM, how can I clear the cache across all nodes? Basically I want to call a static function on each cluster node. Is there some standard J2EE way to do this, or it depends on the Application Server software?
Yes, that would be useful. Especially if you have a mechanism where the error message (exception.getMessage()
) is displayed on-screen but the actual stacktrace gets hidden away in log files which you can’t access immediately.
Java game engine
Lightweight open-source java web framework
Browser-based webapp test suite
java resources for developers