예제 #1
0
  /** Creates the attribute choices. Override to add additional choices. */
  protected void createAttributeChoices(JPanel panel) {
    panel.add(new JLabel("Fill"));
    fFillColor = createColorChoice("FillColor");
    panel.add(fFillColor);

    panel.add(new JLabel("Text"));
    fTextColor = createColorChoice("TextColor");
    panel.add(fTextColor);

    panel.add(new JLabel("Pen"));
    fFrameColor = createColorChoice("FrameColor");
    panel.add(fFrameColor);

    panel.add(new JLabel("Arrow"));
    CommandChoice choice = new CommandChoice();
    fArrowChoice = choice;
    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);
  }
예제 #2
0
 /** Creates the color choice for the given attribute. */
 protected JComboBox createColorChoice(String 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;
 }
예제 #3
0
 /** Creates the font choice. The choice is filled with all the fonts supported by the toolkit. */
 protected JComboBox createFontChoice() {
   CommandChoice choice = new CommandChoice();
   String fonts[] = Toolkit.getDefaultToolkit().getFontList();
   for (int i = 0; i < fonts.length; i++) {
     choice.addItem(new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], this));
   }
   return choice;
 }
예제 #4
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;
 }