AlloyLookAndFeel

/**Project Name: example1
* Package Name: jTable
* File Name: TableExample.java
* Path :
* Description:
* Copyright: Copyright (c) 2008
* Company: Harmonysoft, Ltd
* Created User: tinh_cx, Email: tinh_cx@harmonysoft.com.vn
* @version 1.0
* Created Time: 2:54:17 PM, Apr 27, 2008
*/
package jTable;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.pagosoft.plaf.PlafOptions;

public class TableExample extends JPanel{
static JFrame myFrame;

// Tao cac hang DL cho bang;
String data[][] = {
{“1”, “Intro1”},
{“2”, “Intro2”},
{“3”, “Intro3”},
{“4”, “Intro4”},
{“5”, “Intro5”},
{“6”, “Intro6”},
{“7”, “Intro7”},
{“8”, “Intro8”},
{“9”, “Intro9”},
{“10”, “Intro10”}
};

// Tao ten tieu de danh cho cot;
String columNames[] ={
“STT”, “Content”
};

public TableExample() {
// Tao bang;
JTable table = new JTable(data, columNames);

// Dua bang vao khung chua JScrollPane de xem dc nhieu hang/cot;
JScrollPane pane = JTable.createScrollPaneForTable(table);

// Dua khung chua JScrollPane (co chua bang) vao chuong trinh;
this.add(pane);
}

public static void main(String[] args) {
myFrame = new JFrame(“This is Title”);
TableExample app = new TableExample();
myFrame.getContentPane().add(“Center”, app);
myFrame.addWindowListener( new WindowAdapter(){
public void windowClosing(WindowEvent we) {
System.out.println(“exited”);
System.exit(0);
}
} );

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
System.out.println(“screenSize: ” + screenSize);
myFrame.setSize(600, 400);
myFrame.setLocation( (screenSize.width – myFrame.getWidth()) / 2,
(screenSize.height – myFrame.getHeight()) / 2
);
try {
com.incors.plaf.alloy.AlloyLookAndFeel.setProperty(“alloy.licenseCode”, “v#ej_technologies#uwbjzx#e6pck8”);
UIManager.setLookAndFeel(“com.incors.plaf.alloy.AlloyLookAndFeel”);

// com.incors.plaf.alloy.AlloyLookAndFeel
// org.fife.plaf.Office2003.Office2003LookAndFeel
// org.fife.plaf.OfficeXP.OfficeXPLookAndFeel
// org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel
// com.pagosoft.plaf.PgsLookAndFeel
// com.pagosoft.plaf.PlafOptions
// com.pagosoft.plaf.themes.SilverTheme
// PlafOptions.setAsLookAndFeel();
SwingUtilities.updateComponentTreeUI(myFrame);
} catch (Exception e) {
e.printStackTrace();
}

myFrame.setVisible(true);
}
}

Post a Comment

Required fields are marked *

*
*

%d bloggers like this: