23 package com.realtime.crossfire.jxclient.skin.factory;
32 import java.awt.Color;
34 import java.awt.Image;
35 import java.util.ArrayList;
36 import java.util.Collection;
37 import org.jetbrains.annotations.NotNull;
38 import org.jetbrains.annotations.Nullable;
146 public DialogFactory(@NotNull
final Image
frameNW, @NotNull
final Image
frameN, @NotNull
final Image
frameNE, @NotNull
final Image
frameW, @NotNull
final Image
frameC, @NotNull
final Image
frameE, @NotNull
final Image
frameSW, @NotNull
final Image
frameS, @NotNull
final Image
frameSE, @NotNull
final Font
titleFont, @NotNull
final Color
titleColor, @NotNull
final Color
titleBackgroundColor,
final float frameAlpha, @NotNull
final GuiFactory guiFactory) {
158 if (frameAlpha < 0.0F || frameAlpha > 1.0F) {
159 throw new IllegalArgumentException(
"alpha transparency should be between 0 and 1 inclusive");
161 final int sizeN =
frameN.getHeight(
null);
162 final int sizeS =
frameS.getHeight(
null);
163 final int sizeW =
frameW.getWidth(
null);
164 final int sizeE =
frameE.getWidth(
null);
165 if (
frameNW.getHeight(
null) != sizeN) {
166 throw new IllegalArgumentException(
"height of NW ("+
frameNW.getHeight(
null)+
") does not match height of N ("+sizeN+
")");
168 if (
frameNE.getHeight(
null) != sizeN) {
169 throw new IllegalArgumentException(
"height of NE ("+
frameNE.getHeight(
null)+
") does not match height of N ("+sizeN+
")");
171 if (
frameSW.getHeight(
null) != sizeS) {
172 throw new IllegalArgumentException(
"height of SW ("+
frameSW.getHeight(
null)+
") does not match height of N ("+sizeS+
")");
174 if (
frameSE.getHeight(
null) != sizeS) {
175 throw new IllegalArgumentException(
"height of SE ("+
frameSE.getHeight(
null)+
") does not match height of N ("+sizeS+
")");
177 if (
frameNW.getWidth(
null) != sizeW) {
178 throw new IllegalArgumentException(
"width of NW ("+
frameNW.getWidth(
null)+
") does not match width of W");
180 if (
frameNE.getWidth(
null) != sizeE) {
181 throw new IllegalArgumentException(
"width of NE ("+
frameNE.getWidth(
null)+
") does not match width of E");
183 if (
frameSW.getWidth(
null) != sizeW) {
184 throw new IllegalArgumentException(
"width of SW ("+
frameSW.getWidth(
null)+
") does not match width of W");
186 if (
frameSE.getWidth(
null) != sizeE) {
187 throw new IllegalArgumentException(
"width of SE ("+
frameSE.getWidth(
null)+
") does not match width of E");
189 final int contentWidth =
frameC.getWidth(
null);
190 final int contentHeight =
frameC.getHeight(
null);
191 if (
frameN.getWidth(
null) != contentWidth) {
192 throw new IllegalArgumentException(
"width of N ("+
frameN.getWidth(
null)+
") does not match width of C ("+contentWidth+
")");
194 if (
frameS.getWidth(
null) != contentWidth) {
195 throw new IllegalArgumentException(
"width of S ("+
frameS.getWidth(
null)+
") does not match width of C ("+contentWidth+
")");
197 if (
frameW.getHeight(
null) != contentHeight) {
198 throw new IllegalArgumentException(
"width of W ("+
frameW.getHeight(
null)+
") does not match height of C ("+contentHeight+
")");
200 if (
frameE.getHeight(
null) != contentHeight) {
201 throw new IllegalArgumentException(
"width of E ("+
frameE.getHeight(
null)+
") does not match height of C ("+contentHeight+
")");
219 final Collection<AbstractGUIElement> result =
new ArrayList<>();
220 result.add(
new GUIDialogBackground(tooltipManager, windowRenderer, elementListener,
"dialog_background",
frameAlpha,
frameNW,
frameN,
frameNE,
frameW,
frameC,
frameE,
frameSW,
frameS,
frameSE,
guiFactory));
222 if (!title.isEmpty()) {