NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed. (sponsored)
In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.
Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.
Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Ever wondered what information you could possibly get from a drop in a Drag&Drop operation? Wonder no more. Use the following small helper class and drag something over it. It will show you the available DataFlavors.
Use it with draggables from native applications (browser URL, files, text snippets etc.) and you might be surprised about the different DataFlavors available!
import java.awt.*; // imports not expanded to safe space
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import javax.swing.*;
/** @author beders (Jochen Bedersdorfer) */
publicclass UniversalDropViewer extends JTextArea implements DropTargetListener{
public UniversalDropViewer() {
new DropTarget(this, this);
setText("Drag something over me!");
}
publicvoid dragEnter(DropTargetDragEvent aDtde) {
StringBuilder sb = new StringBuilder(300);
for (DataFlavor d : aDtde.getCurrentDataFlavorsAsList()) {
sb.append(d.getHumanPresentableName()).append(": ").append(d.getMimeType()).append(" (").
append(d.getDefaultRepresentationClassAsString()).append(")\n");
}
setText(sb.toString());
}
publicvoid dragOver(DropTargetDragEvent aDtde) {}
publicvoid dropActionChanged(DropTargetDragEvent aDtde) {}
publicvoid dragExit(DropTargetEvent aDte) {}
publicvoid drop(DropTargetDropEvent aDtde) {}
publicstaticvoid main(String[] args) {
JFrame fr = new JFrame("UDV");
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fr.add(new JScrollPane(new UniversalDropViewer()));
fr.setSize(600,700);
fr.setVisible(true);
}
}
AWT: See what flavours are in a drop
At 5:12 AM on Apr 29, 2006, Jochen Bedersdorfer
wrote:
Fresh Jobs for Developers Post a job opportunity
Use it with draggables from native applications (browser URL, files, text snippets etc.) and you might be surprised about the different DataFlavors available!
import java.awt.*; // imports not expanded to safe space import java.awt.dnd.*; import java.awt.datatransfer.*; import javax.swing.*; /** @author beders (Jochen Bedersdorfer) */ public class UniversalDropViewer extends JTextArea implements DropTargetListener{ public UniversalDropViewer() { new DropTarget(this, this); setText("Drag something over me!"); } public void dragEnter(DropTargetDragEvent aDtde) { StringBuilder sb = new StringBuilder(300); for (DataFlavor d : aDtde.getCurrentDataFlavorsAsList()) { sb.append(d.getHumanPresentableName()).append(": ").append(d.getMimeType()).append(" ("). append(d.getDefaultRepresentationClassAsString()).append(")\n"); } setText(sb.toString()); } public void dragOver(DropTargetDragEvent aDtde) {} public void dropActionChanged(DropTargetDragEvent aDtde) {} public void dragExit(DropTargetEvent aDte) {} public void drop(DropTargetDropEvent aDtde) {} public static void main(String[] args) { JFrame fr = new JFrame("UDV"); fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fr.add(new JScrollPane(new UniversalDropViewer())); fr.setSize(600,700); fr.setVisible(true); } }0 replies so far (
Post your own)