getTreeLock ( )源码实例Demo

javax.swing.JPanel#getTreeLock ( )源码实例Demo

下面列出了javax.swing.JPanel#getTreeLock ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: magarena   文件: DownloadDialogPanel.java
private void doSetStyle(JPanel panel) {
    synchronized (panel.getTreeLock()) {
        for (Component c : panel.getComponents()) {
            if (c instanceof JPanel) {
                doSetStyle((JPanel) c);
            }
            c.setFocusable(false);
        }
        if (this != panel) {
            panel.setOpaque(false);
        }
    }
}
 
源代码2 项目: netbeans   文件: EditorDisplayerTest.java
protected void setUp() throws Exception {
    //            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
    //            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());
    
    try {
        if (setup) return;
        basicProp= new BasicProperty("basicProp", true);
        System.err.println("Created basicProp at " + System.currentTimeMillis() + " - " + basicProp);
        
        tags1 = new TagsProperty("tags1", true, new String[] {"What","is","the","meaning","of","life"});
        tags2 = new TagsProperty("tags2", true, new String[] {"Austrolopithecines","automatically","engender","every","one"});
        tags3 = new TagsProperty("tags3", true, new String[] {"Behold","the","power","of","cheese"});
        booleanProp = new BooleanProperty("booleanProp", true);
        customProp = new CustomProperty("CustomProp", true);
        customProp2 = new CustomProperty("CustomProp2", true);
        ExceptionProperty exProp = new ExceptionProperty("Exception prop", true);
        NumProperty numProp = new NumProperty("Int prop", true);
        EditableNumProperty edProp = new EditableNumProperty("Editable", true);
        
        
        // Create new BasicEditor
        te = new BasicEditor();
        ec = new EditorCustom();
        // Create new TNode
        tn = new TNode();
        
        System.err.println("Crating frame");
        jf = new JFrame();
        jf.getContentPane().setLayout(new BorderLayout());
        jp = new JPanel();
        jp.setLayout(new FlowLayout());
        jf.getContentPane().add(jp, BorderLayout.CENTER);
        jf.setLocation(20,20);
        jf.setSize(600, 200);
        
        synchronized (jp.getTreeLock()) {
            System.err.println("BasicProp = " + basicProp);
            
            basicRen = new EditorPropertyDisplayer(basicProp);
            tagsRen1 = new EditorPropertyDisplayer(tags1);
            tagsRen2 = new EditorPropertyDisplayer(tags2);
            tagsRen3 = new EditorPropertyDisplayer(tags3);
            boolRen = new EditorPropertyDisplayer(booleanProp);
            custRen = new EditorPropertyDisplayer(customProp);
            custRen2 = new EditorPropertyDisplayer(customProp2);
            exRen = new EditorPropertyDisplayer(exProp);
            numRen = new EditorPropertyDisplayer(numProp);
            edRen = new EditorPropertyDisplayer(edProp);
            
            tagsRen2.setRadioButtonMax(10);
            
            jp.add(basicRen);
            jp.add(tagsRen1);
            jp.add(tagsRen2);
            jp.add(tagsRen3);
            jp.add(boolRen);
            jp.add(custRen);
            jp.add(custRen2);
            jp.add(exRen);
            jp.add(numRen);
            jp.add(edRen);
        }
        
        System.err.println("Waiting for window");
        new WaitWindow(jf);  //block until window open
        System.err.println("Window shown");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        setup = true;
    }
}
 
源代码3 项目: netbeans   文件: EditableDisplayerTest.java
protected void setUp() throws Exception {
    
    //            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
    //            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());
    PropUtils.forceRadioButtons=false;
    try {
        //            if (setup) return;
        basicProp= new BasicProperty("basicProp", true);
        System.err.println("Created basicProp at " + System.currentTimeMillis() + " - " + basicProp);
        
        tags1 = new TagsProperty("tags1", true, new String[] {"What","is","the","meaning","of","life"});
        tags2 = new TagsProperty("tags2", true, new String[] {"Austrolopithecines","automatically","engender","every","one"});
        tags3 = new TagsProperty("tags3", true, new String[] {"Behold","the","power","of","cheese"});
        booleanProp = new BooleanProperty("booleanProp", true);
        customProp = new CustomProperty("CustomProp", true);
        customProp2 = new CustomProperty("CustomProp2", true);
        ExceptionProperty exProp = new ExceptionProperty("Exception prop", true);
        NumProperty numProp = new NumProperty("Int prop", true);
        EditableNumProperty edProp = new EditableNumProperty("Editable", true);
        stringProp = new StringProperty("stringProp",true);
        
        // Create new BasicEditor
        te = new BasicEditor();
        // Create new TNode
        tn = new TNode();
        
        System.err.println("Crating frame");
        jf = new JFrame();
        jf.getContentPane().setLayout(new BorderLayout());
        jp = new JPanel();
        jp.setLayout(new FlowLayout());
        jf.getContentPane().add(jp, BorderLayout.CENTER);
        jf.setLocation(20,20);
        jf.setSize(600, 200);
        
        synchronized (jp.getTreeLock()) {
            System.err.println("BasicProp = " + basicProp);
            
            basicRen = new EditablePropertyDisplayer(basicProp);
            tagsRen1 = new EditablePropertyDisplayer(tags1);
            tagsRen2 = new EditablePropertyDisplayer(tags2);
            tagsRen3 = new EditablePropertyDisplayer(tags3);
            boolRen = new EditablePropertyDisplayer(booleanProp);
            custRen = new EditablePropertyDisplayer(customProp);
            custRen2 = new EditablePropertyDisplayer(customProp2);
            exRen = new EditablePropertyDisplayer(exProp);
            numRen = new EditablePropertyDisplayer(numProp);
            edRen = new EditablePropertyDisplayer(edProp);
            stringRen = new EditablePropertyDisplayer(stringProp);
            
            tagsRen2.setRadioButtonMax(10);
            
            jp.add(basicRen);
            jp.add(tagsRen1);
            jp.add(tagsRen2);
            jp.add(tagsRen3);
            jp.add(boolRen);
            jp.add(custRen);
            jp.add(custRen2);
            jp.add(numRen);
            jp.add(edRen);
            jp.add(stringRen);
        }
        
        System.err.println("Waiting for window");
        new WaitWindow(jf);  //block until window open
        System.err.println("Window shown");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        setup = true;
    }
}
 
源代码4 项目: netbeans   文件: CustomEditorDisplayerTest.java
protected void setUp() throws Exception {
//            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
//            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());

        try {
            if (setup) return;
            basicProp= new BasicProperty("basicProp", true);
            fileProp= new FileProperty("FileProp", true);
            
            // Create new BasicEditor
            te = new BasicEditor();
            // Create new TNode
            tn = new TNode();

            System.err.println("Crating frame");
            jf = new JFrame();
            jf.getContentPane().setLayout(new BorderLayout());
            jp = new JPanel();
            jp.setLayout(new FlowLayout());
            jf.getContentPane().add(jp, BorderLayout.CENTER);
            jf.setLocation (20,20);
            jf.setSize (600, 200);

            synchronized (jp.getTreeLock()) {
                System.err.println("BasicProp = " + basicProp);

                basicRen = new CustomEditorDisplayer(basicProp);
                fileRen = new CustomEditorDisplayer(fileProp);

                
                jp.add(basicRen.getComponent());
                
                jp.add(fileRen.getComponent());
            }

            System.err.println("Waiting for window");
            new WaitWindow(jf);  //block until window open
            System.err.println("Window shown");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            setup = true;
        }
    }
 
源代码5 项目: netbeans   文件: NewPropertyPanelTest.java
protected void setUp() throws Exception {
    PropUtils.forceRadioButtons=false;
    
    
    try {
        if (setup) return;
        basicProp= new BasicProperty("basicProp", true);
        fileProp= new FileProperty("FileProp", true);
        tagsProp = new TagsProperty("TagsProp", true);
        stringProp = new StringProperty("StringProp", true);
        
        focusButton = new JButton("Somewhere over the rainbow");
        // Create new BasicEditor
        te = new BasicEditor();
        // Create new TNode
        tn = new TNode();

        System.err.println("Crating frame");
        jf = new JFrame();
        jf.getContentPane().setLayout(new BorderLayout());
        jp = new JPanel();
        jp.setLayout(new FlowLayout());
        jf.getContentPane().add(jp, BorderLayout.CENTER);
        jf.setLocation (20,20);
        jf.setSize (600, 600);

        synchronized (jp.getTreeLock()) {
            System.err.println("BasicProp = " + basicProp);

            customPanel = new PropertyPanel(basicProp);
            filePanel = new PropertyPanel(fileProp);
            tagsPanel = new PropertyPanel(tagsProp);
            stringPanel = new PropertyPanel(stringProp);
            
            tagsPanel.setBackground(Color.GREEN);
            
            filePanel.setBackground(Color.YELLOW);
            
            stringPanel.setBackground(Color.PINK);

            customPanel.setPreferences(PropertyPanel.PREF_CUSTOM_EDITOR);
            
            filePanel.setPreferences(PropertyPanel.PREF_CUSTOM_EDITOR);
            
            jp.add(customPanel);
            
            jp.add(filePanel);
            
            jp.add (focusButton);
            
            jp.add (stringPanel);
            
            jp.add (tagsPanel);
        }

        System.err.println("Waiting for window");
        new WaitWindow(jf);  //block until window open
        System.err.println("Window shown");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        setup = true;
    }
}