示例#1
0
 public AboutDialog(JFrame frame, URL aboutURL, String title) {
   super(frame);
   getContentPane().setLayout(new BorderLayout());
   try {
     text = Utilities.toString(aboutURL, Charset.forName("utf-8"));
   } catch (IOException e) {
     throw new IllegalArgumentException("cannot read about text from " + aboutURL);
   }
   text = Utilities.unixEncode(text);
   showPanel();
   setModal(true);
   setTitle(title);
   pack();
   UIUtilities.centerWindow(this);
 }
示例#2
0
 public static Stroke getStroke(StrokeType type, int width) {
   Pair<StrokeType, Integer> key = Utilities.pair(type, width);
   Stroke stroke = strokeCache.get(key);
   if (stroke == null) {
     int cap = BasicStroke.CAP_BUTT;
     int join = BasicStroke.JOIN_ROUND;
     float miterlimit = 1F;
     float dash_phase = 0F;
     stroke = new BasicStroke(width, cap, join, miterlimit, dashes[type.ordinal()], dash_phase);
     synchronized (strokeCache) {
       strokeCache.put(key, stroke);
     }
   }
   return stroke;
 }