Java Code Examples for javax.swing.plaf.ComponentUI#getPreferredSize()

The following examples show how to use javax.swing.plaf.ComponentUI#getPreferredSize() . 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: TextEditor.java    From groovy with Apache License 2.0 5 votes vote down vote up
public boolean getScrollableTracksViewportWidth() {
    boolean bool = super.getScrollableTracksViewportWidth();
    if (unwrapped) {
        Component parent = this.getParent();
        ComponentUI ui = this.getUI();
        int uiWidth = ui.getPreferredSize(this).width;
        bool = (parent == null) || (uiWidth < parent.getSize().width);
    }
    return bool;
}
 
Example 2
Source File: NonWrappingEditorPane.java    From darklaf with MIT License 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportWidth() {
    final Component parent = getParent();
    final ComponentUI ui = getUI();
    return parent == null || (ui.getPreferredSize(this).width <= parent.getSize().width);
}
 
Example 3
Source File: NonWrappingTextPane.java    From darklaf with MIT License 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportWidth() {
    final Component parent = getParent();
    final ComponentUI ui = getUI();
    return parent == null || (ui.getPreferredSize(this).width <= parent.getSize().width);
}
 
Example 4
Source File: NonWrappingTextArea.java    From darklaf with MIT License 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportWidth() {
    final Component parent = getParent();
    final ComponentUI ui = getUI();
    return parent == null || (ui.getPreferredSize(this).width <= parent.getSize().width);
}
 
Example 5
Source File: SourcePaper.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportWidth() {
	Component parent = getParent();
	ComponentUI ui = getUI();
	return parent != null ? (ui.getPreferredSize(this).width <= parent.getSize().width) : true;
}