Sunday, 22 July 2012

Loading and using DLL in Java Codes

loading DLL should be in static block since it requires to be loaded before creation of any object as main method. DLL shold be in current directory where class file is located.


static {
System.loadLibrary("DLL Name");
}

Runtime Compile and Loading of Java class files

Runtime run = Runtime.getRuntime();
 
run.exec( /* COMMAND */ );

Java JFrame Examples

 

 
 
import javax.swing.*;

public class JFrameTester {

  public static void main(String[] args) {
    
    JFrame f = new JFrame("A JFrame");
    f.setSize(250, 250);
    f.setLocation(300,200);
    f.getContentPane().add(BorderLayout.CENTER, new JTextArea(10, 40));
    f.setVisible(true);
    
  }
  
}

Maximizing JFrame to Maximum

JFrame frame = new JFrame();
frame.setExtendedState(MAXIMIZED_BOTH);