Java Code Examples for javax.swing.JComponent.invalidate()

The following are Jave code examples for showing how to use invalidate() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Equella   File: ManagementDialog.java   View Source Code Vote up 6 votes
public void applyFlatterLaF(JComponent c)
{
	try
	{
		UIManager.setLookAndFeel(flatterLaF);
		SwingUtilities.updateComponentTreeUI(c);
		c.invalidate();
		c.updateUI();

		UIManager.setLookAndFeel(currentLaF);
	}
	catch( Exception ex )
	{
		LOGGER.error("Could not apply Flatter LaF to component: " + c.toString(), ex);
	}
}
 
Example 2
Project: jaer   File: ParameterControlPanel.java   View Source Code Vote up 5 votes
/** Set visibility of individual clazz controls; hides other filters.
 * @param visible true to show clazz parameter controls, false to hide this clazz's controls and to show all filters in chain.
 */
public void setControlsVisible(boolean visible) {
    controlsVisible = visible;
    setBorderActive(visible);
    for (JComponent p : controls) {
        p.setVisible(visible);
        p.invalidate();
    }

    invalidate();

}
 
Example 3
Project: incubator-netbeans   File: TabLayoutManager.java   View Source Code Vote up 4 votes
final void resizeContainer() {
    JComponent c = ( JComponent ) container.getParent();
    c.invalidate();
    c.revalidate();
    c.doLayout();
}
 
Example 4
Project: jaer   File: ControlPanel.java   View Source Code Vote up 4 votes
/** Set visibility of individual filter controls; hides other filters.
     * @param visible true to show filter parameter controls, false to hide this filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
//        getControllable().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        }
        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
//        if (!getControllable().isEnclosed() && c instanceof Window) {
//            if (c instanceof FilterFrame) {
//                // hide all filters except one that is being modified, *unless* we are an enclosed filter
//                FilterFrame<GeneralController> ff = (FilterFrame) c;
//                for (GeneralController f : ff.filterPanels) {
//                    if (f == this) {  // for us and if !visible
//                        f.setVisible(true); // always set us visible in chain since we are the one being touched
//                        continue;
//                    }
//
//                    f.setVisible(!visible); // hide / show other filters
//                }
//
//            }
//            ((Window) c).pack();
//        }

        if (c instanceof Window) {
            ((Window) c).pack();
        }
//        if(!getControllable().isEnclosed()){ // store last selected top level filter
//            if (visible) {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getControllable().getClass().toString());
//            } else {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
//            }
//        }
        showControlsToggleButton.setSelected(visible);
    }
 
Example 5
Project: jaer   File: ParameterBrowserPanel.java   View Source Code Vote up 4 votes
/** Set visibility of individual filter controls; hides other filters.
     * @param visible true to show filter parameter controls, false to hide this filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
//        getControllable().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        }
        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
//        if (!getControllable().isEnclosed() && c instanceof Window) {
//            if (c instanceof FilterFrame) {
//                // hide all filters except one that is being modified, *unless* we are an enclosed filter
//                FilterFrame<GeneralController> ff = (FilterFrame) c;
//                for (GeneralController f : ff.filterPanels) {
//                    if (f == this) {  // for us and if !visible
//                        f.setVisible(true); // always set us visible in chain since we are the one being touched
//                        continue;
//                    }
//
//                    f.setVisible(!visible); // hide / show other filters
//                }
//
//            }
//            ((Window) c).pack();
//        }

        if (c instanceof Window) {
            ((Window) c).pack();
        }
//        if(!getControllable().isEnclosed()){ // store last selected top level filter
//            if (visible) {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getControllable().getClass().toString());
//            } else {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
//            }
//        }
        showControlsToggleButton.setSelected(visible);
    }
 
Example 6
Project: jaer   File: FilterPanel.java   View Source Code Vote up 4 votes
/**
     * Set visibility of individual filter controls; hides other filters.
     *
     * @param visible true to show filter parameter controls, false to hide this
     * filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
        getFilter().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        boolean globalEnable = false; // For compatibility with new version
        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        } else if (c instanceof GlobalViewer) // Added for compatibility with multi-input mode
        {
            c = ((GlobalViewer) c).getFilterPane();
            globalEnable = true;

        }

        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
        if (!getFilter().isEnclosed() && ((c instanceof Window) || globalEnable)) {
            if (c instanceof FilterFrame) {
                // hide all filters except one that is being modified, *unless* we are an enclosed filter
                FilterFrame<FilterPanel> ff = (FilterFrame) c;
                for (FilterPanel f : ff.filterPanels) {
                    if (f == this) {  // for us and if !visible
                        f.setVisible(true); // always set us visible in chain since we are the one being touched
                        continue;
                    }

                    f.setVisible(!visible); // hide / show other filters
                }

            }
//            if (c instanceof Window) // Redundant
//                ((Window) c).pack();

        }

        if (controlPanel != null) {
            controlPanel.setVisible(visible);
        }

//        if (c instanceof Window) {
//            ((Window) c).pack();
//        }
        if (!getFilter().isEnclosed()) { // store last selected top level filter
            if (visible) {
                getFilter().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getFilter().getClass().toString());
            } else {
                getFilter().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
            }
        }

        if (visible) {
            // Show only controls.
            showControlsToggleButton.setSelected(true);
            showControlsToggleButton.setText("Back to filters list");
        } else {
            showControlsToggleButton.setSelected(false);
            showControlsToggleButton.setText("Controls");
        }
    }