Revision 10261 trunk/libraries/libUI/src/org/gvsig/gui/beans/swing/jComboBoxWithImageIconItems/JComboBoxWithImageIconItems.java
JComboBoxWithImageIconItems.java | ||
---|---|---|
3 | 3 |
import java.awt.Component; |
4 | 4 |
import java.awt.Dimension; |
5 | 5 |
import java.awt.Font; |
6 |
import java.awt.event.ActionListener; |
|
7 | 6 |
import java.io.Serializable; |
8 | 7 |
import java.util.Vector; |
9 | 8 |
|
... | ... | |
63 | 62 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
64 | 63 |
*/ |
65 | 64 |
public class JComboBoxWithImageIconItems extends JComboBox implements Serializable { |
66 |
private static final long serialVersionUID = -8389538050411178148L;
|
|
65 |
private static final long serialVersionUID = -2423483052971097560L;
|
|
67 | 66 |
|
68 | 67 |
public static final int DEFAULT_ROW_COUNT = 3; |
68 |
|
|
69 |
private JComboBoxWithImageIconItems referenceToThisJComboBoxWithImageIconItems; |
|
69 | 70 |
|
70 | 71 |
/** |
71 | 72 |
* Default constructor |
... | ... | |
78 | 79 |
* Initialize this component |
79 | 80 |
*/ |
80 | 81 |
private void initialize() { |
82 |
this.referenceToThisJComboBoxWithImageIconItems = this; |
|
81 | 83 |
this.setModel(new ComboBoxImageIconModel()); |
82 | 84 |
this.setRenderer(new ComboBoxImageIconRenderer()); |
83 | 85 |
this.setMaximumRowCount(DEFAULT_ROW_COUNT); |
... | ... | |
338 | 340 |
return this.getMaximumRowCount(); |
339 | 341 |
} |
340 | 342 |
|
341 |
///// LISTENERES TO THE JCOMBOBOX ///// |
|
342 | 343 |
/** |
343 |
* Adds an action listener to the JComboBox |
|
344 |
* |
|
345 |
* @param l An action listener |
|
346 |
*/ |
|
347 |
public void addActionListenerToJComboBox(ActionListener l) { |
|
348 |
this.addActionListener(l); |
|
349 |
} |
|
350 |
|
|
351 |
// /** |
|
352 |
// * Adds an ancestor listener to the JComboBox |
|
353 |
// * |
|
354 |
// * @param l An ancestor listener |
|
355 |
// */ |
|
356 |
// public void addAncestorListenerToJComboBox(AncestorListener l) { |
|
357 |
// this.addAncestorListener(l); |
|
358 |
// } |
|
359 |
// |
|
360 |
// /** |
|
361 |
// * Adds a component listener to the JComboBox |
|
362 |
// * |
|
363 |
// * @param l A component listener |
|
364 |
// */ |
|
365 |
// public void addComponentListenerToJComboBox(ComponentListener l) { |
|
366 |
// this.addComponentListener(l); |
|
367 |
// } |
|
368 |
// |
|
369 |
// /** |
|
370 |
// * Adds a container listener to the JComboBox |
|
371 |
// * |
|
372 |
// * @param l A container listener |
|
373 |
// */ |
|
374 |
// public void addContainerListenerToJComboBox(ContainerListener l) { |
|
375 |
// this.addContainerListener(l); |
|
376 |
// } |
|
377 |
// |
|
378 |
// /** |
|
379 |
// * Adds a focus listener to the JComboBox |
|
380 |
// * |
|
381 |
// * @param l A focus listener |
|
382 |
// */ |
|
383 |
// public void addFocusListenerToJComboBox(FocusListener l) { |
|
384 |
// this.addFocusListener(l); |
|
385 |
// } |
|
386 |
// |
|
387 |
// /** |
|
388 |
// * Adds a hierarchy bounds listener to the JComboBox |
|
389 |
// * |
|
390 |
// * @param l A hierarchy bounds listener |
|
391 |
// */ |
|
392 |
// public void addHierarchyBoundsListenerToJComboBox(HierarchyBoundsListener l) { |
|
393 |
// this.addHierarchyBoundsListener(l); |
|
394 |
// } |
|
395 |
// |
|
396 |
// /** |
|
397 |
// * Adds a hierarchy listener to the JComboBox |
|
398 |
// * |
|
399 |
// * @param l A hierarchy listener |
|
400 |
// */ |
|
401 |
// public void addHierarchyListenerToJComboBox(HierarchyListener l) { |
|
402 |
// this.addHierarchyListener(l); |
|
403 |
// } |
|
404 |
// |
|
405 |
// /** |
|
406 |
// * Adds an input method listener to the JComboBox |
|
407 |
// * |
|
408 |
// * @param l An input method listener |
|
409 |
// */ |
|
410 |
// public void addInputMethodListenerToJComboBox(InputMethodListener l) { |
|
411 |
// this.addInputMethodListener(l); |
|
412 |
// } |
|
413 |
// |
|
414 |
// /** |
|
415 |
// * Adds an item listener to the JComboBox |
|
416 |
// * |
|
417 |
// * @param l An item listener |
|
418 |
// */ |
|
419 |
// public void addItemListenerToJComboBox(ItemListener l) { |
|
420 |
// this.addItemListener(l); |
|
421 |
// } |
|
422 |
// |
|
423 |
// /** |
|
424 |
// * Adds a key listener to the JComboBox |
|
425 |
// * |
|
426 |
// * @param l A key listener |
|
427 |
// */ |
|
428 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
429 |
// this.addKeyListener(l); |
|
430 |
// } |
|
431 |
// |
|
432 |
// /** |
|
433 |
// * Adds a mouse listener to the JComboBox |
|
434 |
// * |
|
435 |
// * @param l A mouse listener |
|
436 |
// */ |
|
437 |
// public void addMouseListenerToJComboBox(MouseListener l) { |
|
438 |
// this.addMouseListener(l); |
|
439 |
// } |
|
440 |
// |
|
441 |
// /** |
|
442 |
// * Adds a key listener to the JComboBox |
|
443 |
// * |
|
444 |
// * @param l A key listener |
|
445 |
// */ |
|
446 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
447 |
// this..addKeyListener(l); |
|
448 |
// } |
|
449 |
// |
|
450 |
// /** |
|
451 |
// * Adds a key listener to the JComboBox |
|
452 |
// * |
|
453 |
// * @param l A key listener |
|
454 |
// */ |
|
455 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
456 |
// this.addKeyListener(l); |
|
457 |
// } |
|
458 |
// |
|
459 |
// /** |
|
460 |
// * Adds a key listener to the JComboBox |
|
461 |
// * |
|
462 |
// * @param l A key listener |
|
463 |
// */ |
|
464 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
465 |
// this.addKeyListener(l); |
|
466 |
// } |
|
467 |
// |
|
468 |
// /** |
|
469 |
// * Adds a key listener to the JComboBox |
|
470 |
// * |
|
471 |
// * @param l A key listener |
|
472 |
// */ |
|
473 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
474 |
// this.addKeyListener(l); |
|
475 |
// } |
|
476 |
// |
|
477 |
// /** |
|
478 |
// * Adds a key listener to the JComboBox |
|
479 |
// * |
|
480 |
// * @param l A key listener |
|
481 |
// */ |
|
482 |
// public void addKeyListenerToJComboBox(KeyListener l) { |
|
483 |
// this.addKeyListener(l); |
|
484 |
// } |
|
485 |
|
|
486 |
///// END LISTENERES TO THE JCOMBOBOX ///// |
|
487 |
|
|
488 |
/** |
|
489 | 344 |
* Model for 'JPanelWithJComboBoxImageIconItems', stores the attribute 'showImageIconAndText' |
490 | 345 |
* |
491 | 346 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
... | ... | |
593 | 448 |
|
594 | 449 |
if (toolTipText != null) { |
595 | 450 |
setToolTipText(toolTipText); |
596 |
this.setToolTipText(toolTipText);
|
|
451 |
referenceToThisJComboBoxWithImageIconItems.setToolTipText(toolTipText);
|
|
597 | 452 |
} |
598 | 453 |
|
599 | 454 |
if (getShowImageIconAndTextProperty()) { |
... | ... | |
614 | 469 |
// Empty previous information |
615 | 470 |
setIcon(null); |
616 | 471 |
setToolTipText(""); |
617 |
this.setToolTipText("");
|
|
472 |
referenceToThisJComboBoxWithImageIconItems.setToolTipText("");
|
|
618 | 473 |
setText(""); |
619 | 474 |
} |
620 | 475 |
|
... | ... | |
636 | 491 |
setText(uhOhText); |
637 | 492 |
} |
638 | 493 |
} |
639 |
} |
|
640 |
|
|
494 |
} |
Also available in: Unified diff