コード例 #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);
 }
コード例 #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();
   }
 }