Package org.jdesktop.swingx

Examples of org.jdesktop.swingx.JXTaskPaneContainer


    taskPane.setSpecial(true);
    taskPane.setCollapsed(false);
    taskPane.setTitle(Messages.getString("StyleDefinitionEditorDialog.TaskTitle"));
    taskPane.add(new AddStyleRuleAction(editorContext));

    taskPaneContainer = new JXTaskPaneContainer();
    taskPaneContainer.add(taskPane);
    return new JScrollPane(taskPaneContainer);
  }
View Full Code Here


  // tweak with the UI defaults for the taskpane and taskpanecontainer
  _changeUIdefaults_();

  // create a taskpanecontainer
  JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();
 
  this._scr_ = new JScrollPane(taskpanecontainer);

  // create a taskpane, and set it's title and icon
  JXTaskPane tsk1 = new JXTaskPane();
  tsk1.setTitle("My Tasks 1");
  tsk1.setIcon(Images.Quit.getIcon(24, 24));

  // add various actions and components to the taskpane
  //tsk1.add(_xlb1_);
 
  /*tsk1.add(new AbstractAction() {
    {
      putValue(Action.NAME, "task pane item 1 : an action");
      putValue(Action.SHORT_DESCRIPTION, "perform an action");
      putValue(Action.SMALL_ICON, Images.NetworkConnected.getIcon(32, 32));
    }
    public void actionPerformed(ActionEvent e) {
      _xlb1_.setText("an action performed");
    }
  });*/
 
  // ---
 
  // create a taskpane, and set it's title and icon
  JXTaskPane tsk2 = new JXTaskPane();
  tsk2.setTitle("My Tasks 2");
  tsk2.setIcon(Images.Quit.getIcon(24, 24));

  // add various actions and components to the taskpane
  JPanel pnl2 = new JPanel();
  //JScrollPane scr2 = new JScrollPane(pnl2); // same as scrollPane.setViewportView(table);
 
  tsk2.add(pnl2);
  //pnl2.add(_xlb2_);
 
  JButton btn2 = new JButton("btn2");
 
  pnl2.add(btn2);
 
  // ---

  // add the task pane to the taskpanecontainer
  taskpanecontainer.add(tsk1);
  taskpanecontainer.add(tsk2);

  // set the transparency of the JXPanel to 50% transparent
  //xpnAll.setAlpha(0.7f);

  /*xpnAll.add(taskpanecontainer, BorderLayout.CENTER);
View Full Code Here

  // tweak with the UI defaults for the taskpane and taskpanecontainer
  changeUIdefaults();

  // create a taskpanecontainer
  JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();

  // create a taskpane, and set it's title and icon
  JXTaskPane taskpane = new JXTaskPane();
  taskpane.setTitle("My Tasks");
  taskpane.setIcon(Images.Quit.getIcon(24, 24));

  // add various actions and components to the taskpane
  taskpane.add(label);
  taskpane.add(new AbstractAction() {
    {
      putValue(Action.NAME, "task pane item 2 : an action");
      putValue(Action.SHORT_DESCRIPTION, "perform an action");
      putValue(Action.SMALL_ICON, Images.NetworkConnected.getIcon(32, 32));
    }
    public void actionPerformed(ActionEvent e) {
      label.setText("an action performed");
    }
  });

  // add the task pane to the taskpanecontainer
  taskpanecontainer.add(taskpane);

  // set the transparency of the JXPanel to 50% transparent
  panel.setAlpha(0.7f);

  panel.add(taskpanecontainer, BorderLayout.CENTER);
View Full Code Here

        return splitPane;
    }
   

    private JComponent createButtonStack(JComponent demoContainer) {
        JComponent buttonStack = new JXTaskPaneContainer();
        JXTaskPane taskPane = new JXTaskPane();
        taskPane.setTitle("demo");
        taskPane.add(createTextAction(demoContainer));
        taskPane.add(createPageAction(demoContainer));
        buttonStack.add(taskPane);
        return buttonStack;
    }
View Full Code Here

       
        bind();
    }

    private void createTaskPaneDemo() {
        JXTaskPaneContainer tpc = new JXTaskPaneContainer();
       
        // "System" GROUP
        systemGroup = new JXTaskPane();
        systemGroup.setName("systemGroup");
        tpc.add(systemGroup);
       
        // "Office" GROUP
        officeGroup = new JXTaskPane();
        officeGroup.setName("officeGroup");
        tpc.add(officeGroup);
       
        // "SEE ALSO" GROUP and ACTIONS
        seeAlsoGroup = new JXTaskPane();
        seeAlsoGroup.setName("seeAlsoGroup");
        tpc.add(seeAlsoGroup);
       
        // "Details" GROUP
        detailsGroup = new JXTaskPane();
        detailsGroup.setName("detailsGroup");
       
        //TODO better injection for editor area
        JEditorPane area = new JEditorPane("text/html", "<html>");
        area.setName("detailsArea");
       
        area.setFont(UIManager.getFont("Label.font"));
       
        Font defaultFont = UIManager.getFont("Button.font");
       
        String stylesheet = "body { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; font-family: "
                + defaultFont.getName()
                + "; font-size: "
                + defaultFont.getSize()
                + "pt;  }"
                + "a, p, li { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; font-family: "
                + defaultFont.getName()
                + "; font-size: "
                + defaultFont.getSize()
                + "pt;  }";
        if (area.getDocument() instanceof HTMLDocument) {
            HTMLDocument doc = (HTMLDocument)area.getDocument();
            try {
                doc.getStyleSheet().loadRules(new java.io.StringReader(stylesheet),
                        null);
            } catch (Exception e) {
                // TODO: handle exception
            }
        }
       
        detailsGroup.add(area);
       
        tpc.add(detailsGroup);
       
        add(new JScrollPane(tpc));
    }
View Full Code Here

        if (selectorComponent != null) return selectorComponent;
        return getSelectorComponent(demoSet);
    }
   
    private JComponent getSelectorComponent(List<Demo> demoSet) {
        JXTaskPaneContainer container = new JXTaskPaneContainer() {
            // Issue #1189-swingx: reasonable implementation of block increment
            @Override
            public int getScrollableBlockIncrement(Rectangle visibleRect,
                    int orientation, int direction) {
                return SwingConstants.VERTICAL == orientation ? visibleRect.height :
                    visibleRect.width;
            }
           
        };
        container.setLayout(new VerticalLayout(0));
        container.setBorder(BorderFactory.createEmptyBorder());
        for (Demo demo : demoSet) {
            String category = demo.getCategory();
            JXTaskPane taskPane = getTaskPane(category);
            if (taskPane == null) {
                taskPane = createTaskPane(demo);
                addTaskPane(taskPane, category);
                container.add(taskPane);
            }
            addDemo(taskPane, demo);
        }
        JScrollPane pane = new JScrollPane(container);
        return pane;
View Full Code Here

 
  JXTaskPaneContainer taskPaneContainer;


  public void createForm(){
    taskPaneContainer = new JXTaskPaneContainer() {
      public boolean getScrollableTracksViewportWidth() {
        return false;
      }
    };
    taskPaneContainer.setScrollableTracksViewportHeight(false);
View Full Code Here

    public class ScriptMenu {
//        private JTaskPane taskPane = new JTaskPane();
        private JXTaskPaneContainer taskPane;
       
        private ScriptMenu() {
            taskPane = new JXTaskPaneContainer();
            taskPane.applyComponentOrientation(getComponentOrientation());
        }
View Full Code Here

    getContentPane().removeAll();

    setTitle(view.getController().getModel().getName() + HelperString.COLON + HelperString.SPACE
        + localizer.getValue(HelperResource.RES_LABEL_TASK));

    final JXTaskPaneContainer containerTask = new JXTaskPaneContainer();

    for (final Entry<Worker, Task> pair : workers.entrySet()) {
      containerTask.add(createTaskPane(pair.getValue()));
    }

    getContentPane().add(new PaneScroll(containerTask));
    pack();
  }
View Full Code Here

        applet.add(splitCfgNModel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true), BorderLayout.CENTER);
        modelPanelSp = new JScrollPane();
        modelPanel = new ModelBrowser(_playerActions, _defaultAction, character, SpritesChar.HIGH, modelPanelSp, sw_state = new JLabel("No state"));
        modelPanel.setOnRefreshAction(action_customize_fileMask);
        splitCfgNModel.setRightComponent(modelPanelSp);
        JXTaskPaneContainer XContainer = new JXTaskPaneContainer();
        // controller panel
        JXPanel controller = new JXPanel(true);
        controller.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), "controller", TitledBorder.RIGHT, TitledBorder.TOP));
        controller.setLayout(new BorderLayout());
        statusBarPanel = new JPanel(true);
        statusBarPanel.setLayout(new GridBagLayout());
        GridBagConstraints cl = new GridBagConstraints();
        cl.fill = cl.BOTH;
        cl.weightx = cl.weighty = 1;
        cl.weightx = .5;
        statusBarPanel.add(statusBarLabel = new JLabel(UIMessage._getIcon(UIMessage.ENABLED_TYPE, false)), cl);
        cl.weightx = 1;
        statusBarPanel.add(statusBar = new JProgressMemory(0, 100), cl);
        JPanel ledPanel = new JPanel(new GridLayout(0, 1), true);
        ledPanel.add(rLed = new Led(Led.READ));
        ledPanel.add(wLed = new Led(Led.WRITE));
        cl.weightx = .5;
        statusBarPanel.add(ledPanel, cl);
        controller.add(statusBarPanel, BorderLayout.NORTH);
        ((JProgressMemory) statusBar).setLabels("CACHE", "HEAP", "");
        applet.add(controller, BorderLayout.SOUTH);        // config panel

        panel = new JXTaskPane();
        /*
         * panel.setCollapsed(false);
         */
        if (System.getProperty("os.name").startsWith("Linux")) {
            try {
                SpritesCacheManager.callback("setCollapsed", panel, new Object[]{false}, new Class[]{boolean.class});
            } catch (Exception e) {
                if (JXAenvUtils._debug) {
                    e.printStackTrace();
                }
            }
        } else {
            try {
                SpritesCacheManager.callback("setExpanded", panel, new Object[]{true}, new Class[]{boolean.class});
            } catch (Exception e) {
                if (JXAenvUtils._debug) {
                    e.printStackTrace();
                }
            }
        }

        XContainer.add(panel);
        // init data to config
        // maps config panel
        XContainer.add(modelPanel.panelMaps);
        XContainer.add(modelPanel.panelFX);
        // play panel
        JPanel panelPlay = new JPanel(new GridLayout(2, 0), true);
        final JXPanel paramFrame = new JXPanel(true);
        paramFrame.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), "Parameters config.", TitledBorder.RIGHT, TitledBorder.TOP));
        paramFrame.add(XContainer);
        viewerPanel = new JPanel(new BorderLayout(), true);
        viewerPanel.setPreferredSize(_iconSize);
        viewerPanel.add(new JLabel(UIMessage._getIcon(UIMessage.DROPTARGET_TYPE, false)), BorderLayout.CENTER);
        viewerPanel.validate();
        viewerPanel.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), "Let's drag'n'drop a Model here !", TitledBorder.LEFT, TitledBorder.TOP));
        DnDHandler dnd = new DnDHandler(this);
        dnd.addDropTarget(viewerPanel);
        JScrollPane sp2 = new JScrollPane(paramFrame);
        sp2.getHorizontalScrollBar().setUnitIncrement(30);
        sp2.getVerticalScrollBar().setUnitIncrement(30);
        splitAnimNCfg = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
        splitAnimNCfg.setBottomComponent(viewerPanel);
        splitAnimNCfg.setTopComponent(sp2);
        splitCfgNModel.setLeftComponent(splitAnimNCfg);
        splitAnimNCfg.setDividerLocation(500);
        panelPlay.add(sw_state);
        final AbstractAction action_play = new AbstractAction("(ALT+P)", UIMessage._getIcon(UIMessage.PLAYER_PLAY_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    if (animator instanceof javax.swing.Timer) {
                        if (!animator.isRunning()) {
                            animator.start();
                        }
                    } else {
                        animator = new javax.swing.Timer((int) character.getFrameRate(), new ActionListener() {

                            public void actionPerformed(ActionEvent e) {
                                if (modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD) instanceof JComponent) {
                                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                                    comp.paintImmediately(0, 0, comp.getWidth(), comp.getHeight());
                                }
                            }
                        });
                        animator.start();
                    }
                    anim.play();
                }

                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        };

        panelPlay.add(new JButton(action_play));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PAUSE_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        }));
        panelPlay.add(new JButton(modelPanel.action_playSfx));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_PREVIOUS_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.stop();
                    anim.rewind();
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }
                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
                sw_state.repaint();
            }
        }));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FB_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    anim.position(Math.max(0, anim.getPosition() - 1));
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
                sw_state.repaint();
            }
        }));
        panelPlay.add(new JButton(new AbstractAction("", UIMessage._getIcon(UIMessage.PLAYER_FF_TYPE, true)) {

            public void actionPerformed(ActionEvent e) {
                SortedMap<Integer, Animation> animations = character.accessSynchCache();
                Animation anim = animations.get(modelPanel.currentRecordKey.get(ModelAnimBrowser.CURRENTRECORDKEY));
                if (anim instanceof Animation) {
                    anim.pause();
                    anim.position(Math.min(anim.length() - 1, anim.getPosition() + 1));
                    JComponent comp = modelPanel.currentRecord.get(ModelAnimBrowser.CURRENTRECORD);
                    if (comp instanceof JComponent) {
                        comp.repaint();
                    }
                    if (animator instanceof javax.swing.Timer) {
                        if (animator.isRunning()) {
                            animator.stop();
                        }
                    }

                }
                sw_state.setText(ModelAnimBrowser.animationState(anim instanceof Animation ? anim.getState() : -1));
            }
        }));
        panelPlay.add(this.sw_refresh = new JButton("refresh", UIMessage._getIcon(UIMessage.REFRESH_TYPE, false)));
        sw_refresh.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent pe) {
                final ActionEvent e = pe;
                ThreadWorks.Swing.invokeLater(new Runnable() {

                    public void run() {
                        refreshSpot(e);
                    }
                });
            }
        });

        controller.add(panelPlay, BorderLayout.CENTER);
        // character customization params
        panel.add(action_switchResolution);

        panel.add(modelPanel.action_setBgColor);
        panel.add(new AbstractAction("load a demo/uncompleted model \n\r...") {

            public void actionPerformed(ActionEvent actionEvent) {
                Model s = getSpritesChar();
                if (s instanceof Model) {
                    character = s;
                    action_customize.actionPerformed(actionEvent);
                }
            }
        });
        panel.add(new AbstractAction("load the cache") {

            public void actionPerformed(ActionEvent e) {
                Runnable r = new Runnable() {

                    public void run() {
                        SpritesCacheManager<Integer, Animation> spm = character.accessCache();
                        spm.addSpritesCacheListener(scl);
                        character.addAccessAnimationCacheListener(rLed.getSpritesCacheAdapter());
                        character.addAccessAnimationCacheListener(wLed.getSpritesCacheAdapter());
                        character.loadResource();
                        spm.removeSpritesCacheListener(scl);
                        character.removeAccessAnimationCacheListener(rLed.getSpritesCacheAdapter());
                        character.removeAccessAnimationCacheListener(wLed.getSpritesCacheAdapter());
                    }
                };
                works.doLater(r);
            }
        });
        JXTaskPane panelCache = new JXTaskPane();
        if (System.getProperty("os.name").startsWith("Linux")) {
            try {
                SpritesCacheManager.callback("setCollapsed", panelCache, new Object[]{false}, new Class[]{boolean.class});
            } catch (Exception e) {
                if (JXAenvUtils._debug) {
                    e.printStackTrace();
                }
            }
        } else {
            try {
                SpritesCacheManager.callback("setExpanded", panelCache, new Object[]{true}, new Class[]{boolean.class});
            } catch (Exception e) {
                if (JXAenvUtils._debug) {
                    e.printStackTrace();
                }
            }
        }

        XContainer.add(panelCache);
        panelCache.setTitle("Cache");
        Action compressA;
        panelCache.add(compressA = new AbstractAction("compressed sprites") {

            public void actionPerformed(ActionEvent e) {
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.JXTaskPaneContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.