-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add renderer so that truncated names have full tooltips of arbitrary …
…length
- Loading branch information
Showing
2 changed files
with
37 additions
and
18 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Gui/opensim/view/src/org/opensim/view/nodes/ListCellRendererWithTooltip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package org.opensim.view.nodes; | ||
|
||
import java.awt.Component; | ||
import javax.swing.JComboBox; | ||
import javax.swing.JLabel; | ||
import javax.swing.JList; | ||
import javax.swing.plaf.basic.BasicComboBoxRenderer; | ||
|
||
/** | ||
* | ||
* @author ayman | ||
*/ | ||
public class ListCellRendererWithTooltip extends BasicComboBoxRenderer { | ||
JComboBox combox; | ||
public ListCellRendererWithTooltip(JComboBox comboBox){ | ||
this.combox = comboBox; | ||
} | ||
|
||
@Override | ||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { | ||
Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //To change body of generated methods, choose Tools | Template | ||
((JLabel) comp).setToolTipText(value.toString()); | ||
return comp; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters