1 /*
2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
302 * @return x thickness.
303 */
304 int getXThickness() {
305 return xThickness;
306 }
307
308 /**
309 * Returns the Y thickness to use for this GTKStyle.
310 *
311 * @return y thickness.
312 */
313 int getYThickness() {
314 return yThickness;
315 }
316
317 /**
318 * Returns the Insets. If <code>insets</code> is non-null the resulting
319 * insets will be placed in it, otherwise a new Insets object will be
320 * created and returned.
321 *
322 * @param context SynthContext identifying requestor
323 * @param insets Where to place Insets
324 * @return Insets.
325 */
326 @Override
327 public Insets getInsets(SynthContext state, Insets insets) {
328 Region id = state.getRegion();
329 JComponent component = state.getComponent();
330 String name = (id.isSubregion()) ? null : component.getName();
331
332 if (insets == null) {
333 insets = new Insets(0, 0, 0, 0);
334 } else {
335 insets.top = insets.bottom = insets.left = insets.right = 0;
336 }
337
338 if (id == Region.ARROW_BUTTON || id == Region.BUTTON ||
339 id == Region.TOGGLE_BUTTON) {
340 if ("Spinner.previousButton" == name ||
341 "Spinner.nextButton" == name) {
342 return getSimpleInsets(state, insets, 1);
|
1 /*
2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
302 * @return x thickness.
303 */
304 int getXThickness() {
305 return xThickness;
306 }
307
308 /**
309 * Returns the Y thickness to use for this GTKStyle.
310 *
311 * @return y thickness.
312 */
313 int getYThickness() {
314 return yThickness;
315 }
316
317 /**
318 * Returns the Insets. If <code>insets</code> is non-null the resulting
319 * insets will be placed in it, otherwise a new Insets object will be
320 * created and returned.
321 *
322 * @param state SynthContext identifying requestor
323 * @param insets Where to place Insets
324 * @return Insets.
325 */
326 @Override
327 public Insets getInsets(SynthContext state, Insets insets) {
328 Region id = state.getRegion();
329 JComponent component = state.getComponent();
330 String name = (id.isSubregion()) ? null : component.getName();
331
332 if (insets == null) {
333 insets = new Insets(0, 0, 0, 0);
334 } else {
335 insets.top = insets.bottom = insets.left = insets.right = 0;
336 }
337
338 if (id == Region.ARROW_BUTTON || id == Region.BUTTON ||
339 id == Region.TOGGLE_BUTTON) {
340 if ("Spinner.previousButton" == name ||
341 "Spinner.nextButton" == name) {
342 return getSimpleInsets(state, insets, 1);
|