java-7

Spurious calls to setValueAt with JTables in Java 7 on OS X Lion?

只愿长相守 提交于 2019-11-29 10:45:54
After upgrading to Lion, and Java 7, I am running into issues with JTables. When I use arrow keys to move the selection around, its calling setValueAt() with empty strings as the edit value. To test this, I created a simple JFrame with a table in it, and set the following class as its model. public class SpyModel extends AbstractTableModel { public int getColumnCount() { return 5; } public int getRowCount() { return 5; } public Object getValueAt(int rowIndex, int columnIndex) { return ""; } public boolean isCellEditable(int rowIndex, int columnIndex) { return true; } public void setValueAt

Using transparent window in both Java 6 and Java 7

只愿长相守 提交于 2019-11-29 10:39:09
I'm developing application in Java 6 (1.6.0_24) which using transparent JFrame to get disappearing animation. Here is my code: public static void slowDisappearWindowAction(Window source, int milisSlow, int milisFast) throws InterruptedException{ float level = 1.0f; //slow effect -> 50% for(int i=0; i<8 ; i++){ level=level-0.05f; AWTUtilities.setWindowOpacity(source,level); Thread.sleep(milisSlow); } //fast effect -> 0% for(int i=0; i<8 ; i++){ level=level-0.05f; AWTUtilities.setWindowOpacity(source,level); Thread.sleep(milisFast); } AWTUtilities.setWindowOpacity(source,0.1f); } It works fine

How to use java.nio.file package in android?

人盡茶涼 提交于 2019-11-29 10:36:28
I want to create a file manager application for Android using java.nio.file API which is the part of JDK7. I think this (java.noi.file)API contains easy solutions to design file manager application where JDK6(IO) and apache commons IO API does not have the same facility. Please give some solution, how I use the JDK7 (IO) in android application. Thanks! The simple answer is that you can't do it. Android is Java 6 based, and (AFAIK) there is no backport of Java 7's java.nio.file classes to Android. (That's not surprising. Porting java.nio.file would entail significant changes to the Davlik VM's

Java 7 JColorChooser: Disable Transparency Slider

天涯浪子 提交于 2019-11-29 10:31:28
JDK 7 added a new transparency slider to the JColorChooser : The problem is that I do not want to allow my users to pick transparent colors. Unfortunately, there doesn't seem to be an easy way to disable the slider. One way to get rid of the transparency is to just create a new color based on the selected one but removing the alpha value. However, this gives a false impression to the user as the slider now effectively does nothing and I would hate to have a useless UI element around. So my question is, what's the best way to get rid of the transparency slider? P.S.: IMO, it's weird that they

Using Java 7 SDK features in Java 6

為{幸葍}努か 提交于 2019-11-29 09:53:15
I am interested in using some of the NIO2 features in the Java 7 SDK if available (specifically, the file system watchers ), however I do not want to compile my classes for Java 7 and exclude Java 6 runtimes. Mostly because I want retain compatibility with Mac OS X, and also because I don’t want to force my users to upgrade. Is this possible? What is the best way to do it? Any links or examples? Here are some ways I can imagine: compiling a class file with a different compiler and loading it dynamically based on the Java version? Or maybe using reflection? Or maybe there’s just a compiler

Android Studio: what compiler settings when including Google Maps

瘦欲@ 提交于 2019-11-29 09:19:56
I created a new project in Android Studio and added a Google Maps activity. I get these warnings: warning: com/google/android/gms/maps/GoogleMap.class(com/google/android/gms/maps:GoogleMap.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. warning: com/google/android/gms/maps/SupportMapFragment.class(com/google/android/gms/maps:SupportMapFragment.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. warning:

Java 7 Date/Time API [closed]

倾然丶 夕夏残阳落幕 提交于 2019-11-29 09:11:11
I notice that a snapshot of the Java 7 API has been up on java.sun.com for some time, but I only just had a look through it just now, looking specifically for the promised JodaTime-inspired Date/Time API. Alas, I can find no mention of it in the published docs. Is this because it simply hasn't been done yet, and this published API is an early, incomplete snapshot, or because the idea has been quietly dropped? Alex Miller is running a very informative website about jdk7 features . JSR 310 is still not confirmed according to this page . Last I heard, JSR 310 was running behind and might not get

Java 7 zip file system provider doesn't seem to accept spaces in URI

两盒软妹~` 提交于 2019-11-29 09:08:48
I have been testing all possible variations and permutations, but I can't seem to construct a FileSystemProvider with the zip/jar scheme for a path (URI) that contains spaces. There is a very simplistic test case available at Oracle Docs . I took the liberty of modifying the example and just adding spaces to the URI, and it stops working. Snippet below: import java.util.*; import java.net.URI; import java.nio.file.*; public class Test { public static void main(String [] args) throws Throwable { Map<String, String> env = new HashMap<>(); env.put("create", "true"); URI uri = new URI("jar:file:/c

Slow Java2D bilinear interpolation in Java 7 on Mac OS X

拟墨画扇 提交于 2019-11-29 08:12:58
I've been testing my app in Java 7 on Mac OS X. It's running noticeable sluggish. I used VisualVM to try and track down where the bottleneck was and found linear interpolation to be the culprit: g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); To some degree this makes sense of course. Using interpolation will slow things down. But I do not see this kind of dramatic difference between using and not using interpolation in Java 6 on OS X. In Java 6, the difference was almost negligible. (The images below represent the VisualVM profile of

Circular Progress Bar for Java Swing not working

倾然丶 夕夏残阳落幕 提交于 2019-11-29 07:37:30
i've discovered this test project from Oracle site because i want to add a circular progress bar in my project. I'm developing the application with Netbeans, and when i start the application, the JPanel where the circle should be.... disappaer. I've removed all the code that is not useful to solve this problem and i've got this code: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import javax.swing.*; import javax.swing.plaf.LayerUI; public class Loading_Test extends javax.swing.JFrame { static final