Java Code Examples for java.awt.Insets#equals()

The following examples show how to use java.awt.Insets#equals() . 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: Test6657026.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void test(Border border) {
    Insets actual = border.getBorderInsets(null);
    if (NEGATIVE.equals(actual)) {
        throw new Error("unexpected insets in " + border.getClass());
    }
    Insets expected = (Insets) actual.clone();
    // modify
    actual.top++;
    actual.left++;
    actual.right++;
    actual.bottom++;
    // validate
    if (!expected.equals(border.getBorderInsets(null))) {
        throw new Error("shared insets in " + border.getClass());
    }
}
 
Example 2
Source File: Test6657026.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void test(Border border) {
    Insets actual = border.getBorderInsets(null);
    if (NEGATIVE.equals(actual)) {
        throw new Error("unexpected insets in " + border.getClass());
    }
    Insets expected = (Insets) actual.clone();
    // modify
    actual.top++;
    actual.left++;
    actual.right++;
    actual.bottom++;
    // validate
    if (!expected.equals(border.getBorderInsets(null))) {
        throw new Error("shared insets in " + border.getClass());
    }
}
 
Example 3
Source File: Test6657026.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void test(Border border) {
    Insets actual = border.getBorderInsets(null);
    if (NEGATIVE.equals(actual)) {
        throw new Error("unexpected insets in " + border.getClass());
    }
    Insets expected = (Insets) actual.clone();
    // modify
    actual.top++;
    actual.left++;
    actual.right++;
    actual.bottom++;
    // validate
    if (!expected.equals(border.getBorderInsets(null))) {
        throw new Error("shared insets in " + border.getClass());
    }
}
 
Example 4
Source File: Test6657026.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void test(Border border) {
    Insets actual = border.getBorderInsets(null);
    if (NEGATIVE.equals(actual)) {
        throw new Error("unexpected insets in " + border.getClass());
    }
    Insets expected = (Insets) actual.clone();
    // modify
    actual.top++;
    actual.left++;
    actual.right++;
    actual.bottom++;
    // validate
    if (!expected.equals(border.getBorderInsets(null))) {
        throw new Error("shared insets in " + border.getClass());
    }
}
 
Example 5
Source File: InsetsEncapsulation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void test(final JComponent component) {
    final Insets p = component.getInsets();
    p.top += 3;
    if (p.equals(component.getInsets())) {
        throw new RuntimeException("Insets altered by altering Insets!");
    }
}
 
Example 6
Source File: InsetsEncapsulation.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void test(final JComponent component) {
    final Insets p = component.getInsets();
    p.top += 3;
    if (p.equals(component.getInsets())) {
        throw new RuntimeException("Insets altered by altering Insets!");
    }
}
 
Example 7
Source File: Test4856008.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Border border, Insets insets) {
    Insets result = border.getBorderInsets(getComponent(border));
    if (insets == result) {
        throw new Error("both instances are the same for " + border.getClass());
    }
    if (!insets.equals(result)) {
        throw new Error("both insets are not equal for " + border.getClass());
    }
}
 
Example 8
Source File: FullScreenInsets.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testInsets(final Insets actual, final Insets exp) {
    if (!actual.equals(exp)) {
        System.err.println(" Wrong window insets:" +
                           " Expected: " + exp + " Actual: " + actual);
        passed = false;
    }
}
 
Example 9
Source File: Test4856008.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Border border, Insets insets) {
    Insets result = border.getBorderInsets(getComponent(border));
    if (insets == result) {
        throw new Error("both instances are the same for " + border.getClass());
    }
    if (!insets.equals(result)) {
        throw new Error("both insets are not equal for " + border.getClass());
    }
}
 
Example 10
Source File: InsetsEncapsulation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void test(final JComponent component) {
    final Insets p = component.getInsets();
    p.top += 3;
    if (p.equals(component.getInsets())) {
        throw new RuntimeException("Insets altered by altering Insets!");
    }
}
 
Example 11
Source File: SynthSliderUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void recalculateIfInsetsChanged() {
    SynthContext context = getContext(slider);
    Insets newInsets = style.getInsets(context, null);
    Insets compInsets = slider.getInsets();
    newInsets.left += compInsets.left; newInsets.right += compInsets.right;
    newInsets.top += compInsets.top; newInsets.bottom += compInsets.bottom;
    if (!newInsets.equals(insetCache)) {
        insetCache = newInsets;
        calculateGeometry();
    }
    context.dispose();
}
 
Example 12
Source File: FullScreenInsets.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testInsets(final Insets actual, final Insets exp) {
    if (!actual.equals(exp)) {
        System.err.println(" Wrong window insets:" +
                           " Expected: " + exp + " Actual: " + actual);
        passed = false;
    }
}
 
Example 13
Source File: Test4856008.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Border border, Insets insets) {
    Insets result = border.getBorderInsets(getComponent(border));
    if (insets == result) {
        throw new Error("both instances are the same for " + border.getClass());
    }
    if (!insets.equals(result)) {
        throw new Error("both insets are not equal for " + border.getClass());
    }
}
 
Example 14
Source File: InsetsEncapsulation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void test(final JComponent component) {
    final Insets p = component.getInsets();
    p.top += 3;
    if (p.equals(component.getInsets())) {
        throw new RuntimeException("Insets altered by altering Insets!");
    }
}
 
Example 15
Source File: SynthSliderUI.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void recalculateIfInsetsChanged() {
    SynthContext context = getContext(slider);
    Insets newInsets = style.getInsets(context, null);
    Insets compInsets = slider.getInsets();
    newInsets.left += compInsets.left; newInsets.right += compInsets.right;
    newInsets.top += compInsets.top; newInsets.bottom += compInsets.bottom;
    if (!newInsets.equals(insetCache)) {
        insetCache = newInsets;
        calculateGeometry();
    }
    context.dispose();
}
 
Example 16
Source File: SynthSliderUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void recalculateIfInsetsChanged() {
    SynthContext context = getContext(slider);
    Insets newInsets = style.getInsets(context, null);
    Insets compInsets = slider.getInsets();
    newInsets.left += compInsets.left; newInsets.right += compInsets.right;
    newInsets.top += compInsets.top; newInsets.bottom += compInsets.bottom;
    if (!newInsets.equals(insetCache)) {
        insetCache = newInsets;
        calculateGeometry();
    }
    context.dispose();
}
 
Example 17
Source File: Test4856008.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Border border, Insets insets) {
    Insets result = border.getBorderInsets(getComponent(border));
    if (insets == result) {
        throw new Error("both instances are the same for " + border.getClass());
    }
    if (!insets.equals(result)) {
        throw new Error("both insets are not equal for " + border.getClass());
    }
}
 
Example 18
Source File: JMenuBar.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the margin between the menubar's border and
 * its menus. Setting to <code>null</code> will cause the menubar to
 * use the default margins.
 *
 * @param m an Insets object containing the margin values
 * @see Insets
 * @beaninfo
 *        bound: true
 *    attribute: visualUpdate true
 *  description: The space between the menubar's border and its contents
 */
public void setMargin(Insets m) {
    Insets old = margin;
    this.margin = m;
    firePropertyChange("margin", old, m);
    if (old == null || !old.equals(m)) {
        revalidate();
        repaint();
    }
}
 
Example 19
Source File: JMenuBar.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the margin between the menubar's border and
 * its menus. Setting to <code>null</code> will cause the menubar to
 * use the default margins.
 *
 * @param m an Insets object containing the margin values
 * @see Insets
 * @beaninfo
 *        bound: true
 *    attribute: visualUpdate true
 *  description: The space between the menubar's border and its contents
 */
public void setMargin(Insets m) {
    Insets old = margin;
    this.margin = m;
    firePropertyChange("margin", old, m);
    if (old == null || !old.equals(m)) {
        revalidate();
        repaint();
    }
}
 
Example 20
Source File: JMenuBar.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the margin between the menubar's border and
 * its menus. Setting to <code>null</code> will cause the menubar to
 * use the default margins.
 *
 * @param m an Insets object containing the margin values
 * @see Insets
 * @beaninfo
 *        bound: true
 *    attribute: visualUpdate true
 *  description: The space between the menubar's border and its contents
 */
public void setMargin(Insets m) {
    Insets old = margin;
    this.margin = m;
    firePropertyChange("margin", old, m);
    if (old == null || !old.equals(m)) {
        revalidate();
        repaint();
    }
}