本文整理汇总了Java中javax.swing.JTextField.setAction方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setAction方法的具体用法?Java JTextField.setAction怎么用?Java JTextField.setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupGui
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupGui()
{
JLabel label = new JLabel(CurrentLocale.get("com.tle.admin.security.tree.itemsearcher.search"));
query = new JTextField();
query.setAction(searchAction);
JButton search = new JButton(searchAction);
model = new MyTableModel();
table = new JTable(model)
{
private static final long serialVersionUID = 1L;
@Override
public String getToolTipText(MouseEvent event)
{
String tip = null;
int rowIndex = rowAtPoint(event.getPoint());
if( rowIndex != -1 )
{
tip = ItemSearcher.this.model.getItemDescription(rowIndex);
}
if( tip == null || tip.trim().length() == 0 )
{
tip = CurrentLocale.get("com.tle.admin.security.tree.itemsearcher.nodesc");
}
else if( tip.length() > 100 )
{
tip = tip.substring(0, 100) + "...";
}
return tip;
}
};
table.getSelectionModel().addListSelectionListener(this);
JScrollPane scroller = new JScrollPane(table);
countLabel = new JLabel();
next = new JButton(">");
prev = new JButton("<");
next.setEnabled(false);
prev.setEnabled(false);
next.addActionListener(this);
prev.addActionListener(this);
final int width1 = label.getPreferredSize().width;
final int width2 = search.getPreferredSize().width;
final int height = search.getPreferredSize().height;
final int[] rows = {height, TableLayout.FILL, height,};
final int[] cols = {width1, TableLayout.FILL, width2, width2,};
setLayout(new TableLayout(rows, cols));
setBorder(AppletGuiUtils.DEFAULT_BORDER);
add(label, new Rectangle(0, 0, 1, 1));
add(query, new Rectangle(1, 0, 2, 1));
add(search, new Rectangle(3, 0, 1, 1));
add(scroller, new Rectangle(0, 1, 4, 1));
add(countLabel, new Rectangle(0, 2, 2, 1));
add(prev, new Rectangle(2, 2, 1, 1));
add(next, new Rectangle(3, 2, 1, 1));
updateEditor();
}