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); } }
protected void createButtons(JPanel panel) { panel.add(new Filler(24, 20)); JComboBox drawingChoice = new JComboBox(); drawingChoice.addItem(fgUntitled); String param = getParameter("DRAWINGS"); if (param == null) { param = ""; } StringTokenizer st = new StringTokenizer(param); while (st.hasMoreTokens()) { drawingChoice.addItem(st.nextToken()); } if (drawingChoice.getItemCount() > 1) { panel.add(drawingChoice); } else { panel.add(new JLabel(fgUntitled)); } drawingChoice.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { loadDrawing((String) e.getItem()); } } }); panel.add(new Filler(6, 20)); JButton button; button = new CommandButton(new DeleteCommand("Delete", this)); panel.add(button); button = new CommandButton(new DuplicateCommand("Duplicate", this)); panel.add(button); button = new CommandButton(new GroupCommand("Group", this)); panel.add(button); button = new CommandButton(new UngroupCommand("Ungroup", this)); panel.add(button); button = new JButton("Help"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { showHelp(); } }); panel.add(button); fUpdateButton = new JButton("Simple Update"); fUpdateButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (fSimpleUpdate) { setBufferedDisplayUpdate(); } else { setSimpleDisplayUpdate(); } } }); }