Browsing all posts in "JFrame".

A Table with Row Headers

// RowHeaderTable.java
//
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class RowHeaderTable extends JFrame {
public RowHeaderTable( ) {
super(”Row Header Test”);
setSize(300, 200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
TableModel tm = new AbstractTableModel( ) {
String data[] = {””, “a”, “b”, “c”, “d”, “e”};
[...]

The Swing Text Components

Despite all the complexity and power Swing’s text components provide, it’s still pretty simple to do most things. Now it’s shows each of the six Swing text components, plus an extra JTextArea (to show a different wrapping style) and an extra JEditorPane (to show a different EditorKit).
Here the code:
// TextComponentSampler.java
//
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.border.*;
import java.awt.*;
[...]

Changing borders on the fly

Here is a short program that creates four labels. Each label draws a bevel border around itself when the mouse pointer enters the component’s region and erases it when the mouse leaves the region. This kind of “rollover” effect has become a popular feature in some applications’ toolbars. Modifying the program to use soft bevel [...]

seksi drag and drop

Okay we now we learn how to make drag and drop application,with it we can drag and drop from label to or from textfield
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
/**
* Demo drag dan drop
*
* @author Didik Dwi Prasetyo, [didik_rpl at yahoo dot com]
* @version 1.00
*/
public class DragDrop extends JFrame {
JTextField txt;
JLabel lbl;
public DragDrop() {
super(”Drag dan Drop Teks”);
JPanel txtPanel [...]