java中heavyweight与lightweight的区别
发布网友
发布时间:2022-04-25 08:00
我来回答
共2个回答
热心网友
时间:2023-11-07 21:04
看得懂英文就看英文吧
我就往通俗里说吧。
所谓重量级组件轻量级组件是相对的。
重量级组件就是说要完全依赖于这个组件才能实现 的。
轻量级组件就是说可以脱离此组件,基本不用修改核心代码就能实现的。
比如EJB就是个重量级组件。做成的一个EJB项目,如果要改成SSH做的话,基本就要重新做了。
比如Struts2就是个轻量级组件。要写个struts2的helloworld就写个普通类加配置一下就OK了,将来不用struts2了,那OK,把配置删掉,再写一个类去配置。核心代码基本不用动。
这基本就是其中的区别
热心网友
时间:2023-11-07 21:05
看得懂英文就看英文吧
我就往通俗里说吧。
所谓重量级组件轻量级组件是相对的。
重量级组件就是说要完全依赖于这个组件才能实现 的。
轻量级组件就是说可以脱离此组件,基本不用修改核心代码就能实现的。
比如EJB就是个重量级组件。做成的一个EJB项目,如果要改成SSH做的话,基本就要重新做了。
比如Struts2就是个轻量级组件。要写个struts2的helloworld就写个普通类加配置一下就OK了,将来不用struts2了,那OK,把配置删掉,再写一个类去配置。核心代码基本不用动。
这基本就是其中的区别
热心网友
时间:2023-11-07 21:05
看得懂英文就看英文吧
我就往通俗里说吧。
所谓重量级组件轻量级组件是相对的。
重量级组件就是说要完全依赖于这个组件才能实现 的。
轻量级组件就是说可以脱离此组件,基本不用修改核心代码就能实现的。
比如EJB就是个重量级组件。做成的一个EJB项目,如果要改成SSH做的话,基本就要重新做了。
比如Struts2就是个轻量级组件。要写个struts2的helloworld就写个普通类加配置一下就OK了,将来不用struts2了,那OK,把配置删掉,再写一个类去配置。核心代码基本不用动。
这基本就是其中的区别
热心网友
时间:2023-11-07 21:05
根据sun官方所说:
A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer). A lightweight component is one that "borrows" the screen resource of an ancestor (which means it has no native resource of its own -- so it's "lighter").
(大意是:重量级组件需要一个本地屏幕资源 轻量级组件不需要)
轻量级组件的优势:
* You want to create a custom component that isn't rectangular.
* You want to create a custom component that's partly (or entirely) transparent.
* You want to use multiple components that can draw in each others' areas.
* Your program contains many components and would be too inefficient if implemented with heavyweight components.
*可以创建非规则组件
*可以创建半透明或者全透明组件
*可以层叠摆放
*比重量级组件更高效
继续引用Sun官方文献:
To create a lightweight component, you need to create a class that directly extends one of the following classes:
* Component
* Container
* a class that implements a lightweight component -- for example, a non-AWT class that is a subclass of Component or Container
轻量级组件是java.awt.Component java.awt.Container的子类
(所以Swing组件都是轻量级组件)
参考资料:http://java.sun.com/j2se/1.4.2/docs/guide/awt/demos/lightweight/index.html
热心网友
时间:2023-11-07 21:05
根据sun官方所说:
A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer). A lightweight component is one that "borrows" the screen resource of an ancestor (which means it has no native resource of its own -- so it's "lighter").
(大意是:重量级组件需要一个本地屏幕资源 轻量级组件不需要)
轻量级组件的优势:
* You want to create a custom component that isn't rectangular.
* You want to create a custom component that's partly (or entirely) transparent.
* You want to use multiple components that can draw in each others' areas.
* Your program contains many components and would be too inefficient if implemented with heavyweight components.
*可以创建非规则组件
*可以创建半透明或者全透明组件
*可以层叠摆放
*比重量级组件更高效
继续引用Sun官方文献:
To create a lightweight component, you need to create a class that directly extends one of the following classes:
* Component
* Container
* a class that implements a lightweight component -- for example, a non-AWT class that is a subclass of Component or Container
轻量级组件是java.awt.Component java.awt.Container的子类
(所以Swing组件都是轻量级组件)
参考资料:http://java.sun.com/j2se/1.4.2/docs/guide/awt/demos/lightweight/index.html
热心网友
时间:2023-11-07 21:05
看得懂英文就看英文吧
我就往通俗里说吧。
所谓重量级组件轻量级组件是相对的。
重量级组件就是说要完全依赖于这个组件才能实现 的。
轻量级组件就是说可以脱离此组件,基本不用修改核心代码就能实现的。
比如EJB就是个重量级组件。做成的一个EJB项目,如果要改成SSH做的话,基本就要重新做了。
比如Struts2就是个轻量级组件。要写个struts2的helloworld就写个普通类加配置一下就OK了,将来不用struts2了,那OK,把配置删掉,再写一个类去配置。核心代码基本不用动。
这基本就是其中的区别
热心网友
时间:2023-11-07 21:05
根据sun官方所说:
A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer). A lightweight component is one that "borrows" the screen resource of an ancestor (which means it has no native resource of its own -- so it's "lighter").
(大意是:重量级组件需要一个本地屏幕资源 轻量级组件不需要)
轻量级组件的优势:
* You want to create a custom component that isn't rectangular.
* You want to create a custom component that's partly (or entirely) transparent.
* You want to use multiple components that can draw in each others' areas.
* Your program contains many components and would be too inefficient if implemented with heavyweight components.
*可以创建非规则组件
*可以创建半透明或者全透明组件
*可以层叠摆放
*比重量级组件更高效
继续引用Sun官方文献:
To create a lightweight component, you need to create a class that directly extends one of the following classes:
* Component
* Container
* a class that implements a lightweight component -- for example, a non-AWT class that is a subclass of Component or Container
轻量级组件是java.awt.Component java.awt.Container的子类
(所以Swing组件都是轻量级组件)
参考资料:http://java.sun.com/j2se/1.4.2/docs/guide/awt/demos/lightweight/index.html
热心网友
时间:2023-11-07 21:05
看得懂英文就看英文吧
我就往通俗里说吧。
所谓重量级组件轻量级组件是相对的。
重量级组件就是说要完全依赖于这个组件才能实现 的。
轻量级组件就是说可以脱离此组件,基本不用修改核心代码就能实现的。
比如EJB就是个重量级组件。做成的一个EJB项目,如果要改成SSH做的话,基本就要重新做了。
比如Struts2就是个轻量级组件。要写个struts2的helloworld就写个普通类加配置一下就OK了,将来不用struts2了,那OK,把配置删掉,再写一个类去配置。核心代码基本不用动。
这基本就是其中的区别
热心网友
时间:2023-11-07 21:05
根据sun官方所说:
A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer). A lightweight component is one that "borrows" the screen resource of an ancestor (which means it has no native resource of its own -- so it's "lighter").
(大意是:重量级组件需要一个本地屏幕资源 轻量级组件不需要)
轻量级组件的优势:
* You want to create a custom component that isn't rectangular.
* You want to create a custom component that's partly (or entirely) transparent.
* You want to use multiple components that can draw in each others' areas.
* Your program contains many components and would be too inefficient if implemented with heavyweight components.
*可以创建非规则组件
*可以创建半透明或者全透明组件
*可以层叠摆放
*比重量级组件更高效
继续引用Sun官方文献:
To create a lightweight component, you need to create a class that directly extends one of the following classes:
* Component
* Container
* a class that implements a lightweight component -- for example, a non-AWT class that is a subclass of Component or Container
轻量级组件是java.awt.Component java.awt.Container的子类
(所以Swing组件都是轻量级组件)
参考资料:http://java.sun.com/j2se/1.4.2/docs/guide/awt/demos/lightweight/index.html
热心网友
时间:2023-11-07 21:05
根据sun官方所说:
A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer). A lightweight component is one that "borrows" the screen resource of an ancestor (which means it has no native resource of its own -- so it's "lighter").
(大意是:重量级组件需要一个本地屏幕资源 轻量级组件不需要)
轻量级组件的优势:
* You want to create a custom component that isn't rectangular.
* You want to create a custom component that's partly (or entirely) transparent.
* You want to use multiple components that can draw in each others' areas.
* Your program contains many components and would be too inefficient if implemented with heavyweight components.
*可以创建非规则组件
*可以创建半透明或者全透明组件
*可以层叠摆放
*比重量级组件更高效
继续引用Sun官方文献:
To create a lightweight component, you need to create a class that directly extends one of the following classes:
* Component
* Container
* a class that implements a lightweight component -- for example, a non-AWT class that is a subclass of Component or Container
轻量级组件是java.awt.Component java.awt.Container的子类
(所以Swing组件都是轻量级组件)
参考资料:http://java.sun.com/j2se/1.4.2/docs/guide/awt/demos/lightweight/index.html