Saturday, October 10, 2009
An interesting java program that caught my attention is the one that follows!import java.awt.BorderLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
public class ScrollSample {
public static void main(String args[]) {
String title = "JScrollPane Sample";
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Icon icon = new ImageIcon("dhoni.jpg");
JLabel label1 = new JLabel(icon);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(label1
);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 200);
frame.setVisible(true);
}
}
Labels: Java, Programming
0 comments:
Post a Comment