LnF.java
     1: //========================================================================================
     2: //  LnF.java
     3: //    en:Look and feel
     4: //    ja:ルックアンドフィール
     5: //  Copyright (C) 2003-2024 Makoto Kamada
     6: //
     7: //  This file is part of the XEiJ (X68000 Emulator in Java).
     8: //  You can use, modify and redistribute the XEiJ if the conditions are met.
     9: //  Read the XEiJ License for more details.
    10: //  https://stdkmd.net/xeij/
    11: //========================================================================================
    12: 
    13: package xeij;
    14: 
    15: import java.awt.*;  //BasicStroke,BorderLayout,BoxLayout,Color,Component,Container,Cursor,Desktop,Dimension,Font,Frame,Graphics,Graphics2D,GraphicsDevice,GraphicsEnvironment,GridLayout,Image,Insets,Paint,Point,Rectangle,RenderingHints,Robot,Shape,Stroke,TexturePaint,Toolkit
    16: import java.awt.image.*;  //BufferedImage,DataBuffer,DataBufferByte,DataBufferInt,IndexColorModel
    17: import java.lang.*;  //Boolean,Character,Class,Comparable,Double,Exception,Float,IllegalArgumentException,Integer,Long,Math,Number,Object,Runnable,SecurityException,String,StringBuilder,System
    18: import java.util.*;  //ArrayList,Arrays,Calendar,GregorianCalendar,HashMap,Map,Map.Entry,Timer,TimerTask,TreeMap
    19: import javax.swing.*;  //AbstractSpinnerModel,Box,ButtonGroup,DefaultListModel,ImageIcon,JButton,JCheckBox,JCheckBoxMenuItem,JDialog,JFileChooser,JFrame,JLabel,JList,JMenu,JMenuBar,JMenuItem,JPanel,JRadioButton,JScrollPane,JSpinner,JTextArea,JTextField,JTextPane,JViewport,ScrollPaneConstants,SpinnerListModel,SpinnerNumberModel,SwingConstants,SwingUtilities,UIManager,UIDefaults,UnsupportedLookAndFeelException
    20: import javax.swing.plaf.*;  //ColorUIResource,FontUIResource,IconUIResource,InsetsUIResource
    21: import javax.swing.plaf.metal.*;  //MetalLookAndFeel,MetalTheme,OceanTheme
    22: 
    23: public class LnF {
    24: 
    25:   //色
    26:   //  (0,y0),(7,y7),(14,y14)を通る2次関数
    27:   //  y=(y0-2*y7+y14)/98*x^2+(-3*y0+4*y7-y14)/14*x+y0
    28:   public static final int[][] LNF_HSB_INTERPOLATION_TABLE = {
    29:     { 49, 0, 0 },  //x0=(49*y0)/49
    30:     { 39, 13, -3 },  //x1=(39*y0+13*y7-3*y14)/49
    31:     { 30, 24, -5 },  //x2=(30*y0+24*y7-5*y14)/49
    32:     { 22, 33, -6 },  //x3=(22*y0+33*y7-6*y14)/49
    33:     { 15, 40, -6 },  //x4=(15*y0+40*y7-6*y14)/49
    34:     { 9, 45, -5 },  //x5=(9*y0+45*y7-5*y14)/49
    35:     { 4, 48, -3 },  //x6=(4*y0+48*y7-3*y14)/49
    36:     { 0, 49, 0 },  //x7=(49*y7)/49
    37:     { -3, 48, 4 },  //x8=(-3*y0+48*y7+4*y14)/49
    38:     { -5, 45, 9 },  //x9=(-5*y0+45*y7+9*y14)/49
    39:     { -6, 40, 15 },  //x10=(-6*y0+40*y7+15*y14)/49
    40:     { -6, 33, 22 },  //x11=(-6*y0+33*y7+22*y14)/49
    41:     { -5, 24, 30 },  //x12=(-5*y0+24*y7+30*y14)/49
    42:     { -3, 13, 39 },  //x13=(-3*y0+13*y7+39*y14)/49
    43:     { 0, 0, 49 },  //x14=(49*y14)/49
    44:   };
    45:   public static final int[] LNF_DEFAULT_HSB = { 240, 240, 240, 70, 50, 30, 0, 50, 100 };
    46:   public static final int[] lnfHSB = new int[9];  //h0,h7,h14,s0,s7,s14,b0,b7,b14
    47:   public static final int[] lnfRGB = new int[15];  //rgb0,...,rgb14
    48:   public static ColorUIResource lnfSecondary3;
    49:   public static ColorUIResource lnfWhite;
    50:   public static ColorUIResource lnfPrimary3;
    51:   public static ColorUIResource lnfPrimary2;
    52:   public static ColorUIResource lnfSecondary2;
    53:   public static ColorUIResource lnfPrimary1;
    54:   public static ColorUIResource lnfSecondary1;
    55:   public static ColorUIResource lnfBlack;
    56: 
    57:   //フォント
    58:   public static int lnfFontSizeRequest;
    59:   public static int lnfFontSize;
    60:   public static String[] lnfAvailableFontFamilyNames;
    61:   public static String lnfMonospacedFamily;
    62:   public static Font lnfMonospacedFont;
    63:   public static Font lnfMonospacedFont12;
    64:   public static FontUIResource lnfControlTextFontUIResource;
    65:   public static FontUIResource lnfMenuTextFontUIResource;
    66:   public static FontUIResource lnfSubTextFontUIResource;
    67:   public static FontUIResource lnfSystemTextFontUIResource;
    68:   public static FontUIResource lnfUserTextFontUIResource;
    69:   public static FontUIResource lnfWindowTitleFontUIResource;
    70: 
    71:   //アイコン
    72:   //  Xマークが左右にはみ出しているイメージ
    73:   //  perl misc/favicon.pl
    74:   public static final BufferedImage LNF_ICON_IMAGE_16 = XEiJ.createImage (
    75:     16, 16,
    76:     "................" +
    77:     "1111111111.11111" +
    78:     "1........1..1..." +
    79:     ".1........1.1..." +
    80:     ".1........1..1.." +
    81:     "..1........1.1.1" +
    82:     "..1........1..1." +
    83:     "...1........1..." +
    84:     "...1........1..." +
    85:     ".1..1........1.." +
    86:     "1.1.1........1.." +
    87:     "..1..1........1." +
    88:     "...1.1........1." +
    89:     "...1..1........1" +
    90:     "11111.1111111111" +
    91:     "................",
    92:     0xff000000,
    93:     0xffffff00
    94:     );
    95:   public static final BufferedImage LNF_ICON_IMAGE_32 = XEiJ.createImage (
    96:     32, 32,
    97:     "................................" +
    98:     "................................" +
    99:     "1111111111111111111...1111111111" +
   100:     "11111111111111111111..1111111111" +
   101:     "11................11...11......." +
   102:     ".11................11..111......" +
   103:     ".11................11...11......" +
   104:     "..11................11..111....." +
   105:     "..11................11...11....." +
   106:     "...11................11..111...1" +
   107:     "...11................11...11..11" +
   108:     "....11................11..111111" +
   109:     "....11................11...1111." +
   110:     ".....11................11..111.." +
   111:     ".....11................11...1..." +
   112:     "......11................11......" +
   113:     "......11................11......" +
   114:     "...1...11................11....." +
   115:     "..111..11................11....." +
   116:     ".1111...11................11...." +
   117:     "111111..11................11...." +
   118:     "11..11...11................11..." +
   119:     "1...111..11................11..." +
   120:     ".....11...11................11.." +
   121:     ".....111..11................11.." +
   122:     "......11...11................11." +
   123:     "......111..11................11." +
   124:     ".......11...11................11" +
   125:     "1111111111..11111111111111111111" +
   126:     "1111111111...1111111111111111111" +
   127:     "................................" +
   128:     "................................",
   129:     0xff000000,
   130:     0xffffff00
   131:     );
   132:   public static final BufferedImage LNF_ICON_IMAGE_48 = XEiJ.createImage (
   133:     48, 48,
   134:     "................................................" +
   135:     "................................................" +
   136:     "................................................" +
   137:     "11111111111111111111111111111....111111111111111" +
   138:     "11111111111111111111111111111....111111111111111" +
   139:     "111111111111111111111111111111....11111111111111" +
   140:     "111........................111....1111.........." +
   141:     "1111........................111....111.........." +
   142:     ".111........................111....1111........." +
   143:     ".1111........................111....111........." +
   144:     "..111........................111....1111........" +
   145:     "..1111........................111....111........" +
   146:     "...111........................111....1111......." +
   147:     "...1111........................111....111......." +
   148:     "....111........................111....1111.....1" +
   149:     "....1111........................111....111....11" +
   150:     ".....111........................111....1111..111" +
   151:     ".....1111........................111....11111111" +
   152:     "......111........................111....1111111." +
   153:     "......1111........................111....11111.." +
   154:     ".......111........................111....1111..." +
   155:     ".......1111........................111....11...." +
   156:     "........111........................111....1....." +
   157:     "........1111........................111........." +
   158:     ".........111........................111........." +
   159:     ".....1...1111........................111........" +
   160:     "....11....111........................111........" +
   161:     "...1111...1111........................111......." +
   162:     "..11111....111........................111......." +
   163:     ".1111111...1111........................111......" +
   164:     "11111111....111........................111......" +
   165:     "111..1111...1111........................111....." +
   166:     "11....111....111........................111....." +
   167:     "1.....1111...1111........................111...." +
   168:     ".......111....111........................111...." +
   169:     ".......1111...1111........................111..." +
   170:     "........111....111........................111..." +
   171:     "........1111...1111........................111.." +
   172:     ".........111....111........................111.." +
   173:     ".........1111...1111........................111." +
   174:     "..........111....111........................111." +
   175:     "..........1111...1111........................111" +
   176:     "11111111111111....111111111111111111111111111111" +
   177:     "111111111111111...111111111111111111111111111111" +
   178:     "111111111111111....11111111111111111111111111111" +
   179:     "................................................" +
   180:     "................................................" +
   181:     "................................................",
   182:     0xff000000,
   183:     0xffffff00
   184:     );
   185:   public static final BufferedImage[] LNF_ICON_IMAGES = {
   186:     LNF_ICON_IMAGE_16,
   187:     LNF_ICON_IMAGE_32,
   188:     LNF_ICON_IMAGE_48,
   189:   };
   190: 
   191:   //アイコンのパターンとイメージ
   192:   public static final String[] LNF_NUMBER_PATTERN_ARRAY = {
   193:     (
   194:       "22222222222222" +
   195:       "2............2" +
   196:       "2.1111111111.2" +
   197:       "2.1111111111.2" +
   198:       "2.11......11.2" +
   199:       "2.11......11.2" +
   200:       "2.11......11.2" +
   201:       "2.11......11.2" +
   202:       "2.11......11.2" +
   203:       "2.11......11.2" +
   204:       "2.1111111111.2" +
   205:       "2.1111111111.2" +
   206:       "2............2" +
   207:       "22222222222222"),
   208:     (
   209:       "22222222222222" +
   210:       "2............2" +
   211:       "2.....11.....2" +
   212:       "2.....11.....2" +
   213:       "2.....11.....2" +
   214:       "2.....11.....2" +
   215:       "2.....11.....2" +
   216:       "2.....11.....2" +
   217:       "2.....11.....2" +
   218:       "2.....11.....2" +
   219:       "2.....11.....2" +
   220:       "2.....11.....2" +
   221:       "2............2" +
   222:       "22222222222222"),
   223:     (
   224:       "22222222222222" +
   225:       "2............2" +
   226:       "2.1111111111.2" +
   227:       "2.1111111111.2" +
   228:       "2.........11.2" +
   229:       "2.........11.2" +
   230:       "2.1111111111.2" +
   231:       "2.1111111111.2" +
   232:       "2.11.........2" +
   233:       "2.11.........2" +
   234:       "2.1111111111.2" +
   235:       "2.1111111111.2" +
   236:       "2............2" +
   237:       "22222222222222"),
   238:     (
   239:       "22222222222222" +
   240:       "2............2" +
   241:       "2.1111111111.2" +
   242:       "2.1111111111.2" +
   243:       "2.........11.2" +
   244:       "2.........11.2" +
   245:       "2.1111111111.2" +
   246:       "2.1111111111.2" +
   247:       "2.........11.2" +
   248:       "2.........11.2" +
   249:       "2.1111111111.2" +
   250:       "2.1111111111.2" +
   251:       "2............2" +
   252:       "22222222222222"),
   253:     (
   254:       "22222222222222" +
   255:       "2............2" +
   256:       "2.11......11.2" +
   257:       "2.11......11.2" +
   258:       "2.11......11.2" +
   259:       "2.11......11.2" +
   260:       "2.1111111111.2" +
   261:       "2.1111111111.2" +
   262:       "2.........11.2" +
   263:       "2.........11.2" +
   264:       "2.........11.2" +
   265:       "2.........11.2" +
   266:       "2............2" +
   267:       "22222222222222"),
   268:     (
   269:       "22222222222222" +
   270:       "2............2" +
   271:       "2.1111111111.2" +
   272:       "2.1111111111.2" +
   273:       "2.11.........2" +
   274:       "2.11.........2" +
   275:       "2.1111111111.2" +
   276:       "2.1111111111.2" +
   277:       "2.........11.2" +
   278:       "2.........11.2" +
   279:       "2.1111111111.2" +
   280:       "2.1111111111.2" +
   281:       "2............2" +
   282:       "22222222222222"),
   283:     (
   284:       "22222222222222" +
   285:       "2............2" +
   286:       "2.1111111111.2" +
   287:       "2.1111111111.2" +
   288:       "2.11.........2" +
   289:       "2.11.........2" +
   290:       "2.1111111111.2" +
   291:       "2.1111111111.2" +
   292:       "2.11......11.2" +
   293:       "2.11......11.2" +
   294:       "2.1111111111.2" +
   295:       "2.1111111111.2" +
   296:       "2............2" +
   297:       "22222222222222"),
   298:     (
   299:       "22222222222222" +
   300:       "2............2" +
   301:       "2.1111111111.2" +
   302:       "2.1111111111.2" +
   303:       "2.........11.2" +
   304:       "2.........11.2" +
   305:       "2.........11.2" +
   306:       "2.........11.2" +
   307:       "2.........11.2" +
   308:       "2.........11.2" +
   309:       "2.........11.2" +
   310:       "2.........11.2" +
   311:       "2............2" +
   312:       "22222222222222"),
   313:     (
   314:       "22222222222222" +
   315:       "2............2" +
   316:       "2.1111111111.2" +
   317:       "2.1111111111.2" +
   318:       "2.11......11.2" +
   319:       "2.11......11.2" +
   320:       "2.1111111111.2" +
   321:       "2.1111111111.2" +
   322:       "2.11......11.2" +
   323:       "2.11......11.2" +
   324:       "2.1111111111.2" +
   325:       "2.1111111111.2" +
   326:       "2............2" +
   327:       "22222222222222"),
   328:     (
   329:       "22222222222222" +
   330:       "2............2" +
   331:       "2.1111111111.2" +
   332:       "2.1111111111.2" +
   333:       "2.11......11.2" +
   334:       "2.11......11.2" +
   335:       "2.1111111111.2" +
   336:       "2.1111111111.2" +
   337:       "2.........11.2" +
   338:       "2.........11.2" +
   339:       "2.1111111111.2" +
   340:       "2.1111111111.2" +
   341:       "2............2" +
   342:       "22222222222222"),
   343:     (
   344:       "22222222222222" +
   345:       "2............2" +
   346:       "2.11.1111111.2" +
   347:       "2.11.1111111.2" +
   348:       "2.11.11...11.2" +
   349:       "2.11.11...11.2" +
   350:       "2.11.11...11.2" +
   351:       "2.11.11...11.2" +
   352:       "2.11.11...11.2" +
   353:       "2.11.11...11.2" +
   354:       "2.11.1111111.2" +
   355:       "2.11.1111111.2" +
   356:       "2............2" +
   357:       "22222222222222"),
   358:     (
   359:       "22222222222222" +
   360:       "2............2" +
   361:       "2..11....11..2" +
   362:       "2..11....11..2" +
   363:       "2..11....11..2" +
   364:       "2..11....11..2" +
   365:       "2..11....11..2" +
   366:       "2..11....11..2" +
   367:       "2..11....11..2" +
   368:       "2..11....11..2" +
   369:       "2..11....11..2" +
   370:       "2..11....11..2" +
   371:       "2............2" +
   372:       "22222222222222"),
   373:     (
   374:       "22222222222222" +
   375:       "2............2" +
   376:       "2.11.1111111.2" +
   377:       "2.11.1111111.2" +
   378:       "2.11......11.2" +
   379:       "2.11......11.2" +
   380:       "2.11.1111111.2" +
   381:       "2.11.1111111.2" +
   382:       "2.11.11......2" +
   383:       "2.11.11......2" +
   384:       "2.11.1111111.2" +
   385:       "2.11.1111111.2" +
   386:       "2............2" +
   387:       "22222222222222"),
   388:     (
   389:       "22222222222222" +
   390:       "2............2" +
   391:       "2.11.1111111.2" +
   392:       "2.11.1111111.2" +
   393:       "2.11......11.2" +
   394:       "2.11......11.2" +
   395:       "2.11.1111111.2" +
   396:       "2.11.1111111.2" +
   397:       "2.11......11.2" +
   398:       "2.11......11.2" +
   399:       "2.11.1111111.2" +
   400:       "2.11.1111111.2" +
   401:       "2............2" +
   402:       "22222222222222"),
   403:     (
   404:       "22222222222222" +
   405:       "2............2" +
   406:       "2.11.11...11.2" +
   407:       "2.11.11...11.2" +
   408:       "2.11.11...11.2" +
   409:       "2.11.11...11.2" +
   410:       "2.11.1111111.2" +
   411:       "2.11.1111111.2" +
   412:       "2.11......11.2" +
   413:       "2.11......11.2" +
   414:       "2.11......11.2" +
   415:       "2.11......11.2" +
   416:       "2............2" +
   417:       "22222222222222"),
   418:     (
   419:       "22222222222222" +
   420:       "2............2" +
   421:       "2.11.1111111.2" +
   422:       "2.11.1111111.2" +
   423:       "2.11.11......2" +
   424:       "2.11.11......2" +
   425:       "2.11.1111111.2" +
   426:       "2.11.1111111.2" +
   427:       "2.11......11.2" +
   428:       "2.11......11.2" +
   429:       "2.11.1111111.2" +
   430:       "2.11.1111111.2" +
   431:       "2............2" +
   432:       "22222222222222"),
   433:   };
   434:   public static final Image[] LNF_NUMBER_IMAGE_ARRAY = new Image[LNF_NUMBER_PATTERN_ARRAY.length];
   435:   public static final Image[] LNF_NUMBER_SELECTED_IMAGE_ARRAY = new Image[LNF_NUMBER_PATTERN_ARRAY.length];
   436: 
   437:   public static final String LNF_EJECT_PATTERN = (
   438:     ".............." +
   439:     "......11......" +
   440:     ".....1..1....." +
   441:     "....1....1...." +
   442:     "...1......1..." +
   443:     "..1........1.." +
   444:     ".1..........1." +
   445:     ".1..........1." +
   446:     ".111111111111." +
   447:     ".............." +
   448:     ".111111111111." +
   449:     ".1..........1." +
   450:     ".1..........1." +
   451:     ".111111111111.");
   452:   public static Image LNF_EJECT_IMAGE;
   453:   public static Image LNF_EJECT_DISABLED_IMAGE;
   454: 
   455:   public static final String LNF_OPEN_PATTERN = (
   456:     "...11111111111" +
   457:     "...1.........1" +
   458:     "...1.........1" +
   459:     "11111111111..1" +
   460:     "1.........1..1" +
   461:     "1.........1..1" +
   462:     "1.........1..1" +
   463:     "1.........1..1" +
   464:     "1.........1..1" +
   465:     "1.........1..1" +
   466:     "1.........1111" +
   467:     "1.........1..." +
   468:     "1.........1..." +
   469:     "11111111111...");
   470:   public static Image LNF_OPEN_IMAGE;
   471:   public static Image LNF_OPEN_DISABLED_IMAGE;
   472: 
   473:   public static final String LNF_PROTECT_PATTERN = (
   474:     "11111111111111" +
   475:     "1............1" +
   476:     "1..........111" +
   477:     "1..........1.." +
   478:     "1..........1.." +
   479:     "1.....11...111" +
   480:     "1....1..1....1" +
   481:     "1....1..1....1" +
   482:     "1.....11.....1" +
   483:     "1.....11.....1" +
   484:     "1.....11.....1" +
   485:     "1.....11.....1" +
   486:     "1.....11.....1" +
   487:     "11111111111111");
   488:   public static Image LNF_PROTECT_IMAGE;
   489:   public static Image LNF_PROTECT_DISABLED_IMAGE;
   490: 
   491:   public static final String LNF_PROTECT_SELECTED_PATTERN = (
   492:     "11111111111111" +
   493:     "1............1" +
   494:     "1............1" +
   495:     "1............1" +
   496:     "1............1" +
   497:     "1.....11.....1" +
   498:     "1....1..1....1" +
   499:     "1....1..1....1" +
   500:     "1.....11.....1" +
   501:     "1.....11.....1" +
   502:     "1.....11.....1" +
   503:     "1.....11.....1" +
   504:     "1.....11.....1" +
   505:     "11111111111111");
   506:   public static Image LNF_PROTECT_SELECTED_IMAGE;
   507:   public static Image LNF_PROTECT_DISABLED_SELECTED_IMAGE;
   508: 
   509:   public static final String LNF_HD_PATTERN = (
   510:     ".............." +
   511:     "....111111...." +
   512:     ".111......111." +
   513:     "1............1" +
   514:     "1............1" +
   515:     ".111......111." +
   516:     "1...111111...1" +
   517:     "1............1" +
   518:     ".111......111." +
   519:     "1...111111...1" +
   520:     "1............1" +
   521:     ".111......111." +
   522:     "....111111...." +
   523:     "..............");
   524:   public static ImageIcon LNF_HD_ICON;
   525:   public static ImageIcon LNF_HD_DISABLED_ICON;
   526: 
   527:   public static final String LNF_MO_PATTERN = (
   528:     "...11111111111" +
   529:     "..1..........1" +
   530:     ".1...1111....1" +
   531:     "1...1....1...1" +
   532:     "1..1......1..1" +
   533:     "1.1...11...1.1" +
   534:     "1.1..1..1..1.1" +
   535:     "1.1..1..1..1.1" +
   536:     "1.1...11...1.1" +
   537:     "1..1......1..1" +
   538:     "1...1....1...1" +
   539:     "1....1111....1" +
   540:     "1............1" +
   541:     "11111111111111");
   542:   public static ImageIcon LNF_MO_ICON;
   543:   public static ImageIcon LNF_MO_DISABLED_ICON;
   544: 
   545:   public static final String LNF_CD_PATTERN = (
   546:     ".....1111....." +
   547:     "...11....11..." +
   548:     "..1........1.." +
   549:     ".1..........1." +
   550:     ".1....11....1." +
   551:     "1....1..1....1" +
   552:     "1...1....1...1" +
   553:     "1...1....1...1" +
   554:     "1....1..1....1" +
   555:     ".1....11....1." +
   556:     ".1..........1." +
   557:     "..1........1.." +
   558:     "...11....11..." +
   559:     ".....1111.....");
   560:   public static ImageIcon LNF_CD_ICON;
   561:   public static ImageIcon LNF_CD_DISABLED_ICON;
   562: 
   563:   public static final String LNF_BREAK_PATTERN = (
   564:     "11111111111111111111" +
   565:     "1..................1" +
   566:     "1....11......11....1" +
   567:     "1....111....111....1" +
   568:     "1.....111..111.....1" +
   569:     "1......111111......1" +
   570:     "1.......1111.......1" +
   571:     "1.......1111.......1" +
   572:     "1......111111......1" +
   573:     "1.....111..111.....1" +
   574:     "1....111....111....1" +
   575:     "1....11......11....1" +
   576:     "1..................1" +
   577:     "11111111111111111111"
   578:     );
   579:   public static Image LNF_BREAK_IMAGE;
   580:   public static Image LNF_BREAK_DISABLED_IMAGE;
   581: 
   582:   public static final String LNF_TRACE_PATTERN = (
   583:     "11111111111111111111" +
   584:     "1..................1" +
   585:     "1..................1" +
   586:     "1....11111.........1" +
   587:     "1....11111.........1" +
   588:     "1.......11.........1" +
   589:     "1.......11...1.....1" +
   590:     "1.......11...11....1" +
   591:     "1.......11111111...1" +
   592:     "1.......11111111...1" +
   593:     "1............11....1" +
   594:     "1............1.....1" +
   595:     "1..................1" +
   596:     "11111111111111111111"
   597:     );
   598:   public static Image LNF_TRACE_IMAGE;
   599:   public static Image LNF_TRACE_DISABLED_IMAGE;
   600: 
   601:   public static final String LNF_TRACE_10_PATTERN = (
   602:     "11111111111111111111" +
   603:     "1..................1" +
   604:     "1..................1" +
   605:     "1.........1.11111..1" +
   606:     "1.........1.1...1..1" +
   607:     "1..111....1.1...1..1" +
   608:     "1....1....1.1...1..1" +
   609:     "1....1.1..1.1...1..1" +
   610:     "1....1111.1.1...1..1" +
   611:     "1......1..1.1...1..1" +
   612:     "1.........1.11111..1" +
   613:     "1..................1" +
   614:     "1..................1" +
   615:     "11111111111111111111"
   616:     );
   617:   public static Image LNF_TRACE_10_IMAGE;
   618:   public static Image LNF_TRACE_10_DISABLED_IMAGE;
   619: 
   620:   public static final String LNF_TRACE_100_PATTERN = (
   621:     "11111111111111111111" +
   622:     "1..................1" +
   623:     "1..................1" +
   624:     "1........1.111.111.1" +
   625:     "1........1.1.1.1.1.1" +
   626:     "1.111....1.1.1.1.1.1" +
   627:     "1...1....1.1.1.1.1.1" +
   628:     "1...1.1..1.1.1.1.1.1" +
   629:     "1...1111.1.1.1.1.1.1" +
   630:     "1.....1..1.1.1.1.1.1" +
   631:     "1........1.111.111.1" +
   632:     "1..................1" +
   633:     "1..................1" +
   634:     "11111111111111111111"
   635:     );
   636:   public static Image LNF_TRACE_100_IMAGE;
   637:   public static Image LNF_TRACE_100_DISABLED_IMAGE;
   638: 
   639:   public static final String LNF_STEP_PATTERN = (
   640:     "11111111111111111111" +
   641:     "1..................1" +
   642:     "1..................1" +
   643:     "1.....111111.......1" +
   644:     "1.....111111.......1" +
   645:     "1.....11..11.......1" +
   646:     "1.....11..11..1....1" +
   647:     "1.....11..11..11...1" +
   648:     "1...1111..1111111..1" +
   649:     "1...1111..1111111..1" +
   650:     "1.............11...1" +
   651:     "1.............1....1" +
   652:     "1..................1" +
   653:     "11111111111111111111"
   654:     );
   655:   public static Image LNF_STEP_IMAGE;
   656:   public static Image LNF_STEP_DISABLED_IMAGE;
   657: 
   658:   public static final String LNF_STEP_10_PATTERN = (
   659:     "11111111111111111111" +
   660:     "1..................1" +
   661:     "1..................1" +
   662:     "1.........1.11111..1" +
   663:     "1.........1.1...1..1" +
   664:     "1..111....1.1...1..1" +
   665:     "1..1.1....1.1...1..1" +
   666:     "1..1.1.1..1.1...1..1" +
   667:     "1..1.1111.1.1...1..1" +
   668:     "1......1..1.1...1..1" +
   669:     "1.........1.11111..1" +
   670:     "1..................1" +
   671:     "1..................1" +
   672:     "11111111111111111111"
   673:     );
   674:   public static Image LNF_STEP_10_IMAGE;
   675:   public static Image LNF_STEP_10_DISABLED_IMAGE;
   676: 
   677:   public static final String LNF_STEP_100_PATTERN = (
   678:     "11111111111111111111" +
   679:     "1..................1" +
   680:     "1..................1" +
   681:     "1........1.111.111.1" +
   682:     "1........1.1.1.1.1.1" +
   683:     "1.111....1.1.1.1.1.1" +
   684:     "1.1.1....1.1.1.1.1.1" +
   685:     "1.1.1.1..1.1.1.1.1.1" +
   686:     "1.1.1111.1.1.1.1.1.1" +
   687:     "1.....1..1.1.1.1.1.1" +
   688:     "1........1.111.111.1" +
   689:     "1..................1" +
   690:     "1..................1" +
   691:     "11111111111111111111"
   692:     );
   693:   public static Image LNF_STEP_100_IMAGE;
   694:   public static Image LNF_STEP_100_DISABLED_IMAGE;
   695: 
   696:   public static final String LNF_STEP_UNTIL_RETURN_PATTERN = (
   697:     "11111111111111111111" +
   698:     "1..................1" +
   699:     "1........1.........1" +
   700:     "1.......11.........1" +
   701:     "1......11111111....1" +
   702:     "1......11111111....1" +
   703:     "1.......11...11....1" +
   704:     "1........1...11....1" +
   705:     "1............11....1" +
   706:     "1....1111111111....1" +
   707:     "1....1111111111....1" +
   708:     "1..................1" +
   709:     "1..................1" +
   710:     "11111111111111111111"
   711:     );
   712:   public static Image LNF_STEP_UNTIL_RETURN_IMAGE;
   713:   public static Image LNF_STEP_UNTIL_RETURN_DISABLED_IMAGE;
   714: 
   715:   public static final String LNF_RUN_PATTERN = (
   716:     "11111111111111111111" +
   717:     "1..................1" +
   718:     "1........11........1" +
   719:     "1........111.......1" +
   720:     "1.........111......1" +
   721:     "1..........111.....1" +
   722:     "1....1111111111....1" +
   723:     "1....1111111111....1" +
   724:     "1..........111.....1" +
   725:     "1.........111......1" +
   726:     "1........111.......1" +
   727:     "1........11........1" +
   728:     "1..................1" +
   729:     "11111111111111111111"
   730:     );
   731:   public static Image LNF_RUN_IMAGE;
   732:   public static Image LNF_RUN_DISABLED_IMAGE;
   733: 
   734:   public static final String LNF_CLEAR_PATTERN = (
   735:     "11111111111111111111" +
   736:     "1..................1" +
   737:     "1....1111111111....1" +
   738:     "1....1........1....1" +
   739:     "1....1.11.....1....1" +
   740:     "1....11..1....1....1" +
   741:     "1....1.11.1..1.....1" +
   742:     "1.....1..1.11.1....1" +
   743:     "1....1....1..11....1" +
   744:     "1....1.....11.1....1" +
   745:     "1....1........1....1" +
   746:     "1....1111111111....1" +
   747:     "1..................1" +
   748:     "11111111111111111111"
   749:     );
   750:   public static Image LNF_CLEAR_IMAGE;
   751:   public static Image LNF_CLEAR_DISABLED_IMAGE;
   752: 
   753:   public static final String LNF_OLDEST_PATTERN = (
   754:     "11111111111111111111" +
   755:     "1..................1" +
   756:     "1.1111....11....11.1" +
   757:     "1.1..1...1.1...1.1.1" +
   758:     "1.1..1..1..1..1..1.1" +
   759:     "1.1..1.1...1.1...1.1" +
   760:     "1.1..11....11....1.1" +
   761:     "1.1..11....11....1.1" +
   762:     "1.1..1.1...1.1...1.1" +
   763:     "1.1..1..1..1..1..1.1" +
   764:     "1.1..1...1.1...1.1.1" +
   765:     "1.1111....11....11.1" +
   766:     "1..................1" +
   767:     "11111111111111111111"
   768:     );
   769:   public static Image LNF_OLDEST_IMAGE;
   770:   public static Image LNF_OLDEST_DISABLED_IMAGE;
   771: 
   772:   public static final String LNF_OLDER_PATTERN = (
   773:     "11111111111111111111" +
   774:     "1..................1" +
   775:     "1.......11....11...1" +
   776:     "1......1.1...1.1...1" +
   777:     "1.....1..1..1..1...1" +
   778:     "1....1...1.1...1...1" +
   779:     "1...1....11....1...1" +
   780:     "1...1....11....1...1" +
   781:     "1....1...1.1...1...1" +
   782:     "1.....1..1..1..1...1" +
   783:     "1......1.1...1.1...1" +
   784:     "1.......11....11...1" +
   785:     "1..................1" +
   786:     "11111111111111111111"
   787:     );
   788:   public static Image LNF_OLDER_IMAGE;
   789:   public static Image LNF_OLDER_DISABLED_IMAGE;
   790: 
   791:   public static final String LNF_PREVIOUS_PATTERN = (
   792:     "11111111111111111111" +
   793:     "1..................1" +
   794:     "1..........11......1" +
   795:     "1.........1.1......1" +
   796:     "1........1..1......1" +
   797:     "1.......1...1......1" +
   798:     "1......1....1......1" +
   799:     "1......1....1......1" +
   800:     "1.......1...1......1" +
   801:     "1........1..1......1" +
   802:     "1.........1.1......1" +
   803:     "1..........11......1" +
   804:     "1..................1" +
   805:     "11111111111111111111"
   806:     );
   807:   public static Image LNF_PREVIOUS_IMAGE;
   808:   public static Image LNF_PREVIOUS_DISABLED_IMAGE;
   809: 
   810:   public static final String LNF_NEXT_PATTERN = (
   811:     "11111111111111111111" +
   812:     "1..................1" +
   813:     "1......11..........1" +
   814:     "1......1.1.........1" +
   815:     "1......1..1........1" +
   816:     "1......1...1.......1" +
   817:     "1......1....1......1" +
   818:     "1......1....1......1" +
   819:     "1......1...1.......1" +
   820:     "1......1..1........1" +
   821:     "1......1.1.........1" +
   822:     "1......11..........1" +
   823:     "1..................1" +
   824:     "11111111111111111111"
   825:     );
   826:   public static Image LNF_NEXT_IMAGE;
   827:   public static Image LNF_NEXT_DISABLED_IMAGE;
   828: 
   829:   public static final String LNF_NEWER_PATTERN = (
   830:     "11111111111111111111" +
   831:     "1..................1" +
   832:     "1...11....11.......1" +
   833:     "1...1.1...1.1......1" +
   834:     "1...1..1..1..1.....1" +
   835:     "1...1...1.1...1....1" +
   836:     "1...1....11....1...1" +
   837:     "1...1....11....1...1" +
   838:     "1...1...1.1...1....1" +
   839:     "1...1..1..1..1.....1" +
   840:     "1...1.1...1.1......1" +
   841:     "1...11....11.......1" +
   842:     "1..................1" +
   843:     "11111111111111111111"
   844:     );
   845:   public static Image LNF_NEWER_IMAGE;
   846:   public static Image LNF_NEWER_DISABLED_IMAGE;
   847: 
   848:   public static final String LNF_NEWEST_PATTERN = (
   849:     "11111111111111111111" +
   850:     "1..................1" +
   851:     "1.11....11....1111.1" +
   852:     "1.1.1...1.1...1..1.1" +
   853:     "1.1..1..1..1..1..1.1" +
   854:     "1.1...1.1...1.1..1.1" +
   855:     "1.1....11....11..1.1" +
   856:     "1.1....11....11..1.1" +
   857:     "1.1...1.1...1.1..1.1" +
   858:     "1.1..1..1..1..1..1.1" +
   859:     "1.1.1...1.1...1..1.1" +
   860:     "1.11....11....1111.1" +
   861:     "1..................1" +
   862:     "11111111111111111111"
   863:     );
   864:   public static Image LNF_NEWEST_IMAGE;
   865:   public static Image LNF_NEWEST_DISABLED_IMAGE;
   866: 
   867:   public static final String LNF_ORI_BYTE_ZERO_D0_PATTERN = (
   868:     "22222222222222222222" +
   869:     "2..................2" +
   870:     "2..................2" +
   871:     "2...1111....1111...2" +
   872:     "2..1....1..1....1..2" +
   873:     "2..1...11..1...11..2" +
   874:     "2..1..1.1..1..1.1..2" +
   875:     "2..1.1..1..1.1..1..2" +
   876:     "2..11...1..11...1..2" +
   877:     "2..1....1..1....1..2" +
   878:     "2...1111....1111...2" +
   879:     "2..................2" +
   880:     "2..................2" +
   881:     "22222222222222222222"
   882:     );
   883:   public static Image LNF_ORI_BYTE_ZERO_D0_IMAGE;
   884:   public static Image LNF_ORI_BYTE_ZERO_D0_SELECTED_IMAGE;
   885: 
   886:   public static final String LNF_STOP_ON_ERROR_PATTERN = (
   887:     "22222222222222222222" +
   888:     "2..................2" +
   889:     "2........11........2" +
   890:     "2........11........2" +
   891:     "2........11........2" +
   892:     "2........11........2" +
   893:     "2........11........2" +
   894:     "2........11........2" +
   895:     "2..................2" +
   896:     "2..................2" +
   897:     "2........11........2" +
   898:     "2........11........2" +
   899:     "2..................2" +
   900:     "22222222222222222222"
   901:     );
   902:   public static Image LNF_STOP_ON_ERROR_IMAGE;
   903:   public static Image LNF_STOP_ON_ERROR_SELECTED_IMAGE;
   904: 
   905:   public static final String LNF_STOP_AT_START_PATTERN = (
   906:     "22222222222222222222" +
   907:     "2..................2" +
   908:     "2..................2" +
   909:     "2..............1...2" +
   910:     "2.............11...2" +
   911:     "2...1111.....1.1...2" +
   912:     "2.......1...1..1...2" +
   913:     "2...11111..1...1...2" +
   914:     "2..1....1.1111111..2" +
   915:     "2..1...11......1...2" +
   916:     "2...111.11.....1...2" +
   917:     "2..................2" +
   918:     "2..................2" +
   919:     "22222222222222222222"
   920:     );
   921:   public static Image LNF_STOP_AT_START_IMAGE;
   922:   public static Image LNF_STOP_AT_START_SELECTED_IMAGE;
   923: 
   924:   //lnfInit ()
   925:   //  Look&Feelを初期化する
   926:   //  既存のコンポーネントのUIを切り替えると部分的に更新されず汚くなることがあるのでコンポーネントを作る前に行うこと
   927:   //  既存のコンポーネントのUIを切り替える方法
   928:   //    SwingUtilities.updateComponentTreeUI (rootPaneContainer.getRootPane ());
   929:   public static void lnfInit () {
   930: 
   931:     if (false) {
   932:       //利用可能なすべてのLook&Feelを表示する
   933:       //  UIManager.setLookAndFeel(info.getClassName())とするとLook&Feelが変更される
   934:       //  Metal以外はJavaのバージョンによって位置が異なる場合があるらしい
   935:       System.out.println ("\n[UIManager.getInstalledLookAndFeels()]");
   936:       for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels ()) {
   937:         System.out.println ("        //  " + info.getName () + " = " + info.getClassName ());
   938:         //  Metal = javax.swing.plaf.metal.MetalLookAndFeel
   939:         //  Nimbus = javax.swing.plaf.nimbus.NimbusLookAndFeel
   940:         //  CDE/Motif = com.sun.java.swing.plaf.motif.MotifLookAndFeel
   941:         //  Windows = com.sun.java.swing.plaf.windows.WindowsLookAndFeel
   942:         //  Windows Classic = com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
   943:       }
   944:     }
   945: 
   946:     if (false) {
   947:       //UIDefaultsをダンプする
   948:       System.out.println ("\n[UIManager.getDefaults()]");
   949:       TreeMap<String,String> m = new TreeMap<String,String> ();
   950:       //UIManager.getDefaults ().forEach ((k, v) -> m.put (k.toString (), v.toString ()));  //UIManager.getDefaults()はHashtable<Object,Object>
   951:       //なぜかUIManager.getDefaults().forEach(BiConsumer)がBiConsumerを1回も呼び出さずに終了してしまう
   952:       for (Map.Entry<Object,Object> e : UIManager.getDefaults ().entrySet ()) {
   953:         m.put (e.getKey ().toString (), e.getValue ().toString ());
   954:       }
   955:       m.forEach ((k, v) -> System.out.println (k + " = " + v));
   956:     }
   957: 
   958:     //色
   959:     //  以下の順序で明るさを変化させると綺麗に見える
   960:     //  secondary3  アクティブでないウインドウのタイトルバーとメニューバーとコンテンツの背景
   961:     //    control                        コントロール・カラー
   962:     //    menuBackground                 メニューのバックグラウンド・カラー
   963:     //    windowTitleInactiveBackground  アクティブでないウィンドウ・タイトルのバックグラウンド・カラー
   964:     //  white       ウインドウのタイトルバーのドットとクローズボタンなどの溝とメニューのボーダーの明るい部分
   965:     //    controlHighlight               コントロール・ハイライト・カラー
   966:     //    primaryControlHighlight        一次コントロール・ハイライト・カラー
   967:     //    separatorBackground            セパレータのバックグラウンド・カラー
   968:     //    white                          白
   969:     //    windowBackground               ウィンドウのバックグラウンド・カラー
   970:     //  primary3    アクティブなウインドウのタイトルバーの背景
   971:     //    primaryControl                 一次コントロール・カラー
   972:     //    textHighlightColor             テキスト・ハイライト・カラー
   973:     //    windowTitleBackground          ウィンドウ・タイトルのバックグラウンド・カラー
   974:     //  primary2    アクティブなウインドウの枠の溝の明るい部分とメニューバーの上のボーダーと選択されているメニューの背景
   975:     //    desktopColor                   デスクトップ・カラー
   976:     //    focusColor                     フォーカス・カラー
   977:     //    menuSelectedBackground         選択されたメニューのバックグラウンド・カラー
   978:     //    primaryControlShadow           一次コントロール・シャドウ・カラー
   979:     //  secondary2  アクティブでないウインドウの枠の溝の明るい部分とメニューバーの上のボーダーとメニューバーの下のボーダー
   980:     //    controlDisabled                無効なコントロールのコントロール・カラー
   981:     //    controlShadow                  コントロール・シャドウ・カラー
   982:     //    inactiveControlTextColor       アクティブでないコントロール・テキスト・カラー
   983:     //    inactiveSystemTextColor        アクティブでないシステム・テキスト・カラー
   984:     //    menuDisabledForeground         無効なメニューのフォアグラウンド・カラー
   985:     //  primary1    アクティブなウインドウの枠とクローズボタンなどの溝の底
   986:     //    acceleratorForeground          アクセラレータのフォアグラウンド・カラー
   987:     //    primaryControlDarkShadow       一次コントロール・ダーク・シャドウ・カラー
   988:     //    separatorForeground            セパレータのフォアグラウンド・カラー
   989:     //  secondary1  アクティブでないウインドウの枠とクローズボタンなどの溝の底とタイトルバーのドットの暗い部分
   990:     //    controlDarkShadow              コントロール・ダーク・シャドウ・カラー
   991:     //  black       ウインドウの枠とクローズボタンなどの溝の暗い部分とタイトルバーの文字とメニューの文字
   992:     //    acceleratorSelectedForeground  選択されたアクセラレータのフォアグラウンド・カラー
   993:     //    black                          黒
   994:     //    controlInfo                    制御情報カラー
   995:     //    controlTextColor               コントロール・テキスト・カラー
   996:     //    highlightedTextColor           ハイライト・テキストのテキスト・カラー
   997:     //    menuForeground                 メニューのフォアグラウンド・カラー
   998:     //    menuSelectedForeground         選択されたメニューのフォアグラウンド・カラー
   999:     //    primaryControlInfo             一次制御情報カラー
  1000:     //    systemTextColor                システム・テキスト・カラー
  1001:     //    userTextColor                  ユーザー・テキスト・カラー
  1002:     //    windowTitleForeground          ウィンドウ・タイトルのフォアグラウンド・カラー
  1003:     //    windowTitleInactiveForeground  アクティブでないウィンドウ・タイトルのフォアグラウンド・カラー
  1004:     {
  1005:       int[] a = Settings.sgsGetIntArray ("hhssbb", -1, -1);
  1006:       boolean ok = a.length == 6;
  1007:       for (int i = 0; ok && i < 6; i++) {
  1008:         ok = 0 <= a[i] && a[i] <= (i < 2 ? 2000 : 1000);
  1009:       }
  1010:       if (ok) {
  1011:         for (int i = 0; i < 3; i++) {
  1012:           lnfHSB[3 * i    ] = (a[2 * i    ] * (i == 0 ? 360 : 100) + 500) / 1000;
  1013:           lnfHSB[3 * i + 2] = (a[2 * i + 1] * (i == 0 ? 360 : 100) + 500) / 1000;
  1014:           lnfHSB[3 * i + 1] = (lnfHSB[3 * i    ] +
  1015:                                lnfHSB[3 * i + 2]) / 2;
  1016:         }
  1017:       } else {
  1018:         a = Settings.sgsGetIntArray ("hsb", -1, -1);
  1019:         ok = a.length == 9;
  1020:         for (int i = 0; ok && i < 9; i++) {
  1021:           ok = 0 <= a[i] && a[i] <= (i < 3 ? 720 : 100);
  1022:         }
  1023:         System.arraycopy (ok ? a : LNF_DEFAULT_HSB, 0, lnfHSB, 0, 9);
  1024:       }
  1025:     }
  1026:     for (int i = 0; i <= 14; i++) {
  1027:       int[] t = LNF_HSB_INTERPOLATION_TABLE[i];
  1028:       float h = (float) (t[0] * lnfHSB[0] + t[1] * lnfHSB[1] + t[2] * lnfHSB[2]) / (49.0F * 360.0F);
  1029:       float s = (float) (t[0] * lnfHSB[3] + t[1] * lnfHSB[4] + t[2] * lnfHSB[5]) / (49.0F * 100.0F);
  1030:       float b = (float) (t[0] * lnfHSB[6] + t[1] * lnfHSB[7] + t[2] * lnfHSB[8]) / (49.0F * 100.0F);
  1031:       lnfRGB[i] = Color.HSBtoRGB (h,
  1032:                                   Math.max (0.0F, Math.min (1.0F, s)),
  1033:                                   Math.max (0.0F, Math.min (1.0F, b)));
  1034:     }
  1035:     lnfSecondary3 = new ColorUIResource (lnfRGB[0]);
  1036:     lnfWhite      = new ColorUIResource (lnfRGB[2]);
  1037:     lnfPrimary3   = new ColorUIResource (lnfRGB[4]);
  1038:     lnfPrimary2   = new ColorUIResource (lnfRGB[6]);
  1039:     lnfSecondary2 = new ColorUIResource (lnfRGB[8]);
  1040:     lnfPrimary1   = new ColorUIResource (lnfRGB[10]);
  1041:     lnfSecondary1 = new ColorUIResource (lnfRGB[12]);
  1042:     lnfBlack      = new ColorUIResource (lnfRGB[14]);
  1043: 
  1044:     //フォント
  1045:     //  フォントサイズを変更できるようにする
  1046:     lnfFontSizeRequest = Math.max (10, Math.min (18, Settings.sgsGetInt ("fontsize", 14))) & -2;  //10,12,14,16,18
  1047:     lnfFontSize = lnfFontSizeRequest;
  1048:     //  "Monospaced"を"MS ゴシック"にする
  1049:     //  /lib/fontconfig.properties.src
  1050:     //  の
  1051:     //  monospaced.plain.japanese=MS Gothic
  1052:     //  は変わっていないが"MS Gothic"が通らなくなったらしい
  1053:     //  "MS ゴシック"は通る
  1054:     //  スマートな修正方法が思いつかなかったので面倒だが全部書き換える
  1055:     lnfAvailableFontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment ().getAvailableFontFamilyNames ();
  1056:     lnfMonospacedFamily = (Arrays.asList (lnfAvailableFontFamilyNames).contains ("MS ゴシック") ? "MS ゴシック" :
  1057:                            "Monospaced");
  1058:     lnfMonospacedFont = new Font (lnfMonospacedFamily, Font.PLAIN, lnfFontSize);
  1059:     lnfMonospacedFont12 = new Font (lnfMonospacedFamily, Font.PLAIN, 12);
  1060:     //  日本語はボールドにすると読みにくいのでプレーンにする
  1061:     //  ControlTextFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
  1062:     //  MenuTextFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
  1063:     //  SubTextFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=10]
  1064:     //  SystemTextFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
  1065:     //  UserTextFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
  1066:     //  WindowTitleFont=javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
  1067:     lnfControlTextFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize);
  1068:     lnfMenuTextFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize);
  1069:     lnfSubTextFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize * 5 / 6);
  1070:     lnfSystemTextFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize);
  1071:     lnfUserTextFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize);
  1072:     lnfWindowTitleFontUIResource = new FontUIResource ("Dialog", Font.PLAIN, lnfFontSize);
  1073: 
  1074:     //Look&Feel
  1075:     JFrame.setDefaultLookAndFeelDecorated (true);
  1076:     JDialog.setDefaultLookAndFeelDecorated (true);
  1077:     MetalLookAndFeel.setCurrentTheme (new XEiJTheme ());
  1078:     try {
  1079:       UIManager.setLookAndFeel (new MetalLookAndFeel ());
  1080:     } catch (UnsupportedLookAndFeelException ulafe) {
  1081:     }
  1082: 
  1083:     //アイコン
  1084:     for (int i = 0; i < LNF_NUMBER_PATTERN_ARRAY.length; i++) {
  1085:       LNF_NUMBER_IMAGE_ARRAY[i] = XEiJ.createImage (14, 14, LNF_NUMBER_PATTERN_ARRAY[i], lnfRGB[0], lnfRGB[12], lnfRGB[0]);
  1086:       LNF_NUMBER_SELECTED_IMAGE_ARRAY[i] = XEiJ.createImage (14, 14, LNF_NUMBER_PATTERN_ARRAY[i], lnfRGB[0], lnfRGB[12], lnfRGB[12]);
  1087:     }
  1088: 
  1089:     LNF_EJECT_IMAGE = XEiJ.createImage (14, 14, LNF_EJECT_PATTERN, lnfRGB[0], lnfRGB[12]);
  1090:     LNF_EJECT_DISABLED_IMAGE = XEiJ.createImage (14, 14, LNF_EJECT_PATTERN, lnfRGB[0], lnfRGB[6]);
  1091: 
  1092:     LNF_OPEN_IMAGE = XEiJ.createImage (14, 14, LNF_OPEN_PATTERN, lnfRGB[0], lnfRGB[12]);
  1093:     LNF_OPEN_DISABLED_IMAGE = XEiJ.createImage (14, 14, LNF_OPEN_PATTERN, lnfRGB[0], lnfRGB[6]);
  1094: 
  1095:     LNF_PROTECT_IMAGE = XEiJ.createImage (14, 14, LNF_PROTECT_PATTERN, lnfRGB[0], lnfRGB[12]);
  1096:     LNF_PROTECT_DISABLED_IMAGE = XEiJ.createImage (14, 14, LNF_PROTECT_PATTERN, lnfRGB[0], lnfRGB[6]);
  1097:     LNF_PROTECT_SELECTED_IMAGE = XEiJ.createImage (14, 14, LNF_PROTECT_SELECTED_PATTERN, lnfRGB[0], lnfRGB[12]);
  1098:     LNF_PROTECT_DISABLED_SELECTED_IMAGE = XEiJ.createImage (14, 14, LNF_PROTECT_SELECTED_PATTERN, lnfRGB[0], lnfRGB[6]);
  1099: 
  1100:     LNF_HD_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_HD_PATTERN, lnfRGB[0], lnfRGB[12]));
  1101:     LNF_HD_DISABLED_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_HD_PATTERN, lnfRGB[0], lnfRGB[6]));
  1102: 
  1103:     LNF_MO_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_MO_PATTERN, lnfRGB[0], lnfRGB[12]));
  1104:     LNF_MO_DISABLED_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_MO_PATTERN, lnfRGB[0], lnfRGB[6]));
  1105: 
  1106:     LNF_CD_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_CD_PATTERN, lnfRGB[0], lnfRGB[12]));
  1107:     LNF_CD_DISABLED_ICON = new ImageIcon (XEiJ.createImage (14, 14, LNF_CD_PATTERN, lnfRGB[0], lnfRGB[6]));
  1108: 
  1109:     LNF_BREAK_IMAGE = XEiJ.createImage (20, 14, LNF_BREAK_PATTERN, lnfRGB[0], lnfRGB[12]);
  1110:     LNF_BREAK_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_BREAK_PATTERN, lnfRGB[0], lnfRGB[6]);
  1111: 
  1112:     LNF_TRACE_IMAGE = XEiJ.createImage (20, 14, LNF_TRACE_PATTERN, lnfRGB[0], lnfRGB[12]);
  1113:     LNF_TRACE_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_TRACE_PATTERN, lnfRGB[0], lnfRGB[6]);
  1114: 
  1115:     LNF_TRACE_10_IMAGE = XEiJ.createImage (20, 14, LNF_TRACE_10_PATTERN, lnfRGB[0], lnfRGB[12]);
  1116:     LNF_TRACE_10_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_TRACE_10_PATTERN, lnfRGB[0], lnfRGB[6]);
  1117: 
  1118:     LNF_TRACE_100_IMAGE = XEiJ.createImage (20, 14, LNF_TRACE_100_PATTERN, lnfRGB[0], lnfRGB[12]);
  1119:     LNF_TRACE_100_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_TRACE_100_PATTERN, lnfRGB[0], lnfRGB[6]);
  1120: 
  1121:     LNF_STEP_IMAGE = XEiJ.createImage (20, 14, LNF_STEP_PATTERN, lnfRGB[0], lnfRGB[12]);
  1122:     LNF_STEP_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_STEP_PATTERN, lnfRGB[0], lnfRGB[6]);
  1123: 
  1124:     LNF_STEP_10_IMAGE = XEiJ.createImage (20, 14, LNF_STEP_10_PATTERN, lnfRGB[0], lnfRGB[12]);
  1125:     LNF_STEP_10_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_STEP_10_PATTERN, lnfRGB[0], lnfRGB[6]);
  1126: 
  1127:     LNF_STEP_100_IMAGE = XEiJ.createImage (20, 14, LNF_STEP_100_PATTERN, lnfRGB[0], lnfRGB[12]);
  1128:     LNF_STEP_100_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_STEP_100_PATTERN, lnfRGB[0], lnfRGB[6]);
  1129: 
  1130:     LNF_STEP_UNTIL_RETURN_IMAGE = XEiJ.createImage (20, 14, LNF_STEP_UNTIL_RETURN_PATTERN, lnfRGB[0], lnfRGB[12]);
  1131:     LNF_STEP_UNTIL_RETURN_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_STEP_UNTIL_RETURN_PATTERN, lnfRGB[0], lnfRGB[6]);
  1132: 
  1133:     LNF_RUN_IMAGE = XEiJ.createImage (20, 14, LNF_RUN_PATTERN, lnfRGB[0], lnfRGB[12]);
  1134:     LNF_RUN_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_RUN_PATTERN, lnfRGB[0], lnfRGB[6]);
  1135: 
  1136:     LNF_CLEAR_IMAGE = XEiJ.createImage (20, 14, LNF_CLEAR_PATTERN, lnfRGB[0], lnfRGB[12]);
  1137:     LNF_CLEAR_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_CLEAR_PATTERN, lnfRGB[0], lnfRGB[6]);
  1138: 
  1139:     LNF_OLDEST_IMAGE = XEiJ.createImage (20, 14, LNF_OLDEST_PATTERN, lnfRGB[0], lnfRGB[12]);
  1140:     LNF_OLDEST_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_OLDEST_PATTERN, lnfRGB[0], lnfRGB[6]);
  1141: 
  1142:     LNF_OLDER_IMAGE = XEiJ.createImage (20, 14, LNF_OLDER_PATTERN, lnfRGB[0], lnfRGB[12]);
  1143:     LNF_OLDER_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_OLDER_PATTERN, lnfRGB[0], lnfRGB[6]);
  1144: 
  1145:     LNF_PREVIOUS_IMAGE = XEiJ.createImage (20, 14, LNF_PREVIOUS_PATTERN, lnfRGB[0], lnfRGB[12]);
  1146:     LNF_PREVIOUS_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_PREVIOUS_PATTERN, lnfRGB[0], lnfRGB[6]);
  1147: 
  1148:     LNF_NEXT_IMAGE = XEiJ.createImage (20, 14, LNF_NEXT_PATTERN, lnfRGB[0], lnfRGB[12]);
  1149:     LNF_NEXT_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_NEXT_PATTERN, lnfRGB[0], lnfRGB[6]);
  1150: 
  1151:     LNF_NEWER_IMAGE = XEiJ.createImage (20, 14, LNF_NEWER_PATTERN, lnfRGB[0], lnfRGB[12]);
  1152:     LNF_NEWER_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_NEWER_PATTERN, lnfRGB[0], lnfRGB[6]);
  1153: 
  1154:     LNF_NEWEST_IMAGE = XEiJ.createImage (20, 14, LNF_NEWEST_PATTERN, lnfRGB[0], lnfRGB[12]);
  1155:     LNF_NEWEST_DISABLED_IMAGE= XEiJ.createImage (20, 14, LNF_NEWEST_PATTERN, lnfRGB[0], lnfRGB[6]);
  1156: 
  1157:     LNF_ORI_BYTE_ZERO_D0_IMAGE = XEiJ.createImage (20, 14, LNF_ORI_BYTE_ZERO_D0_PATTERN, lnfRGB[0], lnfRGB[6], lnfRGB[12]);
  1158:     LNF_ORI_BYTE_ZERO_D0_SELECTED_IMAGE= XEiJ.createImage (20, 14, LNF_ORI_BYTE_ZERO_D0_PATTERN, lnfRGB[0], lnfRGB[12], lnfRGB[12]);
  1159: 
  1160:     LNF_STOP_ON_ERROR_IMAGE = XEiJ.createImage (20, 14, LNF_STOP_ON_ERROR_PATTERN, lnfRGB[0], lnfRGB[6], lnfRGB[12]);
  1161:     LNF_STOP_ON_ERROR_SELECTED_IMAGE= XEiJ.createImage (20, 14, LNF_STOP_ON_ERROR_PATTERN, lnfRGB[0], lnfRGB[12], lnfRGB[12]);
  1162: 
  1163:     LNF_STOP_AT_START_IMAGE = XEiJ.createImage (20, 14, LNF_STOP_AT_START_PATTERN, lnfRGB[0], lnfRGB[6], lnfRGB[12]);
  1164:     LNF_STOP_AT_START_SELECTED_IMAGE= XEiJ.createImage (20, 14, LNF_STOP_AT_START_PATTERN, lnfRGB[0], lnfRGB[12], lnfRGB[12]);
  1165: 
  1166:   }  //lnfInit()
  1167: 
  1168:   //lnfTini ()
  1169:   //  後始末
  1170:   public static void lnfTini () {
  1171:     //色
  1172:     Settings.sgsPutIntArray ("hsb", lnfHSB, -1);
  1173:     Settings.sgsPutString ("hhssbb", "none");
  1174:     //フォントサイズ
  1175:     Settings.sgsPutInt ("fontsize", lnfFontSizeRequest);
  1176:   }
  1177: 
  1178: 
  1179: 
  1180:   //$$XET XEiJのテーマ
  1181:   public static class XEiJTheme extends MetalTheme {
  1182: 
  1183:     //名前
  1184:     @Override public String getName () {
  1185:       return "XEiJ";
  1186:     }  //getName()
  1187: 
  1188:     //色
  1189:     //  背景を黒にする
  1190:     //  以下の順序で明るさを変化させると綺麗に見える
  1191:     //  secondary3
  1192:     //    アクティブでないウインドウのタイトルバーの背景
  1193:     //    メニューバーの背景
  1194:     //    コンテンツの背景
  1195:     //  white
  1196:     //    ウインドウのタイトルバーのドットの明るい部分(左上)
  1197:     //    クローズボタンなどの溝の明るい部分
  1198:     //    メニューのボーダーの明るい部分
  1199:     //  primary3
  1200:     //    アクティブなウインドウのタイトルバーの背景
  1201:     //  primary2
  1202:     //    アクティブなウインドウの枠の溝の明るい部分
  1203:     //    アクティブなウインドウのメニューバーの上のボーダー
  1204:     //    選択されているメニューの背景
  1205:     //  secondary2
  1206:     //    アクティブでないウインドウの枠の溝の明るい部分
  1207:     //    アクティブでないウインドウのメニューバーの上のボーダー
  1208:     //    メニューバーの下のボーダー
  1209:     //  primary1
  1210:     //    アクティブなウインドウの枠
  1211:     //    アクティブなウインドウのクローズボタンなどの溝の底
  1212:     //  secondary1
  1213:     //    アクティブでないウインドウの枠
  1214:     //    アクティブでないウインドウのクローズボタンなどの溝の底
  1215:     //    アクティブでないウインドウのタイトルバーのドットの暗い部分(右下)
  1216:     //  black
  1217:     //    ウインドウの枠の溝の暗い部分
  1218:     //    クローズボタンなどの溝の暗い部分
  1219:     //    タイトルバーの文字
  1220:     //    メニューの文字
  1221:     @Override protected ColorUIResource getSecondary3 () {
  1222:       return lnfSecondary3;
  1223:     }  //getSecondary3()
  1224:     @Override protected ColorUIResource getWhite () {
  1225:       return lnfWhite;
  1226:     }  //getWhite()
  1227:     @Override protected ColorUIResource getPrimary3 () {
  1228:       return lnfPrimary3;
  1229:     }  //getPrimary3()
  1230:     @Override protected ColorUIResource getPrimary2 () {
  1231:       return lnfPrimary2;
  1232:     }  //getPrimary2()
  1233:     @Override protected ColorUIResource getSecondary2 () {
  1234:       return lnfSecondary2;
  1235:     }  //getSecondary2()
  1236:     @Override protected ColorUIResource getPrimary1 () {
  1237:       return lnfPrimary1;
  1238:     }  //getPrimary1()
  1239:     @Override protected ColorUIResource getSecondary1 () {
  1240:       return lnfSecondary1;
  1241:     }  //getSecondary1()
  1242:     @Override protected ColorUIResource getBlack () {
  1243:       return lnfBlack;
  1244:     }  //getBlack()
  1245: 
  1246:     //フォント
  1247:     @Override public FontUIResource getControlTextFont () {
  1248:       return lnfControlTextFontUIResource;
  1249:     }  //getControlTextFont()
  1250:     @Override public FontUIResource getMenuTextFont () {
  1251:       return lnfMenuTextFontUIResource;
  1252:     }  //getMenuTextFont()
  1253:     @Override public FontUIResource getSubTextFont () {
  1254:       return lnfSubTextFontUIResource;
  1255:     }  //getSubTextFont()
  1256:     @Override public FontUIResource getSystemTextFont () {
  1257:       return lnfSystemTextFontUIResource;
  1258:     }  //getSystemTextFont()
  1259:     @Override public FontUIResource getUserTextFont () {
  1260:       return lnfUserTextFontUIResource;
  1261:     }  //getUserTextFont()
  1262:     @Override public FontUIResource getWindowTitleFont () {
  1263:       return lnfWindowTitleFontUIResource;
  1264:     }  //getWindowTitleFont()
  1265: 
  1266:     //カスタム
  1267:     @Override public void addCustomEntriesToTable (UIDefaults table) {
  1268:       super.addCustomEntriesToTable (table);
  1269:       table.putDefaults (new Object[] {
  1270:         //ボタン
  1271:         //  隙間を詰める
  1272:         "Button.margin", new InsetsUIResource (1, 7, 1, 7),  //2,14,2,14
  1273:         //アイコン
  1274:         //  ウインドウのタイトルバーの左端のアイコンはこれだけで変更できる
  1275:         //  タスクバーのアイコンはこれだけでは変更できない
  1276:         //    おそらく変更する前にコピーされている
  1277:         //  メインのウインドウだけwindow.setIconImage(LNF_ICON_IMAGE_16)などと書くことにする
  1278:         "InternalFrame.icon", new IconUIResource (new ImageIcon (LNF_ICON_IMAGE_16)),
  1279:       });
  1280:     }  //addCustomEntriesToTable(UIDefaults)
  1281: 
  1282:   }  //class XEiJTheme
  1283: 
  1284: 
  1285: 
  1286: }  //class LnF
  1287: 
  1288: 
  1289: