Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/macosx/classes/com/apple/laf/AquaGroupBorder.java
41154 views
1
/*
2
* Copyright (c) 2011, 2012, 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
23
* questions.
24
*/
25
26
package com.apple.laf;
27
28
import java.awt.*;
29
30
import javax.swing.border.Border;
31
32
import apple.laf.JRSUIConstants.Widget;
33
34
import com.apple.laf.AquaUtilControlSize.*;
35
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
36
37
public abstract class AquaGroupBorder extends AquaBorder {
38
private static final RecyclableSingletonFromDefaultConstructor<? extends Border> tabbedPaneGroupBorder = new RecyclableSingletonFromDefaultConstructor<TabbedPane>(TabbedPane.class);
39
public static Border getTabbedPaneGroupBorder() {
40
return tabbedPaneGroupBorder.get();
41
}
42
43
private static final RecyclableSingletonFromDefaultConstructor<? extends Border> titleBorderGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titled>(Titled.class);
44
public static Border getBorderForTitledBorder() {
45
return titleBorderGroupBorder.get();
46
}
47
48
private static final RecyclableSingletonFromDefaultConstructor<? extends Border> titlelessGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titleless>(Titleless.class);
49
public static Border getTitlelessBorder() {
50
return titlelessGroupBorder.get();
51
}
52
53
protected AquaGroupBorder(final SizeVariant sizeVariant) {
54
super(new SizeDescriptor(sizeVariant));
55
painter.state.set(Widget.FRAME_GROUP_BOX);
56
}
57
58
public void paintBorder(final Component c, final Graphics g, int x, int y, int width, int height) {
59
// sg2d.setColor(Color.MAGENTA);
60
// sg2d.drawRect(x, y, width - 1, height - 1);
61
62
final Insets internalInsets = sizeVariant.insets;
63
x += internalInsets.left;
64
y += internalInsets.top;
65
width -= (internalInsets.left + internalInsets.right);
66
height -= (internalInsets.top + internalInsets.bottom);
67
68
painter.paint(g, c, x, y, width, height);
69
// sg2d.setColor(Color.ORANGE);
70
// sg2d.drawRect(x, y, width, height);
71
}
72
73
protected static class TabbedPane extends AquaGroupBorder {
74
public TabbedPane() {
75
super(new SizeVariant().alterMargins(8, 12, 8, 12).alterInsets(5, 5, 7, 5));
76
}
77
}
78
79
protected static class Titled extends AquaGroupBorder {
80
public Titled() {
81
super(new SizeVariant().alterMargins(16, 20, 16, 20).alterInsets(16, 5, 4, 5));
82
}
83
}
84
85
protected static class Titleless extends AquaGroupBorder {
86
public Titleless() {
87
super(new SizeVariant().alterMargins(8, 12, 8, 12).alterInsets(3, 5, 1, 5));
88
}
89
}
90
}
91
92