JAVA程序设计实现SimpleCutAndPaste的功能!

dw5189 2004-08-03 08:28:42
package com.davidflanagan.examples.datatransfer;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;

/**
* This program demonstrates how to add simple copy-and-paste capabilities
* to an application.
**/
public class SimpleCutAndPaste extends Frame implements ClipboardOwner
{
/** The main method creates a frame and pops it up. */
public static void main(String[] args) {
Frame f = new SimpleCutAndPaste();
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
f.pack();
f.setVisible(true);
}

/** The text field that holds the text that is cut or pasted */
TextField field;

/**
* The constructor builds a very simple test GUI, and registers this object
* as the ActionListener for the buttons
**/
public SimpleCutAndPaste() {
super("SimpleCutAndPaste"); // Window title
this.setFont(new Font("SansSerif", Font.PLAIN, 18)); // Use a big font

// Set up the Cut button
Button copy = new Button("Copy");
copy.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { copy(); }
});
this.add(copy, "West");

// Set up the Paste button
Button paste = new Button("Paste");
paste.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { paste(); }
});
this.add(paste, "East");

// Set up the text field that they both operate on
field = new TextField();
this.add(field, "North");
}

/**
* This method takes the current contents of the text field, creates a
* StringSelection object to represent that string, and puts the
* StringSelection onto the clipboard
**/
public void copy() {
// Get the currently displayed value
String s = field.getText();

// Create a StringSelection object to represent the text.
// StringSelection is a pre-defined class that implements
// Transferable and ClipboardOwner for us.
StringSelection ss = new StringSelection(s);

// Now set the StringSelection object as the contents of the clipboard
// Also specify that we're the clipboard owner
this.getToolkit().getSystemClipboard().setContents(ss, this);

// Highlight the text to indicate it is on the clipboard.
field.selectAll();
}

/**
* Get the contents of the clipboard, and, if we understand the type,
* display the contents. This method understands strings and file lists.
**/
public void paste() {
// Get the clipboard
Clipboard c = this.getToolkit().getSystemClipboard();

// Get the contents of the clipboard, as a Transferable object
Transferable t = c.getContents(this);

// Find out what kind of data is on the clipboard
try {
if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
// If it is a string, then get and display the string
String s = (String) t.getTransferData(DataFlavor.stringFlavor);
field.setText(s);

}
else if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
// If it is a list of File objects, get the list and display
// the name of the first file on the list
java.util.List files = (java.util.List)
t.getTransferData(DataFlavor.javaFileListFlavor);
java.io.File file = (java.io.File)files.get(0);
field.setText(file.getName());
}
}
// If anything goes wrong with the transfer, just beep and do nothing.
catch (Exception e) { this.getToolkit().beep(); }
}

/**
* This method implements the ClipboardOwner interface. It is called when
* something else is placed on the clipboard.
**/
public void lostOwnership(Clipboard c, Transferable t) {
// Un-highlight the text field, since we don't "own" the clipboard
// anymore, and the text is no longer available to be pasted.
field.select(0,0);
}
}






****绝对经典的JAVA电子教程****

本人也是JAVA的学习爱好者(大学计算机专业),为了让大家学习更又效率!为此

廉价转让本人以前购买的-----绝对经典JAVA电子教程!--------

-------------比购买书籍更便宜!绝对超值!大家可以对比!
-
SunOne-专集: (国外经典,中文)

SUN-Java 2教程(第五版)
SUN--Java2核心技术卷II--高性能(中英2版,配源码)
SUN--Java2核心技术卷I--原理篇(中英2版,配源码)
SUN--Java高效编程指南
SUN--Java技术精髓
SUN-Java与分布式系统
SUN--Java语言导学
-------------------------------------------------------
开发专家(飞思)---专集:

开发专家之Sun ONE Java 2应用开发指(配源码)
开发专家之Sun ONE Java TCP_IP应用开发详解(配源码)
开发专家之Sun ONE Java Web 服务(配源码)
开发专家之Sun ONE JSP应用开发详解(配源码)
--------------------------------------------------------
JAVA基本网络程序设计专集:

Java P2P程序设计
Java2网络协议内幕
Java网络编程实例
Java网络程序设计TCP-IP

-----------------------------------------------------
JDBC数据库专集:

Java 数据库编程宝典

分布式JAVA 2数据库系统开发指南

Java数据库应用程序编程指南

---------------------------------------------------------
OReilly--专集 (国外经典,中文)

OReillyJava网络编程 (第二版)

JavaTM Servlet 编程 第二版
O′Reilly--JavaTM经典实例

JavaTM安全 (第二版)

JavaTM技术手册 (第三版)




----------------------------------------------------
JAVA2综合类书籍:

Java 2参考大全 (第五版,国外经典中文)

JAVAV编程思想(英文原版)

Java大学教程(外国大学经典教材,翻译为中文)

Java 2 API大全 第1 ,2卷(2本) (国外经典,中文)

Java常用数值算法集

数据结构(Java语言版)(国外经典,中文)

Enterprise JavaBeans2.0程序设计

Java 2 Web 开发认证学习指南

Java 2编程21天自学通 (第二版专业参考版(国外经典,中文)

JavaScript宝典:第四版

Java手机程序设计入门与应用


Java移动通信程序设计-J2ME MIDP


Java数据结构与面向对象编程基础

例释JAVA2企业版(J2EE)程序设计

用J2EE和UML开发Java企业级应用程序


-----------------------------------------------------
告诉我你所需要的书籍名称!然后商谈价格!
如果大家需要,可以联系:
QQ: 371957156 ( 时常在线)
Email: dw5189@163.com
在我确认以后,我可以通在线QQ和Email的方式把书籍发送给你!
注意:你的Email最好为163的!

诚信创造未来!JAVA爱好者!




...全文
222 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dw5189 2004-08-03
  • 打赏
  • 举报
回复
// Choose a cursor based on the type of drag the user initiated
Cursor cursor;
switch(e.getDragAction()) {
case DnDConstants.ACTION_COPY:
cursor = DragSource.DefaultCopyDrop;
break;
case DnDConstants.ACTION_MOVE:
cursor = DragSource.DefaultMoveDrop;
break;
default:
return; // We only support move and copys
}

// Some systems allow us to drag an image along with the
// cursor. If so, create an image of the scribble to drag
if (dragSource.isDragImageSupported()) {
Rectangle scribbleBox = dragScribble.getBounds();
Image dragImage = this.createImage(scribbleBox.width,
scribbleBox.height);
Graphics2D g = (Graphics2D)dragImage.getGraphics();
g.setColor(new Color(0,0,0,0)); // transparent background
g.fillRect(0, 0, scribbleBox.width, scribbleBox.height);
g.setColor(Color.black);
g.setStroke(linestyle);
g.translate(-scribbleBox.x, -scribbleBox.y);
g.draw(dragScribble);
Point hotspot = new Point(-scribbleBox.x, -scribbleBox.y);

// Now start dragging, using the image.
e.startDrag(cursor, dragImage, hotspot, dragScribble,this);
}
else {
// Or start the drag without an image
e.startDrag(cursor, dragScribble,this);
}
// After we've started dragging one scribble, stop looking
return;
}
}
}

/**
* This method, and the four unused methods that follow it implement the
* DragSourceListener interface. dragDropEnd() is invoked when the user
* drops the scribble she was dragging. If the drop was successful, and
* if the user did a "move" rather than a "copy", then we delete the
* dragged scribble from the list of scribbles to draw.
**/
public void dragDropEnd(DragSourceDropEvent e) {
if (!e.getDropSuccess()) return;
int action = e.getDropAction();
if (action == DnDConstants.ACTION_MOVE) {
scribbles.remove(beingDragged);
beingDragged = null;
repaint();
}
}

// These methods are also part of DragSourceListener.
// They are invoked at interesting points during the drag, and can be
// used to perform "drag over" effects, such as changing the drag cursor
// or drag image.
public void dragEnter(DragSourceDragEvent e) {}
public void dragExit(DragSourceEvent e) {}
public void dropActionChanged(DragSourceDragEvent e) {}
public void dragOver(DragSourceDragEvent e) {}

// The next five methods implement DropTargetListener

/**
* This method is invoked when the user first drags something over us.
* If we understand the data type being dragged, then call acceptDrag()
* to tell the system that we're receptive. Also, we change our border
* as a "drag under" effect to signal that we can accept the drop.
**/
public void dragEnter(DropTargetDragEvent e) {
if (e.isDataFlavorSupported(Scribble.scribbleDataFlavor) ||
e.isDataFlavorSupported(DataFlavor.stringFlavor)) {
e.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
this.setBorder(dropBorder);
}
}

/** The user is no longer dragging over us, so restore the border */
public void dragExit(DropTargetEvent e) { this.setBorder(normalBorder); }

/**
* This is the key method of DropTargetListener. It is invoked when the
* user drops something on us.
**/
public void drop(DropTargetDropEvent e) {
this.setBorder(normalBorder); // Restore the default border

// First, check whether we understand the data that was dropped.
// If we supports our data flavors, accept the drop, otherwise reject.
if (e.isDataFlavorSupported(Scribble.scribbleDataFlavor) ||
e.isDataFlavorSupported(DataFlavor.stringFlavor)) {
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
}
else {
e.rejectDrop();
return;
}

// We've accepted the drop, so now we attempt to get the dropped data
// from the Transferable object.
Transferable t = e.getTransferable(); // Holds the dropped data
Scribble droppedScribble; // This will hold the Scribble object

// First, try to get the data directly as a scribble object
try {
droppedScribble =
(Scribble) t.getTransferData(Scribble.scribbleDataFlavor);
}
catch (Exception ex) { // unsupported flavor, IO exception, etc.
// If that doesn't work, try to get it as a String and parse it
try {
String s = (String) t.getTransferData(DataFlavor.stringFlavor);
droppedScribble = Scribble.parse(s);
}
catch(Exception ex2) {
// If we still couldn't get the data, tell the system we failed
e.dropComplete(false);
return;
}
}

// If we get here, we've got the Scribble object
Point p = e.getLocation(); // Where did the drop happen?
droppedScribble.translate(p.getX(), p.getY()); // Move it there
scribbles.add(droppedScribble); // add to display list
repaint(); // ask for redraw
e.dropComplete(true); // signal success!
}

// These are unused DropTargetListener methods
public void dragOver(DropTargetDragEvent e) {}
public void dropActionChanged(DropTargetDragEvent e) {}

/**
* The main method. Creates a simple application using this class. Note
* the buttons for switching between draw mode and drag mode.
**/
public static void main(String[] args) {
// Create a frame and put a scribble pane in it
JFrame frame = new JFrame("ScribbleDragAndDrop");
final ScribbleDragAndDrop scribblePane = new ScribbleDragAndDrop();
frame.getContentPane().add(scribblePane, BorderLayout.CENTER);

// Create two buttons for switching modes
JToolBar toolbar = new JToolBar();
ButtonGroup group = new ButtonGroup();
JToggleButton draw = new JToggleButton("Draw");
JToggleButton drag = new JToggleButton("Drag");
draw.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scribblePane.setDragMode(false);
}
});
drag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scribblePane.setDragMode(true);
}
});
group.add(draw); group.add(drag);
toolbar.add(draw); toolbar.add(drag);
frame.getContentPane().add(toolbar, BorderLayout.NORTH);

// Start off in drawing mode
draw.setSelected(true);
scribblePane.setDragMode(false);

// Pop up the window
frame.setSize(400, 400);
frame.setVisible(true);
}
}
dw5189 2004-08-03
  • 打赏
  • 举报
回复
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.datatransfer.*; // Clipboard, Transferable, DataFlavor, etc.
import java.awt.dnd.*;
import java.util.ArrayList;

/**
* This component can operate in two modes. In "draw mode", it allows the user
* to scribble with the mouse. In "drag mode", it allows the user to drag
* scribbles with the mouse. Regardless of the mode, it always allows
* scribbles to be dropped on it from other applications.
**/
public class ScribbleDragAndDrop extends JComponent
implements DragGestureListener, // For recognizing the start of drags
DragSourceListener, // For processing drag source events
DropTargetListener, // For processing drop target events
MouseListener, // For processing mouse clicks
MouseMotionListener // For processing mouse drags
{
ArrayList scribbles = new ArrayList(); // A list of Scribbles to draw
Scribble currentScribble; // The scribble in progress
Scribble beingDragged; // The scribble being dragged
DragSource dragSource; // A central DnD object
boolean dragMode; // Are we dragging or scribbling?

// These are some constants we use
static final int LINEWIDTH = 3;
static final BasicStroke linestyle = new BasicStroke(LINEWIDTH);
static final Border normalBorder = new BevelBorder(BevelBorder.LOWERED);
static final Border dropBorder = new BevelBorder(BevelBorder.RAISED);

/** The constructor: set up drag-and-drop stuff */
public ScribbleDragAndDrop() {
// Give ourselves a nice default border.
// We'll change this border during drag-and-drop.
setBorder(normalBorder);

// Register listeners to handle drawing
addMouseListener(this);
addMouseMotionListener(this);

// Create a DragSource and DragGestureRecognizer to listen for drags
// The DragGestureRecognizer will notify the DragGestureListener
// when the user tries to drag an object
dragSource = DragSource.getDefaultDragSource();
dragSource.createDefaultDragGestureRecognizer(this, // What component
DnDConstants.ACTION_COPY_OR_MOVE, // What drag types?
this);// the listener

// Create and set up a DropTarget that will listen for drags and
// drops over this component, and will notify the DropTargetListener
DropTarget dropTarget = new DropTarget(this, // component to monitor
this); // listener to notify
this.setDropTarget(dropTarget); // Tell the component about it.
}

/**
* The component draws itself by drawing each of the Scribble objects.
**/
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(linestyle); // Specify wide lines

int numScribbles = scribbles.size();
for(int i = 0; i < numScribbles; i++) {
Scribble s = (Scribble)scribbles.get(i);
g2.draw(s); // Draw the scribble
}
}

public void setDragMode(boolean dragMode) {
this.dragMode = dragMode;
}
public boolean getDragMode() { return dragMode; }

/**
* This method, and the following four methods are from the MouseListener
* interface. If we're in drawing mode, this method handles mouse down
* events and starts a new scribble.
**/
public void mousePressed(MouseEvent e) {
if (dragMode) return;
currentScribble = new Scribble();
scribbles.add(currentScribble);
currentScribble.moveto(e.getX(), e.getY());
}
public void mouseReleased(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}

/**
* This method and mouseMoved() below are from the MouseMotionListener
* interface. If we're in drawing mode, this method adds a new point
* to the current scribble and requests a redraw
**/
public void mouseDragged(MouseEvent e) {
if (dragMode) return;
currentScribble.lineto(e.getX(), e.getY());
repaint();
}
public void mouseMoved(MouseEvent e) {}

/**
* This method implements the DragGestureListener interface. It will be
* invoked when the DragGestureRecognizer thinks that the user has
* initiated a drag. If we're not in drawing mode, then this method will
* try to figure out which Scribble object is being dragged, and will
* initiate a drag on that object.
**/
public void dragGestureRecognized(DragGestureEvent e) {
// Don't drag if we're not in drag mode
if (!dragMode) return;

// Figure out where the drag started
MouseEvent inputEvent = (MouseEvent) e.getTriggerEvent();
int x = inputEvent.getX();
int y = inputEvent.getY();

// Figure out which scribble was clicked on, if any by creating a
// small rectangle around the point and testing for intersection.
Rectangle r = new Rectangle (x-LINEWIDTH, y-LINEWIDTH,
LINEWIDTH*2, LINEWIDTH*2);
int numScribbles = scribbles.size();
for(int i = 0; i < numScribbles; i++) { // Loop through the scribbles
Scribble s = (Scribble) scribbles.get(i);
if (s.intersects(r)) {
// The user started the drag on top of this scribble, so
// start to drag it.

// First, remember which scribble is being dragged, so we can
// delete it later (if this is a move rather than a copy)
beingDragged = s;

// Next, create a copy that will be the one dragged
Scribble dragScribble = (Scribble) s.clone();
// Adjust the origin to the point the user clicked on.
dragScribble.translate(-x, -y);

JAVA开发人员必备是HTML格式的 JavaTM 2 Platform Standard Edition 6 API 规范 本文档是 Java 2 Platform Standard Edition 6.0 的 API 规范。 请参见: 描述 Java 2 Platform 软件包 java.applet 提供创建 applet 所必需的类和 applet 用来与其 applet 上下文通信的类。 java.awt 包含用于创建用户界面和绘制图形图像的所有类。 java.awt.color 提供用于颜色空间的类。 java.awt.datatransfer 提供在应用程序之间和在应用程序内部传输数据的接口和类。 java.awt.dnd Drag 和 Drop 是一种直接操作动作,在许多图形用户界面系统中都会遇到它,它提供了一种机制,能够在两个与 GUI 中显示元素逻辑相关的实体之间传输信息。 java.awt.event 提供处理由 AWT 组件所激发的各类事件的接口和类。 java.awt.font 提供与字体相关的类和接口。 java.awt.geom 提供用于在与二维几何形状相关的对象上定义和执行操作的 Java 2D 类。 java.awt.im 提供输入方法框架所需的类和接口。 java.awt.im.spi 提供启用可以与 Java 运行时环境一起使用的输入方法开发的接口。 java.awt.image 提供创建和修改图像的各种类。 java.awt.image.renderable 提供用于生成与呈现无关的图像的类和接口。 java.awt.print 为通用的打印 API 提供类和接口。 java.beans 包含与开发 beans 有关的类,即基于 JavaBeansTM 架构的组件。 java.beans.beancontext 提供与 bean 上下文有关的类和接口。 java.io 通过数据流、序列化和文件系统提供系统输入和输出。 java.lang 提供利用 Java 编程语言进行程序设计的基础类。 java.lang.annotation 为 Java 编程语言注释设施提供库支持。 java.lang.instrument 提供允许 Java 编程语言代理检测运行在 JVM 上的程序的服务。 java.lang.management 提供管理接口,用于监视和管理 Java 虚拟机以及 Java 虚拟机在其上运行的操作系统。 java.lang.ref 提供了引用对象类,支持在某种程度上与垃圾回收器之间的交互。 java.lang.reflect 提供类和接口,以获得关于类和对象的反射信息。 java.math 提供用于执行任意精度整数算法 (BigInteger) 和任意精度小数算法 (BigDecimal) 的类。 java.net 为实现网络应用程序提供类。 java.nio 定义作为数据容器的缓冲区,并提供其他 NIO 包的概述。 java.nio.channels 定义了各种通道,这些通道表示到能够执行 I/O 操作的实体(如文件和套接字)的连接;定义了用于多路复用的、非阻塞 I/O 操作的选择器。 java.nio.channels.spi 用于 java.nio.channels 包的服务提供者类。 java.nio.charset 定义用来在字节和 Unicode 字符之间转换的 charset、解码器和编码器。 java.nio.charset.spi java.nio.charset 包的服务提供者类。 java.rmi 提供 RMI 包。 java.rmi.activation 为 RMI 对象激活提供支持。 java.rmi.dgc 为 RMI 分布式垃圾回收提供了类和接口。 java.rmi.registry 提供 RMI 注册表的一个类和两个接口。 java.rmi.server 提供支持服务器端 RMI 的类和接口。 java.security 为安全框架提供类和接口。 java.security.acl 此包中的类和接口已经被 java.security 包中的类取代。 java.security.cert 提供用于解析和管理证书、证书撤消列表 (CRL) 和证书路径的类和接口。 java.security.interfaces 提供的接口用于生成 RSA Laboratory Technical Note PKCS#1 中定义的 RSA(Rivest、Shamir 和 Adleman AsymmetricCipher 算法)密钥,以及 NIST 的 FIPS-186 中定义的 DSA(数字签名算法)密钥。 java.security.spec 提供密钥规范和算法参数规范的类和接口。 java.sql 提供使用 JavaTM 编程语言访问并处理存储在数据源(通常是一个关系数据库)中的数据的 API。 java.text 提供以与自然语言无关的方式来处理文本、日期、数字和消息的类和接口。 java.text.spi java.text 包中类的服务提供者类。 java.util 包含 collection 框架、遗留的 collection 类、事件模型、日期和时间设施、国际化和各种实用工具类(字符串标记生成器、随机数生成器和位数组)。 java.util.concurrent 在并发编程中很常用的实用工具类。 java.util.concurrent.atomic 类的小工具包,支持在单个变量上解除锁的线程安全编程。 java.util.concurrent.locks 为锁和等待条件提供一个框架的接口和类,它不同于内置同步和监视器。 java.util.jar 提供读写 JAR (Java ARchive) 文件格式的类,该格式基于具有可选清单文件的标准 ZIP 文件格式。 java.util.logging 提供 JavaTM 2 平台核心日志工具的类和接口。 java.util.prefs 此包允许应用程序存储并获取用户和系统首选项和配置数据。 java.util.regex 用于匹配字符序列与正则表达式指定模式的类。 java.util.spi java.util 包中类的服务提供者类。 java.util.zip 提供用于读写标准 ZIP 和 GZIP 文件格式的类。 javax.accessibility 定义了用户界面组件与提供对这些组件进行访问的辅助技术之间的协定。 javax.crypto 为加密操作提供类和接口。 javax.crypto.interfaces 根据 RSA Laboratories' PKCS #3 的定义,提供 Diffie-Hellman 密钥接口。 javax.crypto.spec 为密钥规范和算法参数规范提供类和接口。 javax.imageio Java Image I/O API 的主要包。 javax.imageio.event Java Image I/O API 的一个包,用于在读取和写入图像期间处理事件的同步通知。 javax.imageio.metadata 用于处理读写元数据的 Java Image I/O API 的包。 javax.imageio.plugins.bmp 包含供内置 BMP 插件使用的公共类的包。 javax.imageio.plugins.jpeg 支持内置 JPEG 插件的类。 javax.imageio.spi 包含用于 reader、writer、transcoder 和流的插件接口以及一个运行时注册表的 Java Image I/O API 包。 javax.imageio.stream Java Image I/O API 的一个包,用来处理从文件和流中产生的低级别 I/O。 javax.management 提供 Java Management Extensions 的核心类。 javax.management.loading 提供实现高级动态加载的类。 javax.management.modelmbean 提供了 ModelMBean 类的定义。 javax.management.monitor 提供 monitor 类的定义。 javax.management.openmbean 提供开放数据类型和 Open MBean 描述符类。 javax.management.relation 提供 Relation Service 的定义。 javax.management.remote 对 JMX MBean 服务器进行远程访问使用的接口。 javax.management.remote.rmi RMI 连接器是供 JMX Remote API 使用的一种连接器,后者使用 RMI 将客户端请求传输到远程 MBean 服务器。 javax.management.timer 提供对 Timer MBean(计时器 MBean)的定义。 javax.naming 为访问命名服务提供类和接口。 javax.naming.directory 扩展 javax.naming 包以提供访问目录服务的功能javax.naming.event 在访问命名和目录服务时提供对事件通知的支持。 javax.naming.ldap 提供对 LDAPv3 扩展操作和控件的支持。 javax.naming.spi 提供一些方法来动态地插入对通过 javax.naming 和相关包访问命名和目录服务的支持。 javax.net 提供用于网络应用程序的类。 javax.net.ssl 提供用于安全套接字包的类。 javax.print 为 JavaTM Print Service API 提供了主要类和接口。 javax.print.attribute 提供了描述 JavaTM Print Service 属性的类型以及如何分类这些属性的类和接口。 javax.print.attribute.standard 包 javax.print.attribute.standard 包括特定打印属性的类。 javax.print.event 包 javax.print.event 包含事件类和侦听器接口。 javax.rmi 包含 RMI-IIOP 的用户 API。 javax.rmi.CORBA 包含用于 RMI-IIOP 的可移植性 API。 javax.rmi.ssl 通过安全套接字层 (SSL) 或传输层安全 (TLS) 协议提供 RMIClientSocketFactory 和 RMIServerSocketFactory 的实现javax.security.auth 此包提供用于进行验证和授权的框架。 javax.security.auth.callback 此包提供与应用程序进行交互所必需的类,以便检索信息(例如,包括用户名和密码的验证数据)或显示信息(例如,错误和警告消息)。 javax.security.auth.kerberos 此包包含与 Kerberos 网络验证协议相关的实用工具类。 javax.security.auth.login 此包提供可插入的验证框架。 javax.security.auth.spi 此包提供用于实现可插入验证模块的接口。 javax.security.auth.x500 此包包含应该用来在 Subject 中存储 X500 Principal 和 X500 Private Crendentials 的类。 javax.security.cert 为公钥证书提供类。 javax.security.sasl 包含用于支持 SASL 的类和接口。 javax.sound.midi 提供用于 MIDI(音乐乐器数字接口)数据的 I/O、序列化和合成的接口和类。 javax.sound.midi.spi 在提供新的 MIDI 设备、MIDI 文件 reader 和 writer、或音库 reader 时提供服务提供者要实现的接口。 javax.sound.sampled 提供用于捕获、处理和回放取样的音频数据的接口和类。 javax.sound.sampled.spi 在提供新音频设备、声音文件 reader 和 writer,或音频格式转换器时,提供将为其创建子类的服务提供者的抽象类。 javax.sql 为通过 JavaTM 编程语言进行服务器端数据源访问和处理提供 API。 javax.sql.rowset JDBC RowSet 实现的标准接口和基类。 javax.sql.rowset.serial 提供实用工具类,允许 SQL 类型与 Java 编程语言数据类型之间的可序列化映射关系。 javax.sql.rowset.spi 第三方供应商在其同步提供者的实现中必须使用的标准类和接口。 javax.swing 提供一组“轻量级”(全部是 Java 语言)组件,尽量让这些组件在所有平台上的工作方式都相同。 javax.swing.border 提供围绕 Swing 组件绘制特殊边框的类和接口。 javax.swing.colorchooser 包含供 JColorChooser 组件使用的类和接口。 javax.swing.event 供 Swing 组件触发的事件使用。 javax.swing.filechooser 包含 JFileChooser 组件使用的类和接口。 javax.swing.plaf 提供一个接口和许多抽象类,Swing 用它们来提供自己的可插入外观功能javax.swing.plaf.basic 提供了根据基本外观构建的用户界面对象。 javax.swing.plaf.metal 提供根据 Java 外观(曾经代称为 Metal)构建的用户界面对象,Java 外观是默认外观。 javax.swing.plaf.multi 提供了组合两个或多个外观的用户界面对象。 javax.swing.plaf.synth Synth 是一个可更换皮肤 (skinnable) 的外观,在其中可委托所有绘制。 javax.swing.table 提供用于处理 javax.swing.JTable 的类和接口。 javax.swing.text 提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。 javax.swing.text.html 提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。 javax.swing.text.html.parser 提供默认的 HTML 解析器以及支持类。 javax.swing.text.rtf 提供一个类 (RTFEditorKit),用于创建富文本格式(Rich-Text-Format)的文本编辑器。 javax.swing.tree 提供处理 javax.swing.JTree 的类和接口。 javax.swing.undo 允许开发人员为应用程序(例如文本编辑器)中的撤消/恢复提供支持。 javax.transaction 包含解组期间通过 ORB 机制抛出的三个异常。 javax.transaction.xa 提供定义事务管理器和资源管理器之间的协定的 API,它允许事务管理器添加或删除 JTA 事务中的资源对象(由资源管理器驱动程序提供)。 javax.xml 根据 XML 规范定义核心 XML 常量和功能javax.xml.bind 为包含解组、编组和验证功能的客户端应用程序提供运行时绑定框架。 javax.xml.bind.annotation 定义将 Java 程序元素定制成 XML 模式映射的注释。 javax.xml.bind.annotation.adapters XmlAdapter 及其规范定义的子类允许任意 Java 类与 JAXB 一起使用。 javax.xml.bind.attachment 此包由基于 MIME 的包处理器实现,该处理器能够解释并创建基于 MIME 的包格式的已优化的二进制数据。 javax.xml.bind.helpers 仅由 JAXB 提供者用于: 提供某些 javax.xml.bind 接口的部分默认实现javax.xml.bind.util 有用的客户端实用工具类。 javax.xml.crypto 用于 XML 加密的通用类。 javax.xml.crypto.dom javax.xml.crypto 包的特定于 DOM 的类。 javax.xml.crypto.dsig 用于生成和验证 XML 数字签名的类。 javax.xml.crypto.dsig.dom javax.xml.crypto.dsig 包特定于 DOM 的类。 javax.xml.crypto.dsig.keyinfo 用来解析和处理 KeyInfo 元素和结构的类。 javax.xml.crypto.dsig.spec XML 数字签名的参数类。 javax.xml.datatype XML/Java 类型映射关系。 javax.xml.namespace XML 名称空间处理。 javax.xml.parsers 提供允许处理 XML 文档的类。 javax.xml.soap 提供用于创建和构建 SOAP 消息的 API。 javax.xml.stream javax.xml.stream.events javax.xml.stream.util javax.xml.transform 此包定义了用于处理转换指令,以及执行从源到结果的转换的一般 API。 javax.xml.transform.dom 此包实现特定于 DOM 的转换 API。 javax.xml.transform.sax 此包实现特定于 SAX2 的转换 API。 javax.xml.transform.stax 提供特定于 StAX 的转换 API。 javax.xml.transform.stream 此包实现特定于流和 URI 的转换 API。 javax.xml.validation 此包提供了用于 XML 文档验证的 API。 javax.xml.ws 此包包含核心 JAX-WS API。 javax.xml.ws.handler 该包定义用于消息处理程序的 API。 javax.xml.ws.handler.soap 该包定义用于 SOAP 消息处理程序的 API。 javax.xml.ws.http 该包定义特定于 HTTP 绑定的 API。 javax.xml.ws.soap 该包定义特定于 SOAP 绑定的 API。 javax.xml.ws.spi 该包定义用于 JAX-WS 2.0 的 SPI。 javax.xml.xpath 此包提供了用于 XPath 表达式的计算和访问计算环境的 object-model neutral API。 org.ietf.jgss 此包提供一个框架,该框架允许应用程序开发人员通过利用统一的 API 使用一些来自各种基础安全机制(如 Kerberos)的安全服务,如验证、数据完整性和和数据机密性。 org.omg.CORBA 提供 OMG CORBA API 到 JavaTM 编程语言的映射,包括 ORB 类,如果已实现该类,则程序员可以使用此类作为全功能对象请求代理(Object Request Broker,ORB)。 org.omg.CORBA_2_3 CORBA_2_3 包定义对 Java[tm] Standard Edition 6 中现有 CORBA 接口所进行的添加。 org.omg.CORBA_2_3.portable 提供输入和输出值类型的各种方法,并包含 org/omg/CORBA/portable 包的其他更新。 org.omg.CORBA.DynAnyPackage 提供与 DynAny 接口一起使用的异常(InvalidValue、Invalid、InvalidSeq 和 TypeMismatch)。 org.omg.CORBA.ORBPackage 提供由 ORB.resolve_initial_references 方法抛出的异常 InvalidName,以及由 ORB 类中的动态 Any 创建方法抛出的异常 InconsistentTypeCode。 org.omg.CORBA.portable 提供可移植性层,即可以使一个供应商生成的代码运行在另一个供应商 ORB 上的 ORB API 集合。 org.omg.CORBA.TypeCodePackage 提供用户定义的异常 BadKind 和 Bounds,它们将由 TypeCode 类中的方法抛出。 org.omg.CosNaming 为 Java IDL 提供命名服务。 org.omg.CosNaming.NamingContextExtPackage 此包包含以下在 org.omg.CosNaming.NamingContextExt 中使用的类: AddressHelper StringNameHelper URLStringHelper InvalidAddress 包规范 有关 Java[tm] Platform, Standard Edition 6 ORB 遵守的官方规范的受支持部分的明确列表,请参阅 Official Specifications for CORBA support in Java[tm] SE 6。 org.omg.CosNaming.NamingContextPackage 此包包含 org.omg.CosNaming 包的 Exception 类。 org.omg.Dynamic 此包包含 OMG Portable Interceptor 规范 http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06 的第 21.9 小节中指定的 Dynamic 模块。 org.omg.DynamicAny 提供一些类和接口使得在运行时能够遍历与 any 有关联的数据值,并提取数据值的基本成分。 org.omg.DynamicAny.DynAnyFactoryPackage 此包包含 DynamicAny 模块的 DynAnyFactory 接口中的类和异常,该模块在 OMG The Common Object Request Broker: Architecture and Specification http://cgi.omg.org/cgi-bin/doc?formal/99-10-07 的第 9.2.2 小节中指定。 org.omg.DynamicAny.DynAnyPackage 此包包含 DynAny 模块的 DynAnyFactory 接口中的类和异常,该模块在 OMG The Common Object Request Broker: Architecture and Specification http://cgi.omg.org/cgi-bin/doc?formal/99-10-07 的第 9.2 小节中指定。 org.omg.IOP 此包包含在 OMG 文档 The Common Object Request Broker: Architecture and Specification http://cgi.omg.org/cgi-bin/doc?formal/99-10-07 的 13.6.小节中指定的 IOP 模块。 org.omg.IOP.CodecFactoryPackage 此包包含 IOP::CodeFactory 接口中指定的异常(作为 Portable Interceptor 规范的一部分)。 org.omg.IOP.CodecPackage 此包根据 IOP::Codec IDL 接口定义生成。 org.omg.Messaging 此包包含 OMG Messaging Interceptor 规范 http://cgi.omg.org/cgi-bin/doc?formal/99-10-07 中指定的 Messaging 模块。 org.omg.PortableInterceptor 提供一个注册 ORB 钩子 (hook) 的机制,通过这些钩子 ORB 服务可以截取执行 ORB 的正常流。 org.omg.PortableInterceptor.ORBInitInfoPackage 此包包含 OMG Portable Interceptor 规范 http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06 的第 21.7.2 小节中指定的 PortableInterceptor 模块的 ORBInitInfo 本地接口中的异常和 typedef。 org.omg.PortableServer 提供一些类和接口,用来生成跨多个供应商 ORB 的可移植应用程序的服务器端。 org.omg.PortableServer.CurrentPackage 提供各种方法实现,这些实现能够访问调用方法的对象的身份。 org.omg.PortableServer.POAManagerPackage 封装 POA 关联的处理状态。 org.omg.PortableServer.POAPackage 允许程序员构造可在不同 ORB 产品间移植的对象实现。 org.omg.PortableServer.portable 提供一些类和接口,用来生成跨多个供应商 ORB 的可移植应用程序的服务器端。 org.omg.PortableServer.ServantLocatorPackage 提供定位 servant 的类和接口。 org.omg.SendingContext 为值类型的编组提供支持。 org.omg.stub.java.rmi 包含用于 java.rmi 包中出现的 Remote 类型的 RMI-IIOP Stub。 org.w3c.dom 为文档对象模型 (DOM) 提供接口,该模型是 Java API for XML Processing 的组件 API。 org.w3c.dom.bootstrap org.w3c.dom.events org.w3c.dom.ls org.xml.sax 此包提供了核心 SAX API。 org.xml.sax.ext 此包包含适合的 SAX 驱动程序不一定支持的 SAX2 设施的接口。 org.xml.sax.helpers 此包包含“帮助器”类,其中包括对引导基于 SAX 的应用程序的支持。

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧