java-7

Change background color editable JComboBox

一笑奈何 提交于 2019-12-17 16:31:12
问题 I am programming an editable combobox in a JFrame Form, but i want to change te background color. How the program works: If i click the button "press", then the combobox his background needs to become black. I tried: 1. cbo.setBackground(Color.BLACK); But it did nothing 2 cbo.getEditor().getEditorComponent().setBackground(Color.BLACK); ((JTextField) cbo.getEditor().getEditorComponent()).setOpaque(true); Does this: Code example: public class NewJFrame extends javax.swing.JFrame { private

Properly installing java 8 along with java 7

蹲街弑〆低调 提交于 2019-12-17 15:27:08
问题 I've JDK 1.7 installed on my windows 7 machine and after installing JDK 1.8 u20 I'm having following error: C:\>java -version Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.8', but '1.7' is required. Error: could not find java.dll Error: Could not find Java SE Runtime Environment. My PATH variable points to the older version (i.e. 1.7). What is wrong here and how I could use java 8 along with java 7? 回答1: The problem is that Java 8 installs a lot

Strange text wrapping with styled text in JTextPane with Java 7

一笑奈何 提交于 2019-12-17 10:55:19
问题 I have two different editors using JTextPane with strange bugs in Java 7 that did not occur with the previous JVM versions. It happens with long lines containing styled text or components. Here is an example demonstrating this bug. In this example, the default style is applied for all the text each time a character is inserted. I tested it with the JDK 1.7.0_04. import java.awt.BorderLayout; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; public class BugWrapJava7

java.security.cert.CertificateException: Certificates does not conform to algorithm constraints

跟風遠走 提交于 2019-12-17 07:17:17
问题 I have a mapping application that can add ArcGIS 9.3+ base maps given a URL. One of the URLs that I would like to add is from a customer's URL and is secured. My mapping application was using Java 6 before and was able to add the secure URL with no issues. I now upgraded to Java 7 and am getting a "java.security.cert.CertificateException: Certificates does not conform to algorithm constraints" exception. At first, I believe this to be the case because in Java 7, by default, the MD2 algorithm

intern() behaving differently in Java 6 and Java 7

回眸只為那壹抹淺笑 提交于 2019-12-17 07:10:13
问题 class Test { public static void main(String...args) { String s1 = "Good"; s1 = s1 + "morning"; System.out.println(s1.intern()); String s2 = "Goodmorning"; if (s1 == s2) { System.out.println("both are equal"); } } } This code produces different outputs in Java 6 and Java 7. In Java 6 the s1==s2 condition returns false and in Java 7 the s1==s2 returns true . Why? Why does this program produces different output in Java 6 and Java 7? 回答1: It seems that JDK7 process intern in a different way as

Support for Compressed Strings being Dropped in HotSpot JVM?

岁酱吖の 提交于 2019-12-17 07:09:32
问题 On this Oracle page Java HotSpot VM Options, it lists -XX:+UseCompressedStrings as being available and on by default. However in Java 6 update 29, it is off by default and in Java 7 update 2 it reports a warning Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseCompressedStrings; support was removed in 7.0 Does anyone know the thinking behind removing this option? sorting lines of an enormous file.txt in java With -mx2g , this example took 4.541 seconds with the option on and 5

Compiler error : reference to call ambiguous

梦想的初衷 提交于 2019-12-17 06:47:14
问题 Case 1 static void call(Integer i) { System.out.println("hi" + i); } static void call(int i) { System.out.println("hello" + i); } public static void main(String... args) { call(10); } Output of Case 1 : hello10 Case 2 static void call(Integer... i) { System.out.println("hi" + i); } static void call(int... i) { System.out.println("hello" + i); } public static void main(String... args) { call(10); } Shows compilation error reference to call ambiguous . But, I was unable to understand. Why ? But

What is the difference between PermGen and Metaspace?

ⅰ亾dé卋堺 提交于 2019-12-17 06:23:19
问题 Until Java 7 there was an area in JVM memory called PermGen , where JVM used to keep its classes. In Java 8 it was removed and replaced by area called Metaspace . What are the most important differences between PermGen and Metaspace? The only difference I know is that java.lang.OutOfMemoryError: PermGen space can no longer be thrown and the VM parameter MaxPermSize is ignored. 回答1: The main difference from a user perspective - which I think the previous answer does not stress enough - is that

Installed Java 7 on Mac OS X but Terminal is still using version 6

微笑、不失礼 提交于 2019-12-17 02:26:55
问题 I've installed JDK 7u7 downloaded from oracle's website. But after installation, the terminal is still showing java version 6 $java -version java version "1.6.0_35" Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode) any idea why java 7 is not showing up? Ans: OK, the problem has been resolved. Here is the answer: I found that my Terminal has a .bash_profile and the java home variable is set to 1.6 export JAVA

Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0) [duplicate]

北慕城南 提交于 2019-12-16 22:23:15
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: unsupported major .minor version 51.0 I installed JDK7, a simple hello word program gets compile but when I run this I got following exception. Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown