Java Code Examples for java.awt.Adjustable#getVisibleAmount()

The following examples show how to use java.awt.Adjustable#getVisibleAmount() . 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: ScrollPaneWheelScroller.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 2
Source File: ScrollPaneWheelScroller.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 3
Source File: ScrollPaneWheelScroller.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 4
Source File: ScrollPaneWheelScroller.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 5
Source File: ScrollPaneWheelScroller.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 6
Source File: ScrollPaneWheelScroller.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 7
Source File: ScrollPaneWheelScroller.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 8
Source File: ScrollPaneWheelScroller.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 9
Source File: ScrollPaneWheelScroller.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 10
Source File: ScrollPaneWheelScroller.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 11
Source File: ScrollPaneWheelScroller.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 12
Source File: ScrollPaneWheelScroller.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 13
Source File: ScrollPaneWheelScroller.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 14
Source File: ScrollPaneWheelScroller.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void scrollAdjustable(Adjustable adj, int amount) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (adj == null) {
            log.fine("Assertion (adj != null) failed");
        }
        if (amount == 0) {
            log.fine("Assertion (amount != 0) failed");
        }
    }

    int current = adj.getValue();
    int upperLimit = adj.getMaximum() - adj.getVisibleAmount();
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("doScrolling by " + amount);
    }

    if (amount > 0 && current < upperLimit) { // still some room to scroll
                                              // down
        if (current + amount < upperLimit) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(upperLimit);
            return;
        }
    }
    else if (amount < 0 && current > adj.getMinimum()) { // still some room
                                                         // to scroll up
        if (current + amount > adj.getMinimum()) {
            adj.setValue(current + amount);
            return;
        }
        else {
            adj.setValue(adj.getMinimum());
            return;
        }
    }
}
 
Example 15
Source File: KTextEdit.java    From stendhal with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Check if a scroll bar is at its maximum value.
 *
 * @param bar scroll bar
 * @return <code>true</code> if the scrollbar is at its maximum value
 * 	location, <code>false</code>otherwise
 */
private boolean isAtMaximum(Adjustable bar) {
	return (bar.getValue() + bar.getVisibleAmount() >= bar.getMaximum());
}