Package com.vlsolutions.swing.toolbars

Examples of com.vlsolutions.swing.toolbars.ToolBarContainer


        setJMenuBar(createMenuBar());
        workspace = new DockingDesktop("Marathon");
        workspace.addDockableSelectionListener(dockingListener);
        workspace.addDockableStateWillChangeListener(dockingListener);
        workspace.addDockableStateChangeListener(dockingListener);
        ToolBarContainer container = ToolBarContainer.createDefaultContainer(true, true, true, true);
        createToolBar(container);
        container.add(workspace, BorderLayout.CENTER);
        this.getContentPane().add(container, BorderLayout.CENTER);
        this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
        initStatusBar();
        initDesktop();
        setExitHook();
View Full Code Here


    private AttrTextPane textPane = new AttrTextPane();
    private Component component;

    public TextAreaOutput() {
        DockingUISettings.getInstance().installUI();
        ToolBarContainer container = ToolBarContainer.createDefaultContainer(true, false, false, false, FlowLayout.TRAILING);
        ToolBarPanel barPanel = container.getToolBarPanelAt(BorderLayout.NORTH);
        VLToolBar bar = new VLToolBar();
        JButton clear = UIUtils.createClearButton();
        clear.setToolTipText("Clear");
        clear.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textPane.clear();
            }
        });
        bar.add(clear);
        JButton export = UIUtils.createExportButton();
        export.setToolTipText("Export to a text file");
        export.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JFileChooser fileChooser = new JFileChooser();
                int dialog = fileChooser.showSaveDialog(component.getParent());
                if (dialog == JFileChooser.APPROVE_OPTION) {
                    File file = fileChooser.getSelectedFile();
                    if (file.exists()) {

                    }
                    try {
                        BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file));
                        stream.write(textPane.getText().getBytes());
                        stream.close();
                    } catch (FileNotFoundException e1) {
                        e1.printStackTrace();
                    } catch (IOException e2) {
                        e2.printStackTrace();
                    }
                }
            }
        });
        bar.add(export);
        barPanel.add(bar, new ToolBarConstraints());

        textPane.setSize(100, 100);
        textPane.setEditable(false);
        textPane.setEnabled(true);
        textPane.setName("output");
        container.add(new JScrollPane(textPane));
        component = container;
    }
View Full Code Here

        pack();
        setLocationRelativeTo(window);
    }

    private JComponent createTree() {
        ToolBarContainer treePanel = ToolBarContainer.createDefaultContainer(true, true, true, true, FlowLayout.RIGHT);
        treePanel.setBorder(new EtchedBorder());
        VLToolBar bar = new VLToolBar();
        JButton button = UIUtils.createExpandAllButton();
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                expandAll(tree, true);
            }
        });
        bar.add(button);
        button = UIUtils.createCollapseAllButton();
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                expandAll(tree, false);
            }
        });
        bar.add(button);
        button = UIUtils.createRefreshButton();
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Module module = window.refreshModuleFunctions();
                DefaultMutableTreeNode rootNode = module.createTreeNode(filterByWindowName.isSelected() ? windowName : null);
                DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
                model.setRoot(rootNode);
                root = module;
                expandAll(tree, true);
                tree.setSelectionRows(new int[] {});
                argumentPanel.removeAll();
            }
        });
        bar.add(button);
        treePanel.getToolBarPanelAt(BorderLayout.NORTH).add(bar, new ToolBarConstraints());
        filterByWindowName = new JCheckBox("Filter by window name", true);
        filterByWindowName.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                DefaultMutableTreeNode rootNode = root.refreshNode(filterByWindowName.isSelected() ? windowName : null);
                ((DefaultTreeModel) tree.getModel()).reload(rootNode);
                expandAll(tree, true);
                tree.setSelectionRows(new int[] {});
            }
        });
        treePanel.add(filterByWindowName, BorderLayout.SOUTH);
        tree = new JTree(root.createTreeNode(windowName));
        tree.setRootVisible(false);
        tree.getSelectionModel().addTreeSelectionListener(new FunctionNodeSelectionListener());
        tree.setCellRenderer(new FunctionNodeRenderer());
        expandAll(tree, true);
        treePanel.add(new JScrollPane(tree), BorderLayout.CENTER);
        return treePanel;
    }
View Full Code Here

TOP

Related Classes of com.vlsolutions.swing.toolbars.ToolBarContainer

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.