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

The following examples show how to use java.awt.Insets#clone() . 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 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 2
Source File: Test6657026.java    From jdk8u-dev-jdk 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 jdk8u-jdk 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 jdk8u_jdk 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: 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 6
Source File: Test6657026.java    From openjdk-8-source 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 7
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 8
Source File: Test6657026.java    From jdk8u-jdk 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 9
Source File: Test6657026.java    From openjdk-jdk9 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 10
Source File: Test6657026.java    From openjdk-jdk8u-backup 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 11
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 12
Source File: Test6657026.java    From jdk8u60 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 13
Source File: Test6657026.java    From dragonwell8_jdk 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 14
Source File: PrintLayout.java    From pumpernickel with MIT License 5 votes vote down vote up
/**
 * Sets the insets for the tiles on this page. This also validates the
 * imageable bounds of the paper, and adjusts them to allow for these
 * insets.
 */
public boolean setInsets(Insets insets) {
	if (this.insets.left == insets.left && this.insets.top == insets.top
			&& this.insets.bottom == insets.bottom
			&& this.insets.right == insets.right) {
		return false;
	}
	Insets oldInsets = this.insets;
	this.insets = (Insets) insets.clone();

	firePropertyChange(PROPERTY_INSETS, oldInsets, insets.clone());

	validateImageableBounds();
	return true;
}
 
Example 15
Source File: PrintLayout.java    From pumpernickel with MIT License 5 votes vote down vote up
public PrintLayout(int rows, int columns, PageFormat format, Insets i,
		int innerPadding, int[] flipPattern) {
	this.rows = rows;
	this.columns = columns;
	this.pageFormat = (PageFormat) format.clone();
	this.insets = (Insets) i.clone();
	this.innerPadding = innerPadding;
	this.flipPattern = new int[flipPattern.length];
	System.arraycopy(flipPattern, 0, this.flipPattern, 0,
			flipPattern.length);

	addPropertyChangeListener(new PropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent e) {
			String s = e.getPropertyName();
			if (s.equals(PROPERTY_HEADER) || s.equals(PROPERTY_WIDTH)
					|| s.equals(PROPERTY_INNER_PADDING)) {
				headerPaintable.define(header, (int) (getPaperWidth()
						- insets.left - insets.right));
			}
			if (s.equals(PROPERTY_FOOTER) || s.equals(PROPERTY_WIDTH)
					|| s.equals(PROPERTY_INNER_PADDING)) {
				footerPaintable.define(footer, (int) (getPaperWidth()
						- insets.left - insets.right));
			}
		}
	});
}
 
Example 16
Source File: PartialLineBorder.java    From pumpernickel with MIT License 4 votes vote down vote up
public PartialLineBorder(Paint p, Insets i) {
	this.p = p;
	this.i = (Insets) i.clone();
}
 
Example 17
Source File: BasicQOptionPaneUI.java    From pumpernickel with MIT License 4 votes vote down vote up
public Insets getInsets(QOptionPane pane, String key) {
	Insets n = ((Insets) pane.getClientProperty(key));
	if (n != null)
		return (Insets) n.clone();
	return readInsets(resourceBundle, key);
}
 
Example 18
Source File: StyledTabbedPaneUI.java    From stendhal with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Set the empty space at the sides of the tab label.
 *
 * @param margin margin width in pixels
 */
public void setTabLabelMargins(int margin) {
	tabInsets = (Insets) tabInsets.clone();
	tabInsets.left = margin;
	tabInsets.right = margin;
}
 
Example 19
Source File: PreferencePanel.java    From pumpernickel with MIT License 2 votes vote down vote up
/**
 * Define the insets used to pad the component buttons. <BR>
 * (This property is only used when more than 1 row is visible. If only 1
 * row is used, then the buttons are wrapped in a JToolBar, and the default
 * look-and-feel behavior for that toolbar is used.)
 */
public void setButtonInsets(Insets i) {
	buttonInsets = (Insets) i.clone();
	layoutHomePanel();
}
 
Example 20
Source File: PreferencePanel.java    From pumpernickel with MIT License 2 votes vote down vote up
/**
 * Define the insets used to pad the row labels. <BR>
 * (This property is only used when labels are visible, which only occurs
 * when there is more than 1 row.)
 */
public void setLabelInsets(Insets i) {
	labelInsets = (Insets) i.clone();
	layoutHomePanel();
}