Package org.jdesktop.swingx

Examples of org.jdesktop.swingx.JXTaskPane


  }

  protected JXTaskPane getTaskPaneEmployees() {
    if (taskPaneEmployees == null) {
      taskPaneEmployees = new JXTaskPane();
      this.springLayout.putConstraint(SpringLayout.NORTH, taskPaneEmployees, 7, SpringLayout.NORTH, getContentContainer());
      this.springLayout.putConstraint(SpringLayout.WEST, taskPaneEmployees, 7, SpringLayout.WEST, getContentContainer());
      taskPaneEmployees.setTitle("Employees");
    }
    return taskPaneEmployees;
View Full Code Here


    }
    return taskPaneEmployees;
  }
  protected JXTaskPane getTaskPaneExpansas() {
    if (taskPaneExpansas == null) {
      taskPaneExpansas = new JXTaskPane();
      this.springLayout.putConstraint(SpringLayout.NORTH, taskPaneExpansas, 6, SpringLayout.SOUTH, getTaskPaneEmployees());
      this.springLayout.putConstraint(SpringLayout.WEST, taskPaneExpansas, 0, SpringLayout.WEST, getTaskPaneEmployees());
      this.springLayout.putConstraint(SpringLayout.EAST, taskPaneExpansas, 108, SpringLayout.WEST, getContentContainer());
    }
    return taskPaneExpansas;
View Full Code Here

        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) {
                compress = (compress) ? false : true;
                character.setCompressionEnabled(compress);
                compress_str.setText((compress) ? "enabled" : "disabled");
            }
        });
        refreshProps.add(new AbstractAction("compress") {

            public void actionPerformed(ActionEvent e) {
                character.setCompressionEnabled(compress);
            }
        });
        panelCache.add(compress_str = new JLabel((compress) ? "enabled" : "disabled"));
        panelCache.add(new AbstractAction("cache debugger") {

            public void actionPerformed(ActionEvent e) {
                DebugMap._getInstance().setDebuggerEnabled(!DebugMap._getInstance().isDebuggerEnabled(SpritesCacheManager.class), SpritesCacheManager.class);
                debug_cache_str.setText(DebugMap._getInstance().isDebuggerEnabled(SpritesCacheManager.class) ? "enabled" : "disabled");
            }
        });
        panelCache.add(debug_cache_str = new JLabel(DebugMap._getInstance().isDebuggerEnabled(SpritesCacheManager.class) ? "enabled" : "disabled"));
        panelCache.add(new AbstractAction("render debugger") {

            public void actionPerformed(ActionEvent e) {
                DebugMap._getInstance().setDebugLevelEnabled(!DebugMap._getInstance().isDebugLevelEnabled(RenderingScene.DBUG_RENDER), RenderingScene.DBUG_RENDER);
                debug_render_str.setText(DebugMap._getInstance().isDebugLevelEnabled(RenderingScene.DBUG_RENDER) ? "enabled" : "disabled");
            }
        });
        panelCache.add(debug_render_str = new JLabel(DebugMap._getInstance().isDebugLevelEnabled(RenderingScene.DBUG_RENDER) ? "enabled" : "disabled"));
        panel.add(modelPanel.action_openLog);

        // customize frame dialog
        customizeFrame = new JFrame("Customize your Model !");
        customizePanel = new JPanel(new GridBagLayout(), true);
View Full Code Here

    _statisticPanel = new StatisticPanel();
    _graphicViewPanel = new DiagramPanel();
    _top10TablePanel = new Top10ListPanel();

    JXTaskPane p = new JXTaskPane("Statistik");
    p.add(_statisticPanel);
    p.setCollapsed(false);

    JXTaskPane p2 = new JXTaskPane("Diagramm");
    p2.add(_graphicViewPanel);
    p2.setCollapsed(true);

    JXTaskPane p3 = new JXTaskPane("Top 10 Liste");
    p3.add(_top10TablePanel);
    p3.setCollapsed(true);

    tpc.add(p);
    tpc.add(p2);
    tpc.add(p3);
View Full Code Here

//        private JTaskPaneGroup taskGroup;
        private JXTaskPane taskGroup;
       
        private ScriptGroup(String key) {
//            taskGroup = new JTaskPaneGroup();
            taskGroup = new JXTaskPane();
            taskGroup.applyComponentOrientation(getComponentOrientation());
            taskGroup.setFocusable(false);
            taskGroup.setRequestFocusEnabled(false);
            taskGroup.setTitle(AppLocal.getIntString(key));    
            taskGroup.setVisible(false); // Only groups with sons are visible.
View Full Code Here

         *      java.awt.Graphics, int, int, int, int)
         */
        public void paintBorder(Component c, Graphics g, int x, int y,
                int width, int height) {

            JXTaskPane group = (JXTaskPane) c;

            // calculate position of title and toggle controls
            int controlWidth = getTitleHeight(group) - 2 * getRoundHeight();
            int controlX = group.getWidth() - getTitleHeight(group);
            int controlY = getRoundHeight() - 1;
            int titleX = 3;
            int titleY = 0;
            int titleWidth = group.getWidth() - getTitleHeight(group) - 3;
            int titleHeight = getTitleHeight(group);

            if (!group.getComponentOrientation().isLeftToRight()) {
                controlX = group.getWidth() - controlX - controlWidth;
                titleX = group.getWidth() - titleX - titleWidth;
            }

            // paint the title background
            paintTitleBackground(group, g);

            // paint the the toggles
            paintExpandedControls(group, g, controlX, controlY, controlWidth,
                    controlWidth);

            // paint the title text and icon
            Color paintColor = getPaintColor(group);

            // focus painted same color as text
            if (group.hasFocus()) {
                paintFocus(g, paintColor, 3, 3, width - 6, getTitleHeight(group) - 6);
            }

            paintTitle(group, g, paintColor, titleX, titleY, titleWidth,
                    titleHeight);
View Full Code Here

         * will be calculated from font metrics instead of using internal preset height.
         * @return Current title height.
         */
        protected int getTitleHeight(Component c) {
            if (c instanceof JXTaskPane) {
                JXTaskPane taskPane = (JXTaskPane) c;
                Font font = taskPane.getFont();
                int height = titleHeight;
               
                if (font != null && !(font instanceof FontUIResource)) {
                    height = Math.max(height, taskPane.getFontMetrics(font).getHeight());
                }
               
                Icon icon = taskPane.getIcon();
               
                if (icon != null) {
                    height = Math.max(height, icon.getIconHeight() + 4);
                }
               
View Full Code Here

         return;
     
      // troubleshootings, by-passing
      if (true) return;
     
      final JXTaskPane tpeSource = (JXTaskPane) evt.getSource();
     
      javax.swing.SwingUtilities.invokeLater(new Runnable()
      {
            @Override
            public void run()
View Full Code Here

            continue;
        
         if (cmpCur == (Component) tpeExpanded)
            continue;
        
         JXTaskPane tpeCur = (JXTaskPane) cmpCur;
        
         if (tpeCur.isCollapsed())
            return;
        
         System.out.println(">> collapsing: " + tpeCur.getTitle());
         tpeCur.setCollapsed(true);
      }
   }
View Full Code Here

        taskPanePrincipal.add(new JXHyperlink(new SampleAction("Palabras clave", "Palabras clave y colores","claves")));
       
        taskPaneMenu.setTitle("Menus");
        taskPaneMenu.add(new JXHyperlink(new SampleAction("Men� explorador", "Edici�n del menu de usuario","menu")));
       
        JXTaskPane taskPaneAyuda = new JXTaskPane();
        taskPaneAyuda.setTitle("Ayuda");
        taskPaneAyuda.add(new JXHyperlink(new SampleAction("Menus", "Configuraci�n menus","help:Menus")) );
        taskPaneAyuda.add(new JXHyperlink(new SampleAction("Comandos", "Configuraci�n de comandos","help:Comandos")));
        taskPaneAyuda.add(new JXHyperlink(new SampleAction("About", "Ayuda sobre explorador","about")));
       
       
       
       
       
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.JXTaskPane

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.