一段简单程序, frame.add(lbl);出现 问题。 也不知道为什么就是这里, 而我Ctrl + Shift + T 确实也是没有发现 JComponent 。

public void displayImage(String title, Image img, int x, int y)
{
ImageIcon icon=new ImageIcon(img);
JFrame frame=new JFrame(title);
JLabel lbl=new JLabel(icon);
frame.add(lbl);// ERROR
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocation(x, y);
frame.setVisible(true);
}

奇了怪了!我猜是jdk版本的问题,但是为什么呢? 难道不能用jdk8 ? 可是项目的其他代码都是依赖jdk8 的?

网上查看半天没有找到解决方案! stackoverflow 也没有! 郁闷! 后面偶然发现这个 :

http://blogs.candoerz.com/question/155925/java-swing-component-cannot-be-resolved.aspx

我大概明白了,应该还是jdk8 在myeclipse10 的不兼容的问题。 具体来说是我的 myeclipse10 的java compliation level 只能是 7, 所以。。。

换成 ideaj, 问题解决! 又是 jdk8 在myeclipse 的不兼容的问题啊!

The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files的更多相关文章

  1. eclipse中java文件报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class fi ...

  2. The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files

    最近在做J2ME开发项目,配置环境一切OK,但是打开项目时某些文件提示: The type java.lang.String cannot be resolved. It is indirectly ...

  3. 部署hibernate框架项目时出现问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.

    基本情况: (这些其实关系不大)我是直接impor导入HibernateDemo项目到eclipse中的,该项目的hibernate版本是3.6.7.Final版,使用了Hibernate Tools ...

  4. The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    The type java.lang.Object cannot be resolved.It is indirectly referenced from required .class files ...

  5. 问题1-The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files

    问题一:The type java.lang.String cannot be resolved. It is indirectly referenced from required .class f ...

  6. The type java.lang.AutoCloseable cannot be resolved. It is indirectly referenced from required .class files

    出现问题: The type java.lang.AutoCloseable cannot be resolved. It is indirectly referenced from required ...

  7. The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.

    参照 http://stackoverflow.com/questions/24301986/the-type-java-lang-charsequence-cannot-be-resolved-in ...

  8. java报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    看包的路径是否对对:比如这样不对(...src/object/obietc) 其它解决方法转载: https://www.cnblogs.com/yadongliang/p/5918228.html ...

  9. 当你在web项目下新建一个class时package位置如果发生红色波浪错误,提示为”The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files“

    问题是这样的如下图: 问题的原因: 1.配置tomcat7.0的时候自己设置了jre的版本1.8,而没有用myeclipse10自带的jre1.6,导致了出现了差错!

随机推荐

  1. SCOPE_IDENTITY的用法【转载】

    SCOPE_IDENTITY   和   @@IDENTITY   的作用都是取得返回在当前会话中的任何表内所生成的最后一个标识值,简单的说就是在执行一条插入语句之后使用@@IDENTITY的全局变量 ...

  2. 模拟a标签click,弹出新页面

    $("<a>").attr("href", url).attr("target", "_blank")[0] ...

  3. 浏览器唤起APP的功能

    http://blog.html5funny.com/2015/06/19/open-app-from-mobile-web-browser-or-webview/ http://panli.mu.g ...

  4. java高并发编程(三)

    java高并发主要有三块知识点: synchronizer:同步器,在多个线程之间互相之间怎么进行通讯,同步等: 同步容器:jdk提供了同步性的容器,比如concurrentMap,concurren ...

  5. 学习笔记之TensorFlow

    TensorFlow https://www.tensorflow.org/ An open source machine learning framework for everyone Tensor ...

  6. undefined reference to `__isnan'

    sjs@sjs-virtual-machine:~/work/Onvif$ arm-hisiv100nptl-linux-gcc *.c -lpthread -static -o ../../nfsm ...

  7. postgresql小纪

    本来是想在PaaS环境中定位PG数据库的问题,却发现给每个PG实例,就是每个库,分配的密码是加密的,还不能直接查看密码. 登录PG数据库对应的容器,发现使用默认的用户postgres没有密码也可以正常 ...

  8. 使用IDEA进行Lua代码调试、自动提示、代码跳转、智能重命名

    试了几个Lua IDE后,Lua Studio.Lua Glider.VS+babelua插件.Sublime都不是特别满意.直到发现了国人自创的另一个神奇工具:基于IDEA的EmmyLua插件.该插 ...

  9. version control(关于版本控制)

    版本控制(Version Control Systems)是一种记录一个或若干文件内容变化,以便将来查阅特定版本修订情况的系统.  这个系统可以自动帮我们备份文件的每一次更改,并且可以非常方便的恢复到 ...

  10. 如何优雅地等待所有的goroutine退出

    转自:https://www.cnblogs.com/cobbliu/p/4461866.html goroutine和channel是Go语言非常棒的特色,它们提供了一种非常轻便易用的并发能力.但是 ...