Package com.threerings.media

Examples of com.threerings.media.SafeScrollPane


        // tree- only let one thing be selected, and let us know when it haps
        _tsettree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        _tsettree.addTreeSelectionListener(this);

        // create a scrollpane to hold the tree
        SafeScrollPane scrolly = new SafeScrollPane(_tsettree);
        scrolly.setVerticalScrollBarPolicy(SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        DefaultListModel qmodel = new DefaultListModel();
        for (int ii=0; ii < 10; ii++) {
            qmodel.addElement("");
        }
        _quickList = new JList(qmodel);
        _quickList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        _quickList.addListSelectionListener(this);
        _quickList.setCellRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent (
                JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                // put the key number in front of each element
                Component result = super.getListCellRendererComponent(
                    list, value, index, isSelected, cellHasFocus);
                setText("" + ((index + 11) % 10) + ". " + getText());
                return result;
            }
        });
        JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        leftSplit.setTopComponent(new SafeScrollPane(_quickList));
        leftSplit.setBottomComponent(scrolly);

        // add the west side
        setLeftComponent(leftSplit);

        // create a table to display the tiles in the selected tileset
        _tiletable = new JTable(_tablemodel = new TileTableModel());
        _tiletable.getSelectionModel().addListSelectionListener(this);
        _tiletable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        updateTileTable();

        // wrap the table in a scrollpane for lengthy tilesets
        _scroller = new SafeScrollPane(_tiletable);
        _scroller.setVerticalScrollBarPolicy(SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        // add the tile table as the entire east side
        setRightComponent(_scroller);
View Full Code Here

TOP

Related Classes of com.threerings.media.SafeScrollPane

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.