1.dosya
-------------------------------------------------------------------------
import java.awt.*;
import javax.swing.*;
public class deneme {
public deneme(){}
public static void main( String[] args ) {
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame.setDefaultLookAndFeelDecorated(true);
Toolkit.getDefaultToolkit().setDynamicLayout(true);
System.setProperty("sun.awt.noerasebackground","true");
try {
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new javax.swing.plaf.metal.DefaultMetalTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch (Exception ex ) {
}
JFrame frm=new panell();
frm.setVisible(true);
final int inset = 100;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
frm.setBounds ( inset, inset, screenSize.width - inset*2, screenSize.height - inset*2 );
frm.pack();
}
}
-------------------------------------------------------
2.dosya
------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class panell extends JFrame {
Container cont;
public panell(){
this.setTitle("asdasd");
cont=getContentPane();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
frmClose();
}
});
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
JTextArea ta=new JTextArea(20,50);
JPanel panel=new JPanel();
panel.add(ta);
JScrollPane sp=new JScrollPane(panel,v,h);
cont.add(sp);
cont.setLayout(new FlowLayout());
}
public void frmClose(){
System.exit(0);
}
}
Not : dosyayı adlandırırken class isimlerini kullanmayı unutmayın yoksa program class sınıfAdı is public, should be declared in a file named sınıfAdı.java seklinde bir hata meydana gelir.