home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 2.1 KB | 89 lines |
- // This snippet creates a new tabbed panel
- // <File=TabbedPages.java>
-
- //Title:
- //Version:
- //Copyright:
- //Author:
- //Company:
- //Description:
-
- //<PACKAGE>
-
- import java.awt.*;
- import java.awt.event.*;
- import borland.jbcl.layout.*;
- import borland.jbcl.control.*;
-
- public class TabbedPages extends BevelPanel {
- XYLayout xYLayout1 = new XYLayout();
- TabsetPanel tabsetPanel1 = new TabsetPanel();
- Panel panel1 = new Panel();
- Button ok = new Button();
- Button cancel = new Button();
-
- public TabbedPages() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void jbInit() throws Exception {
- xYLayout1.setWidth(389);
- xYLayout1.setHeight(228);
- tabsetPanel1.setLabels(new String[] {"TabSheet1", "TabSheet2", "TabSheet3"});
- ok.setLabel("OK");
- ok.addActionListener(new TabbedPages_ok_actionAdapter(this));
- cancel.setLabel("Cancel");
- cancel.addActionListener(new TabbedPages_cancel_actionAdapter(this));
- this.setLayout(xYLayout1);
- this.add(tabsetPanel1, new XYConstraints(10, 5, 367, 178));
- this.add(ok, new XYConstraints(79, 188, 97, 31));
- this.add(cancel, new XYConstraints(192, 188, 97, 31));
- }
-
- //<Exclude>
- // Test case
- public static void main(String[] argv) {
- DecoratedFrame frame = new DecoratedFrame();
- TabbedPages tp = new TabbedPages();
- frame.add(tp);
- frame.pack();
- frame.show();
- }
-
- //</Exclude>
- void ok_actionPerformed(ActionEvent e) {
- }
-
- void cancel_actionPerformed(ActionEvent e) {
- }
- }
-
- class TabbedPages_ok_actionAdapter implements ActionListener {
- TabbedPages adaptee;
-
- TabbedPages_ok_actionAdapter(TabbedPages adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.ok_actionPerformed(e);
- }
- }
-
- class TabbedPages_cancel_actionAdapter implements ActionListener {
- TabbedPages adaptee;
-
- TabbedPages_cancel_actionAdapter(TabbedPages adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.cancel_actionPerformed(e);
- }
- }
-