⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lwcomplexpan.java

📁 Zaval Light-Weight Visual Components Library (LwVCL) is a pure Java alternative to humble AWT-based
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/**
 *     Caption: Zaval Light-Weight Visual Components Library
 *     $Revision: 2.79 $
 *     $Date: 2003/08/22 11:24:16 $
 *
 *     @author:     Andrei Vishnevsky
 *     @version:    3.50
 *
 * Zaval Light-Weight Visual Components Library (LwVCL) is a pure Java
 * alternative to humble AWT-based and SWING-based GUI interfaces for
 * wide ranges of platforms, including J2SE, PersonalJava and J2ME.
 *
 * Designed as light-weight but, alternatively to Swing, built separately
 * from AWT (not on top of the java.awt library like Swing), the LwVCL is
 * the good alternative to highly performant, memory-efficient, flexible
 * GUI solution for embedded, stand-alone and applet applications.
 *
 * For more info on this product read Zaval Light-Weight Visual Components Library Tutorial
 * (It comes within this package).
 * The latest product version is always available from the product's homepage:
 * http://www.zaval.org/products/lwvcl/
 * and from the SourceForge:
 * http://sourceforge.net/projects/zaval0003/
 *
 * Contacts:
 *   Support : support@zaval.org
 *   Change Requests : change-request@zaval.org
 *   Feedback : feedback@zaval.org
 *   Other : info@zaval.org
 *
 * Copyright (C) 2001-2003  Zaval Creative Engineering Group (http://www.zaval.org)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * (version 2) as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
package org.zaval.lw.demo;import java.awt.*;import java.io.*;import java.util.*;import org.zaval.data.*;import org.zaval.misc.*;import org.zaval.lw.*;import org.zaval.lw.grid.*;import org.zaval.lw.tree.*;import org.zaval.lw.mask.*;import org.zaval.lw.event.*;import java.awt.event.*;public class LwComplexPan{    static LwImgRender BG = new LwImgRender("rs/demo/bg1.jpg");    protected static void makeMainPanel(LwContainer root)    throws Exception    {      LwManager.loadObjects("obj", LwToolkit.getProperties("rs/demo/demo.properties"));      root.setLwLayout(new LwBorderLayout());      LwNotebook notebook = new LwNotebook (Alignment.LEFT);      notebook.addPage("Borders",   getBordersPanel());      notebook.addPage("Buttons",   getButtonsPanel());      notebook.addPage("Splitter",  getSplitPanel());      notebook.addPage("List",      getListPanel());      notebook.addPage("TextField", getTextFieldPanel());      notebook.addPage("Checkbox",  getCheckboxPanel());      notebook.addPage("Tree",      getTreePanel());      notebook.addPage("Notebook",  getNotebookPanel());      notebook.addPage("ComboBox",  getComboBoxPanel());      notebook.addPage("Scroll",    getScrollPanel());      notebook.addPage("Grid",      getGridPanel());      notebook.addPage("Misc",      getMiscPanel());      notebook.addPage("Tooltip",   getTooltipPanel());      LwTabRender r = new LwTabRender("TreeGrid");      r.setForeground (LwToolkit.darkBlue);      notebook.addPage(r,  getTreeGridPanel());      r = new LwTabRender("Masks");      r.setForeground (LwToolkit.darkBlue);      notebook.addPage(r, getMaskPanel());      r = new LwTabRender("Windows");      r.setForeground (LwToolkit.darkBlue);      notebook.addPage(r, getWinPanel());      r = new LwTabRender("Misc ext.");      r.setForeground (LwToolkit.darkBlue);      notebook.addPage(r, getExtMiscPanel());      r = new LwTabRender("Slider");      r.setForeground (LwToolkit.darkBlue);      notebook.addPage(r, getSliderPanel());      notebook.getViewMan(true).setBg(BG);      root.add(LwBorderLayout.CENTER, notebook);    }    private static LwTree getTree(boolean full){      Item o = new Item("org");      Tree cont = new Tree(o);      Item z = new Item("zaval");      cont.add (o, z);      cont.add (z, new Item("data"));      cont.add (z, new Item("lw"));      cont.add (z, new Item("misc"));      cont.add (z, new Item("util"));      if(full){        cont.add(cont.getChildAt(z, 0), new Item("event"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("MatrixEvent"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("MatrixListener"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("TextEvent"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("TextListener"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("TextListenerSupport"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("TreeEvent"));        cont.add(cont.getChildAt(cont.getChildAt(z, 0), 0), new Item("TreeListener"));        cont.add(cont.getChildAt(z, 0), new Item("Item"));        cont.add(cont.getChildAt(z, 0), new Item("ItemDesc"));        cont.add(cont.getChildAt(z, 0), new Item("Matrix"));        cont.add(cont.getChildAt(z, 0), new Item("MatrixModel"));        cont.add(cont.getChildAt(z, 0), new Item("SingleLineTxt"));        cont.add(cont.getChildAt(z, 0), new Item("Text"));        cont.add(cont.getChildAt(z, 0), new Item("TextModel"));        cont.add(cont.getChildAt(z, 0), new Item("Tree"));        cont.add(cont.getChildAt(z, 0), new Item("TreeModel"));        cont.add(cont.getChildAt(z, 1), new Item("event"));        cont.add(cont.getChildAt(z, 1), new Item("grid"));        cont.add(cont.getChildAt(z, 1), new Item("mask"));        cont.add(cont.getChildAt(z, 1), new Item("rs"));        cont.add(cont.getChildAt(z, 1), new Item("tree"));        cont.add(cont.getChildAt(z, 2), new Item("event"));        cont.add(cont.getChildAt(z, 3), new Item("event"));      }      LwTree tree = new LwTree(cont);      return tree;    }    private static LwGrid getGrid(boolean full)    {      Matrix m = full?new Matrix(6, 5):new Matrix(2, 2);      LwGrid g = new LwGrid(m);      g.setEditorProvider(new LwGE());      g.setViewProvider(new LwGV());      if(full)      {        LwGridCaption cap2 = new LwGridCaption(g);        cap2.putTitle (0, "PDA Model");        cap2.putTitle (1, "OS");        cap2.putTitle (2, "Bluetooth");        cap2.putTitle (3, "RAM");        cap2.putTitle (4, "ROM");        g.setBackground (Color.white);        g.add(LwGrid.TOP_CAPTION_EL, cap2);        g.getPosController().setOffset(0);        g.setColWidth(0, 140);        g.setColWidth(1, 120);        String ram = ";16 MB;32 MB;48 MB;64 MB";        m.put(0, 0, "Sharp Zaurus SL-5000D");        m.put(0, 1, "Linux 2.4 (Embedix)");        m.put(0, 2, "No");        m.put(0, 3, "0"+ram);        m.put(0, 4, "1"+ram);        m.put(1, 0, "iPAQ Pocket PC H3970");        m.put(1, 1, "MS Pocket PC 2002");        m.put(1, 2, "Yes");        m.put(1, 3, "3"+ram);        m.put(1, 4, "2"+ram);        m.put(2, 0, "iPAQ Pocket PC H3950");        m.put(2, 1, "MS Pocket PC 2002");        m.put(2, 2, "No");        m.put(2, 3, "3"+ram);        m.put(2, 4, "1"+ram);        m.put(3, 0, "iPAQ Pocket PC H3870");        m.put(3, 1, "MS Pocket PC 2002");        m.put(3, 2, "Yes");        m.put(3, 3, 3+ram);        m.put(3, 4, 2+ram);        m.put(4, 0, "iPAQ Pocket PC H3970");        m.put(4, 1, "MS Pocket PC 2002");        m.put(4, 2, "No");        m.put(4, 3, 3+ram);        m.put(4, 4, 2+ram);        m.put(5, 0, "iPAQ Pocket PC H3970");        m.put(5, 1, "MS Pocket PC 2002");        m.put(5, 2, "No");        m.put(5, 3, 3+ram);        m.put(5, 4, 2+ram);      }      else      {        g.usePsMetric(false);        m.put(0, 0, "Zaurus SL-5000D");        m.put(0, 1, "Linux 2.4 (Embedix)");        m.put(1, 0, "Compaq iPAQ H3870");        m.put(1, 1, "MS Pocket PC 2002");        Dimension d = g.getPreferredSize();        g.setPSSize(280, d.height);        g.setColWidth(0, 138);        g.setColWidth(1, 138);      }      return g;    }    private static LwComponent getBordersPanel()    {       LwContainer root = makeRoot();       LwLabel lab1 = makeTitle(" Borders ...", 10);       LwPanel c0 = new LwPanel();       c0.setLocation(20, 40);       c0.setPSSize(200, 180);       c0.getViewMan(true).setBorder("br.raised");       LwContainer c01 = new LwPanel();       c01.setLocation(20, 20);       c01.setSize(160, 140);       c01.getViewMan(true).setBorder("br.sunken");       LwContainer c02 = new LwPanel();       c02.setLocation(20, 20);       c02.setSize(120, 100);       c02.getViewMan(true).setBorder("br.etched");       LwContainer c03 = new LwPanel();       c03.setLocation(20, 20);       c03.setSize(80, 60);       c03.getViewMan(true).setBorder("br.plain");       LwContainer c04 = new LwPanel();       c04.setLocation(20, 20);       c04.setSize(40, 20);       c04.getViewMan(true).setBorder("br.dot");       c0.add(LwBorderLayout.CENTER, c01);       c01.add(LwBorderLayout.CENTER, c02);       c02.add(LwBorderLayout.CENTER, c03);       c03.add(LwBorderLayout.CENTER, c04);       LwPanel c1 = new LwPanel();       c1.setLocation(240, 40);       c1.setPSSize(200, 180);       c1.getViewMan(true).setBorder(new LwCustomBorder());       c1.setLwLayout (new LwBorderLayout());       c1.add (LwBorderLayout.CENTER, new LwLabel("Custom border ..."));       LwLabel lab2 = makeTitle(" Titled Borders ...", 250);       LwBorderPan c2 = new LwBorderPan();       c2.setLocation(20, 280);       c2.setPSSize(100, 80);       c2.add (LwBorderPan.TITLE, new LwLabel("Title 1"));       LwBorderPan c3 = new LwBorderPan();       c3.setLocation(140, 280);       c3.setPSSize(100, 80);       c3.setXAlignment(Alignment.CENTER);       c3.add (LwBorderPan.TITLE, new LwCheckbox("Title 2"));       LwBorderPan c4 = new LwBorderPan();       c4.setLocation(260, 280);       c4.setPSSize(100, 80);       c4.setXAlignment(Alignment.RIGHT);       c4.add (LwBorderPan.TITLE, new LwLabel("Title 3"));       LwBorderPan c5 = new LwBorderPan();       c5.setLocation(20, 380);       c5.setPSSize(100, 80);       c5.setTitleAlignment(Alignment.BOTTOM);       c5.add (LwBorderPan.TITLE, new LwLabel("Title 4"));       LwBorderPan c6 = new LwBorderPan();       c6.setLocation(140, 380);       c6.setPSSize(100, 80);       c6.setTitleAlignment(Alignment.BOTTOM);       c6.setXAlignment(Alignment.CENTER);       c6.add (LwBorderPan.TITLE, new LwLabel("Title 5"));       LwBorderPan c7 = new LwBorderPan();       c7.setLocation(260, 380);       c7.setPSSize(100, 80);       c7.setTitleAlignment(Alignment.BOTTOM);       c7.setXAlignment(Alignment.RIGHT);       c7.add (LwBorderPan.TITLE, new LwLabel("Title 5"));       root.add(lab1);       root.add(c0);       root.add(c1);       root.add(lab2);       root.add(c2);       root.add(c3);       root.add(c4);       root.add(c5);       root.add(c6);       root.add(c7);       return root;    }    private static LwComponent getButtonsPanel()    {       LwContainer root = makeRoot();       LwLabel lab1 = makeTitle(" Toolbar ...", 10);       LwContainer toolbar1 = new LwPanel();       toolbar1.setLocation (20, 50);       LwFlowLayout toolbar1Layout = new LwFlowLayout();       toolbar1Layout.setGaps(1, 1);       toolbar1.setLwLayout(toolbar1Layout);       toolbar1.getViewMan(true).setBorder("br.raised");       LwStButton st1 = new LwStButton();       LwAdvViewMan man1 = new LwAdvViewMan();       man1.put ("st.over", LwManager.getView("f3"));       man1.put ("st.out", LwManager.getView("f2"));       man1.put ("st.pressed", LwManager.getView("f1"));       st1.setViewMan(man1);       LwStButton st2 = new LwStButton();       LwAdvViewMan man2 = new LwAdvViewMan();       man2.put ("st.over", LwManager.getView("l3"));       man2.put ("st.out", LwManager.getView("l2"));       man2.put ("st.pressed", LwManager.getView("l1"));       st2.setViewMan(man2);       LwStButton st3 = new LwStButton();       LwAdvViewMan man3 = new LwAdvViewMan();       man3.put ("st.over", LwManager.getView("m3"));       man3.put ("st.out", LwManager.getView("m2"));       man3.put ("st.pressed", LwManager.getView("m1"));       st3.setViewMan(man3);       LwStButton st4 = new LwStButton();       LwAdvViewMan man4 = new LwAdvViewMan();       man4.put ("st.over", LwManager.getView("lg3"));       man4.put ("st.out", LwManager.getView("lg2"));       man4.put ("st.pressed", LwManager.getView("lg1"));       st4.setViewMan(man4);       LwStButton st5 = new LwStButton();       LwAdvViewMan man5 = new LwAdvViewMan();       man5.put ("st.over", LwManager.getView("p3"));       man5.put ("st.out", LwManager.getView("p2"));       man5.put ("st.pressed", LwManager.getView("p1"));       st5.setViewMan(man5);       toolbar1.add (st1);       toolbar1.add (st2);       toolbar1.add (st3);       toolbar1.add (st4);       toolbar1.add (st5);       LwLabel lab2 = makeTitle(" Ordinary buttons ...", 120);       root.add(lab2);       LwButton b1 = new LwButton("WinButton");       LwAdvViewMan man6 = new LwAdvViewMan();       man6.put("button.on", LwManager.getView("br.sunken"));       man6.put("button.off", LwManager.getView("br.raised"));       b1.setViewMan(man6);       b1.setLocation(20, 160);       b1.setPSSize(100, -1);       LwButton b2 = new LwButton("MetalButton");       b2.setLocation(140, 160);       b2.setPSSize(100, -1);       LwButton b3 = new LwButton("TransparentButton");       b3.setLocation(260, 160);       b3.setPSSize(120, -1);       b3.setOpaque(false);       LwLabel lab3 = makeTitle(" Image buttons ...", 220);       LwButton b4 = new LwButton(makeImageLabel("tick", "ImageButton"));       b4.setLocation(20, 260);       b4.setPSSize(-1, -1);       LwButton b5 = new LwButton(new LwImage((LwImgRender)LwManager.getView("paw")));       b5.setLocation(150, 260);       b5.setPSSize(25, 25);       LwButton b6 = new LwButton((LwComponent)null);       LwAdvViewMan man7 = new LwAdvViewMan();       man7.put("button.on", LwManager.getView("flag1"));       man7.put("button.off", LwManager.getView("flag2"));       man7.setBorder("br.etched");       b6.setViewMan(man7);       b6.setLocation(200, 260);       b6.setPSSize(-1, -1);       LwLabel b7lab = new LwLabel(new Text("BgButton\nMultiLine"));       b7lab.setOpaque(false);       LwButton b7 = new LwButton(b7lab);       b7.getViewMan(true).setBg(new LwImgRender("rs/demo/bg12s.gif"));       b7.setLocation(250, 260);       b7.setPSSize(100, -1);       LwLabel lab4 = makeTitle(" Link buttons ...", 320);       LwLink link1 = new LwLink("Link button ...");       link1.setLocation(20, 360);       link1.setPSSize(-1, -1);       LwLink link2 = new LwLink("Link button ...");       link2.setLocation(20, 390);       link2.setPSSize(-1, -1);       LwLink link3 = new LwLink("Link MultiLine\nbutton ...");       link3.setLocation(20, 420);       link3.setPSSize(-1, -1);       root.add(lab1);       root.add(toolbar1);       root.add(lab2);       root.add(b1);       root.add(b2);       root.add(b3);       root.add(lab3);       root.add(b4);       root.add(b5);       root.add(b6);       root.add(b7);       root.add(lab4);       root.add(link1);       root.add(link2);       root.add(link3);       return root;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -