Exemplo n.º 1
0
 private void applySelectedValue(JComboBox comboBox, Object value) {
   comboBox.removeItemListener(this);
   ValueLabelItem currentItem;
   for (int i = 0; i < comboBox.getItemCount(); i++) {
     currentItem = (ValueLabelItem) comboBox.getItemAt(i);
     if (currentItem.getValue().equals(value)) {
       comboBox.setSelectedIndex(i);
       break;
     }
   }
   comboBox.addItemListener(this);
 }
Exemplo n.º 2
0
 public void itemStateChanged(ItemEvent e) {
   ValueLabelItem item = (ValueLabelItem) e.getItem();
   if (e.getStateChange() == ItemEvent.SELECTED) {
     if (e.getSource() == lineThicknessBox) {
       annotation.getBorderStyle().setStrokeWidth((Float) item.getValue());
     } else if (e.getSource() == lineStyleBox) {
       annotation.getBorderStyle().setBorderStyle((Name) item.getValue());
     }
     // save the action state back to the document structure.
     updateCurrentAnnotation();
     currentAnnotationComponent.resetAppearanceShapes();
     currentAnnotationComponent.repaint();
   }
 }