示例#1
0
 private void setupAttributes() {
   Color frameColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR);
   Color fillColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR);
   Integer arrowMode =
       (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE);
   String fontName =
       (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME);
   FigureEnumeration fe = view().selection();
   while (fe.hasNextFigure()) {
     Figure f = fe.nextFigure();
     frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR);
     fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR);
     arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE);
     fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME);
   }
   fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor));
   fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor));
   if (arrowMode != null) {
     fArrowChoice.setSelectedIndex(arrowMode.intValue());
   }
   if (fontName != null) {
     fFontChoice.setSelectedItem(fontName);
   }
 }
示例#2
0
 protected JComboBox createColorChoice(FigureAttributeConstant attribute) {
   CommandChoice choice = new CommandChoice();
   for (int i = 0; i < ColorMap.size(); i++)
     choice.addItem(
         new ChangeAttributeCommand(ColorMap.name(i), attribute, ColorMap.color(i), this));
   return choice;
 }