/**
* Create the frame.
*/
public AddBreakPoint(DefaultListModel<BreakPoint> breakpoint) {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JComboBox<Object> comboBox = new JComboBox<Object>();
comboBox.setModel(new DefaultComboBoxModel<Object>(Variable.values()));
comboBox.setBounds(10, 115, 141, 20);
contentPane.add(comboBox);
textField = new JTextField();
textField.setBounds(226, 115, 141, 20);
contentPane.add(textField);
textField.setColumns(10);
JButton btnAddBreakpoint = new JButton("Add BreakPoint");
btnAddBreakpoint.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Object val = null;
String text = textField.getText().toLowerCase();
if(text.equals("true"))
val = true;
else if(text.equals("false"))
val = false;
else{
val = Integer.parseInt(text, 16);
}
breakpoint.addElement(new BreakPoint((Variable) comboBox.getSelectedItem(),val));
setVisible(false);
dispose();
}
});
btnAddBreakpoint.setBounds(138, 191, 141, 23);
contentPane.add(btnAddBreakpoint);
}
java类javax.swing.JTextField的实例源码
AddBreakPoint.java 文件源码
项目:BassNES
阅读 15
收藏 0
点赞 0
评论 0
OAuthValueCellEditor.java 文件源码
项目:rapidminer
阅读 15
收藏 0
点赞 0
评论 0
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
if (value != null) {
((JTextField) editorComponent).setText(String.valueOf(value));
}
return container;
}
JTextFieldOperator.java 文件源码
项目:openjdk-jdk10
阅读 15
收藏 0
点赞 0
评论 0
/**
* Maps {@code JTextField.getScrollOffset()} through queue
*/
public int getScrollOffset() {
return (runMapping(new MapIntegerAction("getScrollOffset") {
@Override
public int map() {
return ((JTextField) getSource()).getScrollOffset();
}
}));
}
PropertyPanel.java 文件源码
项目:incubator-netbeans
阅读 25
收藏 0
点赞 0
评论 0
private void keyBundleTextChanged() {
if (internalTextChange == 0) {
String key = ((JTextField) keyBundleCombo.getEditor().getEditorComponent()).getText();
if (!key.equals(i18nString.getKey())) {
i18nString.setKey(key);
firePropertyChange(PROP_STRING, null, null);
}
}
}
LoginDialogTest.java 文件源码
项目:Dahlem_SER316
阅读 17
收藏 0
点赞 0
评论 0
/**
* Tests to ensure account is not generated when it shouldn't be. For
* example: Differing passwords or account already exists. This does not
* validate the account creation process details.
*/
@Test
public void testAccountCreation() {
JTextField usernameField = dlg.getUsernameField();
JPasswordField passPrimary = dlg.getPasswordFieldPrimary();
JPasswordField passVerify = dlg.getPasswordFieldVerify();
JButton button = dlg.getBtnCreateNewAccount();
// Test account created no password
usernameField.setText("HeyTestGuy1");
passPrimary.setText("");
passVerify.setText("");
button.doClick();
assertTrue(AccountManager.userExists("HeyTestGuy1"));
// Test account NOT created - mismatched password
usernameField.setText("HeyTestGuy2");
passPrimary.setText("ardvark");
passVerify.setText("");
button.doClick();
assertFalse(AccountManager.userExists("HeyTestGuy2"));
//Test all correct values.
usernameField.setText("HeyTestGuy3");
passPrimary.setText("ardvark");
passVerify.setText("ardvark");
button.doClick();
assertTrue(AccountManager.userExists("HeyTestGuy3"));
assertTrue(AccountManager.removeUserAccount("HeyTestGuy1"));
assertTrue(AccountManager.removeUserAccount("HeyTestGuy3"));
}
ScheduleJTable.java 文件源码
项目:COE1186
阅读 16
收藏 0
点赞 0
评论 0
private void addTextAreaToColumn() {
//Create the ComboBox and add the line blocks to it
JTextField textArea = new JTextField();
//Add a listener to the ComboBox, add stop when state changes
textArea.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
int row = table.getSelectedRow();
String timeToDwell = textArea.getText();
if(SimTime.isValid(timeToDwell) && row>=0) {
schedule.addStop(row, new SimTime(timeToDwell));
fireScheduleChanged();
}
}
});
//Put the TextArea into the JTable cell
DefaultCellEditor textAreaEditor = new DefaultCellEditor(textArea);
this.getColumnModel().getColumn(1).setCellEditor(textAreaEditor);
//Add a tooltip
DefaultTableCellRenderer textAreaRenderer = new DefaultTableCellRenderer();
textAreaRenderer.setToolTipText("Type time to spend at the station");
this.getColumnModel().getColumn(1).setCellRenderer(textAreaRenderer);
}
OAIPlugin.java 文件源码
项目:Equella
阅读 14
收藏 0
点赞 0
评论 0
@Override
public void initGUI()
{
serverField = new JTextField();
JPanel setsPanel = new JPanel();
aSetField = new JComboBox<>();
aSetField.setEditable(true);
getSetsButton = new JButton(getString("oaiplugin.getsets"));
getSetsButton.addActionListener(this);
setupPanel(setsPanel, aSetField, getSetsButton);
JPanel metaPanel = new JPanel();
metaField = new JComboBox<>();
metaField.setEditable(true);
getMetaButton = new JButton(getString("oaiplugin.getmetas"));
getMetaButton.addActionListener(this);
setupPanel(metaPanel, metaField, getMetaButton);
panel.addComponent(new JLabel(getString("oaiplugin.settings")));
panel.addNameAndComponent(getString("oaiplugin.server"), serverField);
panel.addNameAndComponent(getString("oaiplugin.format"), metaPanel);
panel.addNameAndComponent(getString("oaiplugin.aset"), setsPanel);
}
BaseTable.java 文件源码
项目:incubator-netbeans
阅读 25
收藏 0
点赞 0
评论 0
public void focusGained(FocusEvent e) {
//it will be the first focus gained event, so go select
//whatever matches the first character
processSearchText(((JTextField) e.getSource()).getText());
JRootPane root = getRootPane();
if (root != null) { // #57417 NPE
root.getLayeredPane().repaint();
}
setCaretPosition(getText().length());
}
Tapahtumankuuntelija.java 文件源码
项目:ohjelmistotuotanto2017
阅读 16
收藏 0
点赞 0
评论 0
public Tapahtumankuuntelija(JButton plus, JButton miinus, JButton nollaa, JButton undo, JTextField tuloskentta, JTextField syotekentta) {
this.plus = plus;
this.miinus = miinus;
this.nollaa = nollaa;
this.undo = undo;
this.tuloskentta = tuloskentta;
this.syotekentta = syotekentta;
this.sovellus = new Sovelluslogiikka();
}
ClassSelectionPanel.java 文件源码
项目:AgentWorkbench
阅读 15
收藏 0
点赞 0
评论 0
/**
* This method checks if a given class reference is valid.
*
* @param jTextField the j text field
* @param jButton the j button
* @return true, if is valid class
*/
private boolean isValidClass(JTextField jTextField) {
String className = jTextField.getText().trim();
if (this.class2Search4DefaultValue==null && className.equals("")) {
// --- If no default value is configured, an empty text field is allowed -----
this.getJButtonCheckClass().setIcon(this.imageGreen);
this.setValidClass(true);
return true;
} else if (isAllowNull()==true && className.equals("")) {
this.getJButtonCheckClass().setIcon(this.imageGreen);
this.setValidClass(true);
return true;
} else {
// --- If a default value is configured, there should be a valid class ------
try {
@SuppressWarnings("unused")
Class<?> clazz = BaseClassLoadServiceUtility.forName(className);
this.getJButtonCheckClass().setIcon(this.imageGreen);
this.setValidClass(true);
return true;
} catch (ClassNotFoundException e) {
//e.printStackTrace();
this.getJButtonCheckClass().setIcon(this.imageRed);
}
}
this.setValidClass(false);
return false;
}