What is TaskPane ???
Download Jar File Here
Source Code:
Import File
import com.l2fprod.common.swing.JTaskPane;
import com.l2fprod.common.swing.JTaskPaneGroup;
Creating object of JTaskPane
JTaskPane taskPane = new JTaskPane();
Take JPanel object to add JTaskPane into this.
JPanel jPanel = new Panel(); jPanel.setLayout(new BorderLayout()); jPanel.add("Center", new JScrollPane(taskPane));
Now Simply Add Components in JTaskPane
JTaskPaneGroup ProductMenu = new JTaskPaneGroup(); ProductMenu.setTitle("Product"); ProductMenu.setIcon(createImageIcon("/pill.png","")); taskPane.add(ProductMenu); ProductMenu.setExpanded(false);
Adding Submenu to Menu
addNestedGroupAction(ProductMenu,"Add New Product");
addNestedGroupAction(ProductMenu,"Edit Product");
addNestedGroupAction(ProductMenu,"Delete Product");
addNestedGroupAction(ProductMenu,"Find Product");
addNestedGroupAction(ProductMenu,"Product List");
addNestedGroupAction(ProductMenu,"Expire Date");
addNestedGroupAction(ProductMenu,"Breakage");
addNestedGroupAction(ProductMenu,"Low Stock");
addNestedGroupAction(ProductMenu,"Transfer");
addNestedGroupAction(ProductMenu,"Price List");
addNestedGroupAction(ProductMenu,"Edit Product");
addNestedGroupAction(ProductMenu,"Delete Product");
addNestedGroupAction(ProductMenu,"Find Product");
addNestedGroupAction(ProductMenu,"Product List");
addNestedGroupAction(ProductMenu,"Expire Date");
addNestedGroupAction(ProductMenu,"Breakage");
addNestedGroupAction(ProductMenu,"Low Stock");
addNestedGroupAction(ProductMenu,"Transfer");
addNestedGroupAction(ProductMenu,"Price List");
Action Event for Menu
void addNestedGroupAction(final JTaskPaneGroup parent,String menu) {
Action addNestedGroup = new AbstractAction(menu) {
public void actionPerformed(ActionEvent e) {
String s = e.getActionCommand();
if(s.equals("Add New Product"))
{
// Your code here
}
if(s.equals("Edit Product"))
{ // Your code here
}
if(s.equals("Delete Product"))
{ // Your code here }
if(s.equals("Find Product"))
{ // Your code here }
if(s.equals("Product List"))
{ // Your code here }
if(s.equals("Expire Date"))
{ // Your code here }
}
Action addNestedGroup = new AbstractAction(menu) {
public void actionPerformed(ActionEvent e) {
String s = e.getActionCommand();
if(s.equals("Add New Product"))
{
// Your code here
}
if(s.equals("Edit Product"))
{ // Your code here
}
if(s.equals("Delete Product"))
{ // Your code here }
if(s.equals("Find Product"))
{ // Your code here }
if(s.equals("Product List"))
{ // Your code here }
if(s.equals("Expire Date"))
{ // Your code here }
}
SO Enjoy Programming.................
No comments:
Post a Comment