本文整理汇总了Java中javax.swing.JTextField.setOpaque方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setOpaque方法的具体用法?Java JTextField.setOpaque怎么用?Java JTextField.setOpaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setOpaque方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FreeColStringInputDialog
import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* Creates a dialog to input a string field.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param frame The owner frame.
* @param modal True if this dialog should be modal.
* @param text Text that explains the action to the user.
* @param defaultValue The default value appearing in the text field.
* @param okKey A key displayed on the "ok"-button.
* @param cancelKey A key displayed on the optional "cancel"-button.
*/
public FreeColStringInputDialog(FreeColClient freeColClient, JFrame frame,
boolean modal, String text, String defaultValue,
String okKey, String cancelKey) {
super(freeColClient, frame);
textField = new JTextField(defaultValue);
textField.setOpaque(false);
JPanel panel = new JPanel(new BorderLayout()) {
@Override
public void requestFocus() {
textField.requestFocus();
}
};
panel.setOpaque(false);
panel.add(Utility.getDefaultTextArea(text));
panel.add(textField, BorderLayout.PAGE_END);
initializeInputDialog(frame, modal, panel, null, okKey, cancelKey);
}