java-7

MethodHandle - What is it all about?

谁说胖子不能爱 提交于 2019-11-28 04:38:48
I am studying new features of JDK 1.7 and I just can't get it what MethodHandle is designed for? I understand (direct) invocation of the static method (and use of Core Reflection API that is straightforward in this case). I understand also (direct) invocation of the virtual method (non-static, non-final) (and use of Core Reflection API that requires going through Class's hierarchy obj.getClass().getSuperclass() ). Invocation of non-virtual method can be treated as special case of the former one. Yes, I aware that there is an issue with overloading. If you want to invoke method you have to

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

有些话、适合烂在心里 提交于 2019-11-28 04:15:43
问题 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 ""; }

Using transparent window in both Java 6 and Java 7

两盒软妹~` 提交于 2019-11-28 04:07:34
问题 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

Encoding issues on Java 7 file names in OS X

落花浮王杯 提交于 2019-11-28 04:00:17
问题 I have the following code: public static void main( String[] args ) { System.out.println(Locale.getDefault()); File f = new File("/Users/johngoering/Documents"); File[] fs = f.listFiles(); for (File ff : fs) { System.out.println(ff.getName()); System.out.println(ff.exists()); } } In my Documents folder I have a file called "öß.pdf". Here is the output under Java 6: en_US (...) öß.pdf true (...) But here is the output under Java 7: en_US (...) o����.pdf false (...) Note especially that file

How to use java.nio.file package in android? [duplicate]

a 夏天 提交于 2019-11-28 03:34:43
问题 This question already has an answer here: Android import java.nio.file.Files; cannot be resolved 3 answers 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! 回答1: Originally : the simple answer

Using Java 7 SDK features in Java 6

社会主义新天地 提交于 2019-11-28 03:33:45
问题 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

Android Studio 'tools.jar' file is not present in classpath

此生再无相见时 提交于 2019-11-28 03:19:47
I downloaded the current version of Android Studio (latest as of 4th July 2013) I also downloaded the JDK version 7u25. However, it displays error after startup: Please ensure JAVA_HOME points to JDK rather than JRE. I don't know how to solve this problem, which won't let me run the IDE. I would appreciate any help. Francois Check if java JDK is installed correctly dpkg --list | grep -i jdk if not install JDK sudo add-apt-repository ppa:webupd8team/java sudo apt-get update && sudo apt-get install oracle-jdk7-installer After the installation you have enable the jdk update-alternatives --display

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

浪子不回头ぞ 提交于 2019-11-28 02:30:58
问题 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

best example for programmatically creating SplashScreen with text

蓝咒 提交于 2019-11-28 02:14:28
I need to create a SplashScreen programmatically and add text to it (and change it). Most examples work with thecommand line parameters. Are there solutions working without? Guillaume Polet You can use an undecorated dialog with a background image and a progress bar while loading stuffs in a SwingWorker . When done, hide the dialog and start the UI as usual. Components added to the dialog/splashcreen must be non-opaque in order to "see" the background image. Here is a working example: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Frame; import java.net

Jackson unable to load JDK7 types on Android

蹲街弑〆低调 提交于 2019-11-28 00:40:04
问题 I use Jackson 2.8.2 in my Android app to deserialize JSON. The deserialization itself works, however, I can see the following warning in the application log: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added Proguard is disabled, sourceCompatibility is set to '1.7' . How can I add these seemingly missing types to my build? 回答1: First, your sourceCompatibility setting of 1.7 doesn't mean anything about the runtime environment, so it has no impact on this