I am building gui in netbeans... Or trying to is more like it. I keep getting an error in my code in the gray area that netbeans adds which evidently is a area that I can not edit.
it currently says this...
answerBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Answer Call" }));
answerBox.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
}
public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
answerBoxPopupMenuWillBecomeInvisible(evt);
}
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
}
});
the error is on this line
answerBoxPopupMenuWillBecomeInvisible(evt);
In order to fix it when it says I need to remove answerBox from the beginning of the line, and I don't recall even adding a popupmenu in the first place so I am trying to figure out how to
hot to edit this line of code to see if it fixes my problem?
how can I delete things like this from the designer mode if they are giving me problems?
It appears that the event method answerBoxPopupMenuWillBecomeInvisible may no longer exist.
You could go into the "Events" tab of the property sheet and remove the associated event.
Failing that, you could open the file in something like NotePad++ and simply remove the entire listener registration code block
Related
I inserted a text field and now I just want it to say "working" within the text field. I do not have any errors, but when the display comes up the text field is empty. The first line of the code below was generated by netbeans. I wrote the second line.
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText("working");
}
Looks like you are trying to do that in the wrong method --> jTextField1ActionPerformed
try moving this to a OnClickEvent or in the initComponents of the App
jTextField1.setText("working");
When I am editing grid inline I can save or cancel my grid row changes. I want to update my database entries after button 'save' will be pushed(Data base mechanism has already done) How can I implement it?
My container:
BeanItemContainer<CategoryOfService> beansContainer;
Editing view:
All what I need it know which listeners I have to use. I found some CommitHandler which I can add by EditorFieldGroup class but I can't implement it properly maybe there is have to be another way to resolve problem.
There's kind of a way to capture inline Save click on the grid.
grid.getEditorFieldGroup().addCommitHandler(new FieldGroup.CommitHandler() {
#Override
public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
//...
}
#Override
public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException {
//...
}
});
After clicking Save both methods preCommit and postCommit get called.
Hope it helps :)
Grid does not currently give you any direct way of adding listeners to the save and cancel buttons for the inline editor, although that is something that might change in Vaadin 7.6.
As a workaround before that happens, the CommitHandler approach that you already mentioned is still supposed to work. You can find a basic example here. The contents of your BeanItemContainer should be fully updated in the postCommit phase.
grid.getEditor().addSaveListener((EditorSaveListener<Product>) event -> {
//your stuf
HibernateDataSource.updateProduct(event.getBean());
});
I created one JavaFX application where I'm updating log with one background process. So I'm setting log text in TextArea and setting scroll to bottom using logs.setScrollTop(Double.MAX_VALUE). but scrollbar is set to little bit up from the bottom.
I also tried TextFlow inside ScrollPan and setting scroll to bottom using logDisplay.setVvalue(1.0). It is also giving the same result.
Platform.runLater(() -> {
logs.setText([setting log text]);//TextArea logs
logs.setScrollTop(Double.MAX_VALUE));
});
//For TextFlow inside ScrollPane
Platform.runLater(() -> {
logs.setText([setting log text]);//Text logs
logDisplay.setVvalue(1.0);
});
I also tried to run code in separate thread like
new Thread() {
public void run(){
System.out.println("called set test");
logs.setText([setting log text]);//Text logs
logDisplay.setVvalue(1.0);
}
}.start();
But nothing is working :(
Can you help me what's wrong in this?
Thanks
--Edit--
Looks like the problem is because of threading issue. Scrollbar value is updating to the previous text value. Actually while retrieving scroll value it's not retrieving latest value but it's getting older value so scrollbar set to end of the previous message, not actual last line.
I don't know the actual problem of this issue, but I found an alternative solution.
I'm setting caret's position at end of text using length of text.
logs.setText(logText);
logs.positionCaret(logText.length());
It is working for me. :)
I have one link on click of that link one can edit the name of that link in the text box.
After editing save and close options are there. after saving this the focus goes out from the link i need that focus must be stay there on the link.
I am using
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute () {
link.setFocus(true);
}
});
for the link but it will focus for a second only not permanently to that link.
Looking for solution.
Thanks..!!
Use the following code inside your close and save button clickhandler.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute () {
link.setFocus(true);
}
});.
I'm trying to get and action event to fire on my HelloWorld. im using the GUI and when it auto creates the:
protected void onMain_Button1Action(Component c, ActionEvent event) {
// If the resource file changes the names of components this call will break notifying you that you should fix the code
super.onMain_Button1Action(c,event);
}
I know its not going to work because there is no void of the same type in the superclass.
protected void onMain_Button1Action(Component c, ActionEvent event) {
// If the resource file changes the names of components this call will break notifying you that you should fix the code
Dialog.show("Test", "it works", "OK",null);
}
And I'm still getting nothing. I've looked for other tutorials on how to use codenames as one but i cant find any. And I dont get the one made by the author. if any one can toss me a line i would be most appreciative.
You need to save the resource file in the designer and NOT delete the call to super. If you are using Eclipse you should refresh the project after saving in the designer using F5.