本文整理汇总了Java中javax.swing.JTextField.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setVisible方法的具体用法?Java JTextField.setVisible怎么用?Java JTextField.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doComboBoxAction
import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
protected void doComboBoxAction() {
if (comboBox.getSelectedIndex() > 0) {
// get the params of the selected resource type.
paramNames = new ArrayList<String>();
paramValues = new ArrayList<JTextField>();
for (final Method m : ((ComboBoxClass) comboBox.getSelectedItem())
.getClasss().getDeclaredMethods()) {
// for every setter method get the name of the parameter to set
// and display it as a label along with a text field for setting
// the value.
if (m.isAnnotationPresent(ExchangeParameter.class)
&& m.getName().startsWith("set")) {
String name = m.getName().substring(3).toLowerCase();
paramNames.add(name);
JLabel paramName = new JLabel(name.replaceFirst("demanded",
"demanded "));
paramName.setVisible(true);
paramsPanel.add(paramName);
JTextField paramValue = new JTextField(3);
paramValue.setEditable(true);
paramValue.setVisible(true);
paramValues.add(paramValue);
paramsPanel.add(paramValue);
paramValue.requestFocus();
}
}
}
}
示例2: initPanel2
import javax.swing.JTextField; //导入方法依赖的package包/类
private void initPanel2(){
panel2 = new JPanel();
panel2.setLayout(new GridLayout(2,1));
testo = new JTextField();
testo.setVisible(true);
testo.setEditable(false);
int soldi = parcheggio.getCassa().getAmmount();
if (soldi==0) {
testo.setText("Non ci sono soldi nella cassa.");
}
else {
testo.setText("Ci sono "+soldi+"Euro nella cassa");
}
JButton bottone = new JButton("Ritira denaro");
bottone.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
int tmp = parcheggio.getCassa().ritira();
if (tmp==0) {
testo.setText("Non ci sono soldi nella cassa");
}
else {
testo.setText("Sono stati ritirati "+tmp+"Euro");
}
}
});
panel2.add(bottone);
panel2.add(testo);
this.add(panel2,BorderLayout.NORTH);
}
示例3: setType
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setType() {
int locationPoint = 323;
for (int i = 0; i < 3; i++) {
roomTypes = new JTextField();
roomTypes.setColumns(10);
roomTypes.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
roomTypes.setBounds(locationPoint, 97, 86, 20);
roomTypes.setVisible(false);
bottomPanel.add(roomTypes);
roomTypeFields[i] = roomTypes;
locationPoint = locationPoint + 96;
}
}
示例4: doComboBoxAction
import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
protected void doComboBoxAction() {
if (comboBox.getSelectedIndex() > 0) {
// get params of the selected resource type
paramNames = new ArrayList<String>();
paramValues = new ArrayList<JTextField>();
AbstractConstraint selectedCons = ((ComboBoxConstraint) comboBox
.getSelectedItem()).getConstraint();
for (final Method m : selectedCons.getClass().getDeclaredMethods()) {
if (m.isAnnotationPresent(ExchangeParameter.class)
&& m.getName().startsWith("set")) {
// For every setter method get the name of the parameter to
// set and display it as a label along with a text field for
// setting the value.
String name = m.getName().substring(3).toLowerCase();
paramNames.add(name);
JLabel paramName = new JLabel(name.replaceFirst("demanded",
"demanded "));
paramName.setVisible(true);
paramsPanel.add(paramName);
JTextField paramValue = new JTextField(3);
try {
paramValue
.setText(selectedCons
.getClass()
.getMethod(
"get"
+ m.getName()
.substring(3),
new Class<?>[0])
.invoke(selectedCons, new Object[0])
.toString());
} catch (Exception e) {
e.printStackTrace();
throw new AssertionError(
"Error occurred while trying to access a get Metdod of the Object "
+ entity);
}
paramValue.setEditable(true);
paramValue.setVisible(true);
paramValues.add(paramValue);
paramsPanel.add(paramValue);
paramValue.requestFocus();
}
}
}
}
示例5: BaseDialog
import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* Set up and show the dialog. The first Component argument determines which
* frame the dialog depends on; it should be a component in the dialog's
* controlling frame. The second Component argument should be null if you
* want the dialog to come up with its left corner in the center of the
* screen; otherwise, it should be the component on top of which the dialog
* should appear.
*/
public BaseDialog(Component frameComp, Component locationComp,
String title, I_TickerManager tickerManager) {
super(JOptionPane.getFrameForComponent(frameComp), title, true);
this.frameComp = frameComp;
dateChooser = new JDateChooser(Calendar.getInstance().getTime());
dateChooser.setLocale(new Locale("fi", "FI"));
this.tickerManager = tickerManager;
// Create and initialize the buttons.
cancelButton = new JButton(BUTTON_CANCEL);
cancelButton.addActionListener(this);
cancelButton.setActionCommand(BUTTON_CANCEL);
okButton = new JButton(BUTTON_OK);
okButton.setActionCommand(BUTTON_OK);
okButton.addActionListener(this);
getRootPane().setDefaultButton(okButton);
okButton.setEnabled(false);
rateField = new JTextField(FIELD_LEN);
rateField.setVisible(true);
rateField.setText("1.0000");
rateFieldLabel = new JLabel("Valuuttakurssi: ");
rateFieldLabel.setLabelFor(rateField);
rateFieldLabel.setVisible(true);
localCurrencyButton = new JRadioButton(localCurrencyString);
foreignCurrencyButton = new JRadioButton(foreignCurrencyString);
currencyGroup = new ButtonGroup();
localCurrencyButton.setActionCommand(localCurrencyString);
foreignCurrencyButton.setActionCommand(foreignCurrencyString);
localCurrencyButton.setSelected(true);
currencyGroup.add(localCurrencyButton);
currencyGroup.add(foreignCurrencyButton);
updateRateFieldCcy("EUR", false);
localCurrencyButton.addActionListener(this);
foreignCurrencyButton.addActionListener(this);
foreignCurrencyButton.setEnabled(false);
}