root/trunk/plugins/examples/org/pathvisio/example/ExSidepanel.java
| Revision 2979, 1.5 KB (checked in by martijn, 8 months ago) |
|---|
| Line | |
|---|---|
| 1 | // PathVisio, |
| 2 | // a tool for data visualization and analysis using Biological Pathways |
| 3 | // Copyright 2006-2009 BiGCaT Bioinformatics |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | // |
| 17 | package org.pathvisio.example; |
| 18 | |
| 19 | import java.awt.BorderLayout; |
| 20 | |
| 21 | import javax.swing.JLabel; |
| 22 | import javax.swing.JPanel; |
| 23 | import javax.swing.JTabbedPane; |
| 24 | |
| 25 | import org.pathvisio.gui.swing.PvDesktop; |
| 26 | import org.pathvisio.plugin.Plugin; |
| 27 | |
| 28 | /** |
| 29 | * Demonstres how a Plugin can add a new tab to the Sidepanel. |
| 30 | */ |
| 31 | public class ExSidepanel implements Plugin |
| 32 | { |
| 33 | private PvDesktop desktop; |
| 34 | |
| 35 | public void init(PvDesktop desktop) |
| 36 | { |
| 37 | this.desktop = desktop; |
| 38 | |
| 39 | // create a new panel to show in the side bar |
| 40 | JPanel mySideBarPanel = new JPanel (); |
| 41 | mySideBarPanel.setLayout (new BorderLayout()); |
| 42 | mySideBarPanel.add (new JLabel ("Hello SideBar"), BorderLayout.CENTER); |
| 43 | |
| 44 | // get a reference to the sidebar |
| 45 | JTabbedPane sidebarTabbedPane = desktop.getSideBarTabbedPane(); |
| 46 | |
| 47 | // add or panel with a given Title |
| 48 | sidebarTabbedPane.add("Title", mySideBarPanel); |
| 49 | } |
| 50 | |
| 51 | public void done() {} |
| 52 | } |
Note: See TracBrowser
for help on using the browser.
