Example #1
0
 protected void createAttributeChoices(JPanel panel) {
   panel.add(new JLabel("Fill"));
   fFillColor = createColorChoice(FigureAttributeConstant.FILL_COLOR);
   panel.add(fFillColor);
   panel.add(new JLabel("Text"));
   fTextColor = createColorChoice(FigureAttributeConstant.TEXT_COLOR);
   panel.add(fTextColor);
   panel.add(new JLabel("Pen"));
   fFrameColor = createColorChoice(FigureAttributeConstant.FRAME_COLOR);
   panel.add(fFrameColor);
   panel.add(new JLabel("Arrow"));
   CommandChoice choice = new CommandChoice();
   fArrowChoice = choice;
   FigureAttributeConstant arrowMode = FigureAttributeConstant.ARROW_MODE;
   choice.addItem(
       new ChangeAttributeCommand(
           "none", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_NONE), this));
   choice.addItem(
       new ChangeAttributeCommand(
           "at Start", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_START), this));
   choice.addItem(
       new ChangeAttributeCommand(
           "at End", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_END), this));
   choice.addItem(
       new ChangeAttributeCommand(
           "at Both", arrowMode, new Integer(PolyLineFigure.ARROW_TIP_BOTH), this));
   panel.add(fArrowChoice);
   panel.add(new JLabel("Font"));
   fFontChoice = createFontChoice();
   panel.add(fFontChoice);
 }
Example #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;
 }
Example #3
0
 protected JComboBox createFontChoice() {
   CommandChoice choice = new CommandChoice();
   String fonts[] =
       GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
   for (int i = 0; i < fonts.length; i++) {
     choice.addItem(
         new ChangeAttributeCommand(fonts[i], FigureAttributeConstant.FONT_NAME, fonts[i], this));
   }
   return choice;
 }