edu.stanford.smi.protege.util
Class ComponentUtilities
java.lang.Object
edu.stanford.smi.protege.util.ComponentUtilities
public class ComponentUtilities
- extends Object
Utility methods for dealing with various swing components.
- Author:
- Ray Fergerson
Method Summary |
static TableColumn |
addColumn(JTable table,
String header,
TableCellRenderer renderer)
|
static TableColumn |
addColumn(JTable table,
TableCellRenderer renderer)
|
static TableColumn |
addColumn(JTable table,
TableCellRenderer renderer,
String header,
TableCellEditor editor)
|
static TableColumn |
addColumn(JTable table,
TableCellRenderer renderer,
TableCellEditor editor)
|
static int |
addListValue(JList list,
Object newValue)
|
static int |
addListValue(JList list,
Object newValue,
Comparator comparator)
|
static void |
addListValue(JList list,
Object newValue,
int index)
|
static void |
addListValues(JList list,
Collection newValues)
|
static int |
addSelectedListValue(JList list,
Object newValue)
|
static void |
addSelectedListValues(JList list,
Collection newValues)
|
static void |
addUniqueListValues(JList list,
Collection newValues)
|
static void |
apply(Component component,
UnaryFunction f)
|
static void |
applyToDescendents(Component component,
UnaryFunction f)
|
static void |
center(Component c)
|
static void |
clearListValues(JList list)
|
static void |
closeAllWindows()
|
static void |
closeWindow(Window window)
|
static void |
deregisterWindow(Window window)
|
static void |
dispose(Component component)
|
static void |
enableAllAntialiasing(Graphics graphics)
|
static void |
enableTextAntialiasing(Graphics graphics)
|
static void |
ensureSelectionIsVisible(JList list)
|
static boolean |
equals(Object o1,
Object o2)
|
static void |
extendSelection(JTree tree,
Object userObject)
|
static void |
fullSelectionCollapse(JTree tree)
|
static void |
fullSelectionExpand(JTree tree,
int max_expansions)
|
static Border |
getAlignBorder()
|
static LazyTreeNode |
getChildNode(LazyTreeNode node,
Object userObject)
|
static Dimension |
getDefaultMainFrameSize()
|
static Component |
getDescendentOfClass(Class componentClass,
Component root)
|
static Collection |
getDescendentsOfClass(Class componentClass,
Component root)
|
static Dialog |
getDialog(Component c)
|
static Object |
getFirstSelectionParent(JTree tree)
|
static Frame |
getFrame(Component c)
|
static Collection |
getListValues(JList list)
|
static JMenu |
getMenu(JMenuBar menuBar,
String menuText)
|
static JMenu |
getMenu(JMenuBar menuBar,
String menuText,
boolean create)
|
static JMenu |
getMenu(JMenuBar menuBar,
String menuText,
boolean create,
int menuIndex)
|
static Collection |
getObjectPath(TreePath path)
|
static Object |
getSelectedValue(JList list)
|
static Collection |
getSelection(JList list)
|
static Collection |
getSelection(JTable table)
|
static Collection |
getSelection(JTree tree)
|
static Collection |
getSelection(JTree tree,
Class c)
|
static int |
getStandardColumnWidth()
|
static int |
getStandardRowHeight()
|
static TreePath |
getTreePath(JTree tree,
Collection objectPath)
|
static void |
hide(Component c,
int delayInMillisec)
|
static boolean |
isDragAndDropEnabled(JComponent c)
|
static boolean |
listValuesContain(JList list,
Object value)
|
static ImageIcon |
loadImageIcon(Class clas,
String iconPath)
Loads a icon from either the file system or from a jar. |
static JLabel |
modifyLabelFont(JLabel label,
int style,
int delta)
|
static void |
pack(Component c)
|
static void |
paintImmediately(Component component)
|
static void |
registerWindow(Window window)
|
static void |
removeListValue(JList list,
Object oldValue)
|
static void |
removeListValues(JList list,
Collection values)
|
static void |
removeMenuItem(JMenu menu,
String menuItemText)
|
static void |
removeSelection(JTree tree)
|
static void |
replaceListValue(JList list,
Object oldValue,
Object newValue)
|
static void |
reposition(JList list,
Object value,
Comparator comparator)
|
static void |
requestFocus(JComponent component)
|
static void |
scrollToVisible(JTable table,
int rowIndex,
int vColIndex)
Scrolls a table so that a certain cell becomes visible. |
static void |
setDisplayParent(JTree tree,
Object parent,
Object child,
Traverser traverser)
|
static void |
setDisplayParent(JTree tree,
Object parent,
Traverser traverser)
|
static void |
setDragAndDropEnabled(JComponent c,
boolean enable)
|
static void |
setEnabled(Component component,
boolean enabled)
|
static void |
setExpanded(JTree tree,
Collection objectPath,
boolean expand)
|
static void |
setFrameTitle(Component c,
String title)
|
static void |
setListValues(JList list,
Collection values)
|
static void |
setSelectedNode(JTree tree,
TreeNode node)
|
static void |
setSelectedObjectPath(JTree tree,
Collection objectPath)
|
static void |
setSelectedObjectPaths(JTree tree,
Collection objectPaths)
|
static void |
setSelectedValue(JList list,
Object value)
|
static void |
setSelectedValues(JList list,
Collection values)
|
static JLabel |
setSmallLabelFont(JLabel label)
|
static JLabel |
setTitleLabelFont(JLabel label)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ComponentUtilities
public ComponentUtilities()
addColumn
public static TableColumn addColumn(JTable table,
TableCellRenderer renderer)
addColumn
public static TableColumn addColumn(JTable table,
String header,
TableCellRenderer renderer)
addColumn
public static TableColumn addColumn(JTable table,
TableCellRenderer renderer,
TableCellEditor editor)
addColumn
public static TableColumn addColumn(JTable table,
TableCellRenderer renderer,
String header,
TableCellEditor editor)
addListValue
public static int addListValue(JList list,
Object newValue)
addListValue
public static void addListValue(JList list,
Object newValue,
int index)
addListValue
public static int addListValue(JList list,
Object newValue,
Comparator comparator)
addListValues
public static void addListValues(JList list,
Collection newValues)
addSelectedListValue
public static int addSelectedListValue(JList list,
Object newValue)
addSelectedListValues
public static void addSelectedListValues(JList list,
Collection newValues)
addUniqueListValues
public static void addUniqueListValues(JList list,
Collection newValues)
apply
public static void apply(Component component,
UnaryFunction f)
applyToDescendents
public static void applyToDescendents(Component component,
UnaryFunction f)
center
public static void center(Component c)
clearListValues
public static void clearListValues(JList list)
closeAllWindows
public static void closeAllWindows()
closeWindow
public static void closeWindow(Window window)
deregisterWindow
public static void deregisterWindow(Window window)
dispose
public static void dispose(Component component)
ensureSelectionIsVisible
public static void ensureSelectionIsVisible(JList list)
extendSelection
public static void extendSelection(JTree tree,
Object userObject)
fullSelectionCollapse
public static void fullSelectionCollapse(JTree tree)
fullSelectionExpand
public static void fullSelectionExpand(JTree tree,
int max_expansions)
getChildNode
public static LazyTreeNode getChildNode(LazyTreeNode node,
Object userObject)
equals
public static boolean equals(Object o1,
Object o2)
getDescendentOfClass
public static Component getDescendentOfClass(Class componentClass,
Component root)
getDescendentsOfClass
public static Collection getDescendentsOfClass(Class componentClass,
Component root)
getDialog
public static Dialog getDialog(Component c)
getFirstSelectionParent
public static Object getFirstSelectionParent(JTree tree)
getFrame
public static Frame getFrame(Component c)
getListValues
public static Collection getListValues(JList list)
getSelectedValue
public static Object getSelectedValue(JList list)
getSelection
public static Collection getSelection(JList list)
setSelectedValue
public static void setSelectedValue(JList list,
Object value)
setSelectedValues
public static void setSelectedValues(JList list,
Collection values)
getSelection
public static Collection getSelection(JTable table)
getSelection
public static Collection getSelection(JTree tree)
getSelection
public static Collection getSelection(JTree tree,
Class c)
getStandardColumnWidth
public static int getStandardColumnWidth()
getStandardRowHeight
public static int getStandardRowHeight()
getTreePath
public static TreePath getTreePath(JTree tree,
Collection objectPath)
getObjectPath
public static Collection getObjectPath(TreePath path)
hide
public static void hide(Component c,
int delayInMillisec)
isDragAndDropEnabled
public static boolean isDragAndDropEnabled(JComponent c)
listValuesContain
public static boolean listValuesContain(JList list,
Object value)
loadImageIcon
public static ImageIcon loadImageIcon(Class clas,
String iconPath)
- Loads a icon from either the file system or from a jar.
- Parameters:
clas
- A class used to resolve the icon's relative path nameiconPath
- the path relative to the clas in which to find the icon.
- Returns:
- an image icon for the icon, or null if not found
for a directory structure like
edu/
mypackage/
MyClass.class
images/
myicon.gif
call loadImageIcon(MyClass.class, "images/myicon.gif");
pack
public static void pack(Component c)
getDefaultMainFrameSize
public static Dimension getDefaultMainFrameSize()
paintImmediately
public static void paintImmediately(Component component)
registerWindow
public static void registerWindow(Window window)
removeListValue
public static void removeListValue(JList list,
Object oldValue)
removeListValues
public static void removeListValues(JList list,
Collection values)
removeSelection
public static void removeSelection(JTree tree)
replaceListValue
public static void replaceListValue(JList list,
Object oldValue,
Object newValue)
reposition
public static void reposition(JList list,
Object value,
Comparator comparator)
setDragAndDropEnabled
public static void setDragAndDropEnabled(JComponent c,
boolean enable)
setEnabled
public static void setEnabled(Component component,
boolean enabled)
setExpanded
public static void setExpanded(JTree tree,
Collection objectPath,
boolean expand)
setFrameTitle
public static void setFrameTitle(Component c,
String title)
setListValues
public static void setListValues(JList list,
Collection values)
setSelectedNode
public static void setSelectedNode(JTree tree,
TreeNode node)
setSelectedObjectPath
public static void setSelectedObjectPath(JTree tree,
Collection objectPath)
setSelectedObjectPaths
public static void setSelectedObjectPaths(JTree tree,
Collection objectPaths)
requestFocus
public static void requestFocus(JComponent component)
setDisplayParent
public static void setDisplayParent(JTree tree,
Object parent,
Traverser traverser)
setDisplayParent
public static void setDisplayParent(JTree tree,
Object parent,
Object child,
Traverser traverser)
setTitleLabelFont
public static JLabel setTitleLabelFont(JLabel label)
setSmallLabelFont
public static JLabel setSmallLabelFont(JLabel label)
modifyLabelFont
public static JLabel modifyLabelFont(JLabel label,
int style,
int delta)
enableTextAntialiasing
public static void enableTextAntialiasing(Graphics graphics)
enableAllAntialiasing
public static void enableAllAntialiasing(Graphics graphics)
getAlignBorder
public static Border getAlignBorder()
scrollToVisible
public static void scrollToVisible(JTable table,
int rowIndex,
int vColIndex)
- Scrolls a table so that a certain cell becomes visible.
Source: http://javaalmanac.com/egs/javax.swing.table/Vis.html
- Parameters:
table
- rowIndex
- vColIndex
-
getMenu
public static JMenu getMenu(JMenuBar menuBar,
String menuText)
getMenu
public static JMenu getMenu(JMenuBar menuBar,
String menuText,
boolean create)
getMenu
public static JMenu getMenu(JMenuBar menuBar,
String menuText,
boolean create,
int menuIndex)
removeMenuItem
public static void removeMenuItem(JMenu menu,
String menuItemText)
Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2009 Stanford University.