Java Code Examples for javax.swing.JPanel#getTreeLock()

The following examples show how to use javax.swing.JPanel#getTreeLock() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadDialogPanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
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);
        }
    }
}
 
Example 2
Source File: EditorDisplayerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
    }
}
 
Example 3
Source File: EditableDisplayerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
    }
}
 
Example 4
Source File: CustomEditorDisplayerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
        }
    }
 
Example 5
Source File: NewPropertyPanelTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
    }
}