📄 lwcomplexpan.java
字号:
LwLabel lab3 = makeTitle(" Editable & resizeable grid (click two times on a cell to edit it, except first column)...", 355); LwGrid g3 = getGrid(true); LwScrollPan sc1 = new LwScrollPan(g3); sc1.setPSSize(440, 140); sc1.setLocation(20, 385); root.add(lab1); root.add(g1); root.add(lab2); root.add(g2); root.add(lab3); root.add(sc1); return root; } private static LwComponent getMiscPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Progress bar ...", 10); LwProgress pr1 = new LwProgress(); pr1.setValue (8); pr1.setLocation(20, 50); LwProgress pr2 = new LwProgress(); pr2.setValue (18); pr2.setGap (0); pr2.setLocation(20, 80); LwProgress pr3 = new LwProgress(); pr3.setValue (3); pr3.setTitleView(new LwTextRender("25%")); pr3.setBundleSize (10); pr3.setLocation(20, 110); LwProgress pr4 = new LwProgress(); pr4.setValue (3); pr4.setMaxValue(10); pr4.setBundleColor (Color.green); pr4.setOrientation (LwToolkit.VERTICAL); pr4.setLocation(350, 50); LwProgress pr5 = new LwProgress(); pr5.setValue (7); pr5.setMaxValue(10); pr5.setBundleColor (Color.yellow); pr5.setOrientation (LwToolkit.VERTICAL); pr5.setLocation(380, 50); LwProgress pr6 = new LwProgress(); pr6.setValue (1); pr6.setMaxValue(10); pr6.setOrientation (LwToolkit.VERTICAL); pr6.setLocation(410, 50); LwLabel lab2 = makeTitle(" Status bar ...", 170); LwPanel p1 = new LwPanel(); p1.setLwLayout(new LwBorderLayout()); p1.setPSSize(450, 180); p1.setLocation(20, 200); LwStatusBar sb1 = new LwStatusBar(1); sb1.setInsets (1,0,0,0); p1.add(LwBorderLayout.SOUTH, sb1); p1.getViewMan(true).setBorder("br.raised"); sb1.add(new Integer(30), new LwLabel("Label ...")); sb1.add(new Integer(20), new LwLink("[link]")); sb1.add(new Integer(45), new LwTextField("Text field")); sb1.add(new Integer(5), new LwImage((LwImgRender)LwManager.getView("tc"))); LwPanel p2 = new LwPanel (); p2.getViewMan(true).setBorder("br.sunken"); p1.add(LwBorderLayout.CENTER, p2); LwLabel lab3 = makeTitle(" Popup menu ...", 420); final LwLabel lab4 = new LwLabel(new Text("Press right mouse button\nand change\nbackground color.")); lab4.getViewMan(true).setBorder("br.etched"); lab4.setPSSize(150, -1); lab4.setLocation(20, 450); PopupMenu pop = new PopupMenu(); pop.add("Red"); pop.add("Blue"); pop.add("Yellow"); pop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("Red")) lab4.setBackground(Color.red); else if (cmd.equals("Blue")) lab4.setBackground(Color.blue); else if (cmd.equals("Yellow")) lab4.setBackground(Color.yellow); } }); LwPopupManager.manager.setPopup(lab4, pop); root.add(lab1); root.add(pr1); root.add(pr2); root.add(pr3); root.add(pr4); root.add(pr5); root.add(pr6); root.add(lab2); root.add(p1); root.add(lab3); root.add(lab4); return root; } private static LwComponent getTooltipPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle("Move the mouse inside any component below and\ndon't touch your mouse some time ...", 10); LwLabel l1 = makeComment("The tooltip shows mouse pointer\nlocation:", 20, 70, 200); LwCanvas c1 = new LwCanvas(); c1.setLocation(240, 70); c1.setPSSize(150, 60); c1.setBackground(Color.lightGray); c1.getViewMan(true).setBorder("br.etched"); LwLabel l2 = makeComment("This is multiline, trasparent tooltip:", 20, 150, 200); LwImage c2 = new LwImage(new LwImgSetRender("rs/demo/cosmo3.jpg", 100, 100, 150, 60, 1)); c2.setLocation(240, 150); c2.setPSSize(150, 60); c2.getViewMan(true).setBorder("br.etched"); LwLabel l3 = makeComment("Shows complex tooltip:", 20, 230, 200); LwCanvas c3 = new LwCanvas(); c3.setLocation(240, 230); c3.setPSSize(150, 60); c3.getViewMan(true).setBorder("br.etched"); LwTooltipMan.manager.setTooltipInfo(c1, new TTI(1)); LwTooltipMan.manager.setTooltipInfo(c2, new TTI(2)); LwTooltipMan.manager.setTooltipInfo(c3, new TTI(3)); root.add(lab1); root.add(l1); root.add(c1); root.add(l2); root.add(c2); root.add(l3); root.add(c3); return root; } private static LwComponent getTreeGridPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Tree Grid component ...", 10); LwTreeGrid tg = new LwTreeGrid(); tg.setTreeElView(LwTree.CLOSED_VIEW, LwManager.getView("tc")); tg.setTreeElView(LwTree.OPENED_VIEW, LwManager.getView("to")); tg.setTreeElView(LwTree.LEAST_VIEW, LwManager.getView("tl")); tg.setEditorProvider(new LwDefEditors()); tg.setBackground(Color.white); LwGridCaption cap = new LwGridCaption(tg); cap.putTitle(0, "PDA models"); cap.putTitle(1, "OS"); cap.putTitle(2, "Bluetooth"); cap.putTitle(3, "RAM"); cap.putTitle(4, "ROM"); tg.add (LwGrid.TOP_CAPTION_EL, cap); Item r = new Item("PDA"); Tree data = new Tree(r); data.add(r, new Item("Sharp")); data.add(r, new Item("Compaq")); data.add(data.getChildAt(r, 0), new Item("Zaurus SL-5000D")); data.add(data.getChildAt(r, 0), new Item("Zaurus SL-5500")); data.add(data.getChildAt(r, 0), new Item("Zaurus SL-C700")); data.add(data.getChildAt(r, 0), new Item("Zaurus SL-B500")); data.add(data.getChildAt(r, 1), new Item("iPAQ H3870")); data.add(data.getChildAt(r, 1), new Item("iPAQ H3950")); data.add(data.getChildAt(r, 1), new Item("iPAQ H3970")); tg.setTreeModel(data); MatrixModel mm = tg.getModel(); mm.put(2, 1, "Linux 2.4(Embedix)"); mm.put(2, 2, "No"); mm.put(2, 3, "16 Mb"); mm.put(2, 4, "32 Mb"); mm.put(3, 1, "Linux 2.4(Embedix)"); mm.put(3, 2, "No"); mm.put(3, 3, "16 Mb"); mm.put(3, 4, "32 Mb"); mm.put(4, 1, "Linux 2.4(Embedix)"); mm.put(4, 2, "Yes"); mm.put(4, 3, "32 Mb"); mm.put(4, 4, "64 Mb"); mm.put(5, 1, "Linux 2.4(Embedix)"); mm.put(5, 2, "Yes"); mm.put(5, 3, "32 Mb"); mm.put(5, 4, "64 Mb"); mm.put(7, 1, "Pocket PC 2002"); mm.put(7, 2, "Yes"); mm.put(7, 3, "64 Mb"); mm.put(7, 4, "48 Mb"); mm.put(8, 1, "Pocket PC 2002"); mm.put(8, 2, "No"); mm.put(8, 3, "64 Mb"); mm.put(8, 4, "32 Mb"); mm.put(9, 1, "Pocket PC 2002"); mm.put(9, 2, "Yes"); mm.put(9, 3, "64 Mb"); mm.put(9, 4, "48 Mb"); tg.setColWidth(0, 180); tg.setColWidth(1, 150); tg.setColWidth(2, 80); tg.setColWidth(3, 60); tg.setColWidth(4, 60); tg.getPosController().setOffset(0); LwScrollPan sp = new LwScrollPan(tg); sp.setLocation(20, 50); sp.setPSSize (450, 300); root.add(lab1); root.add(sp); return root; } private static LwComponent getMaskPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Masked text fields ...", 10); lab1.setSize (500, lab1.getPreferredSize().height); LwLabel l1 = makeComment("Numeric mask (for example \"121.02\"):", 30, 50, 270); LwMaskTextField tf1 = new LwMaskTextField("", "nnn.nn"); tf1.setPSSize (150, -1); tf1.setLocation (320, 50); LwLabel l2 = makeComment("Letter mask (for example \"BMW-Mercedes\"):", 30, 80, 270); LwMaskTextField tf2 = new LwMaskTextField("", "aaa-aaaaaaaa"); tf2.setPSSize (150, -1); tf2.setLocation (320, 80); LwLabel l3 = makeComment("Combined mask (for example \"12 CAR 09-FF\"):", 30, 110, 270); LwMaskTextField tf3 = new LwMaskTextField("", "nn AAA nn-aa"); tf3.setPSSize (150, -1); tf3.setLocation (320, 110); LwLabel l4 = makeComment("RGB mask (for example \"128\",\"097\",\"010\"):", 30, 140, 270); MaskedText mt1 = new MaskedText("nnn", new RgbMaskValidator()); LwMaskTextField tf4 = new LwMaskTextField(mt1); tf4.setPSSize (30, -1); tf4.setLocation (320, 140); MaskedText mt2 = new MaskedText("nnn", new RgbMaskValidator()); LwMaskTextField tf5 = new LwMaskTextField(mt2); tf5.setPSSize (30, -1); tf5.setLocation (380, 140); MaskedText mt3 = new MaskedText("nnn", new RgbMaskValidator()); LwMaskTextField tf6 = new LwMaskTextField(mt3); tf6.setPSSize (30, -1); tf6.setLocation (440, 140); LwLabel lab2 = makeTitle(" Date masked text fields ...", 10); lab2.setSize (500, lab2.getPreferredSize().height); lab2.setLocation (10, 190); MaskedText mt4 = new MaskedText("dd / mm / yyyy", new DateMaskValidator()); LwMaskTextField tf7 = new LwMaskTextField(mt4); mt4.setText ("21 / 12 / 2002"); tf7.setPSSize (150, -1); tf7.setLocation (30, 230); MaskedText mt5 = new MaskedText("dd - MMM - yyyy", new DateMaskValidator()); mt5.setText ("07 - Jul - 1974"); LwMaskTextField tf8 = new LwMaskTextField(mt5); tf8.setPSSize (150, -1); tf8.setLocation (30, 260); MaskedText mt6 = new MaskedText("dd - mm (MMM) - yyyy", new DateMaskValidator()); mt6.setText ("01 - 12 (Dec) - 2005"); LwMaskTextField tf9 = new LwMaskTextField(mt6); tf9.setPSSize (150, -1); tf9.setLocation (30, 290); root.add (lab1); root.add (l1); root.add (tf1); root.add (l2); root.add (tf2); root.add (l3); root.add (tf3); root.add (l4); root.add (tf4); root.add (tf5); root.add (tf6); root.add (lab2); root.add (tf7); root.add (tf8); root.add (tf9); return root; } private static LwComponent getExtMiscPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Auto-wrapped text label ...", 10); lab1.setSize (500, lab1.getPreferredSize().height); LwLabel l1 = new LwLabel(new LwWrappedText("This is auto wrapped text. It means that the text data are divided by lines automatically according to the view area size.")); l1.getViewMan(true).setBorder("br.etched"); l1.setPSSize (200, 100); l1.setLocation (30, 50); LwLabel lab2 = makeTitle(" Spin [-10 - 10]...", 180); lab2.setSize (500, lab2.getPreferredSize().height); LwSpin spin = new LwSpin(); spin.setLocation (30, 220); spin.setPSSize(50, -1); root.add (lab1); root.add (l1); root.add (lab2); root.add (spin); return root; } private static LwComponent getWinPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Internal frames ...", 10); lab1.setSize (500, lab1.getPreferredSize().height); LwButton b1 = new LwButton("Open Opaque Win"); b1.setLocation (30, 50); LwButton b2 = new LwButton("Open Transient Win"); b2.setLocation (160, 50); LwButton b3 = new LwButton("Open Modal Win"); b3.setLocation (300, 50); //!!! /*LwTracker tr = new LwTracker(); tr.setLocation(30, 350); root.add (tr);*/ LwActionListener l = new WOAL(b1, b2, b3); b1.addActionListener(l); b2.addActionListener(l); b3.addActionListener(l); root.add (lab1); root.add (b1); root.add (b2); root.add (b3); return root; } private static LwComponent getSliderPanel() { LwContainer root = makeRoot(); LwLabel lab1 = makeTitle(" Sliders ...", 10); lab1.setSize (500, lab1.getPreferredSize().height); LwSlider sl1 = new LwSlider(); sl1.setValues (0, 100, new int[] {0, 30, 30, 20 }, 1, 1); sl1.setScaleStep(2); sl1.setLocation(20, 50); LwSlider sl2 = new LwSlider(); sl2.setValues (0, 100, new int[] { 0, 10, 50, 30 }, 5, 1); sl2.setLocation(20, 120); sl2.useIntervalModel(true); sl2.setPSSize(sl1.getPreferredSize().width, -1); LwSlider sl3 = new LwSlider(); sl3.setValues (0, 100, new int[0], 1, 1); sl3.setScaleStep(2); sl3.setLocation(20, 190); LwSlider sl4 = new LwSlider(); sl4.setValues (0, 100, new int[0], 5, 1); sl4.setLocation(20, 250); sl4.setPSSize(sl1.getPreferredSize().width, -1); sl4.showScale(false); LwSlider sl5 = new LwSlider(LwToolkit.VERTICAL); sl5.setValues (-20, 60, new int[] {0, 30, 30, 20 }, 1, 1); sl5.setScaleStep(2); sl5.setLocation(20, 300); LwSlider sl6 = new LwSlider(LwToolkit.VERTICAL); sl6.setValues (0, 80, new int[] { 0, 10, 60, 10 }, 5, 1); sl6.setLocation(140, 300); sl6.useIntervalModel(true); sl6.setPSSize(-1, sl5.getPreferredSize().height); LwSlider sl7 = new LwSlider(LwToolkit.VERTICAL); sl7.setValues (0, 100, new int[0], 5, 1); sl7.setScaleStep(2); sl7.setLocation(240, 300); sl7.setPSSize(-1, sl5.getPreferredSize().height); sl7.showScale(false); /*LwSlider sl4 = new LwSlider();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -