I have created 8 tabs in a tabbed panel using Java Swing. The problem is when I enter data in any tab and click the save button. After clicking it leaves the present tab/panel and goes to the first tab.
I have to retain on the same tab after clicking the save button.
Please help me on this.
I got the answer, just forgot to comment the getFrame().dispose() method.
Thanks for your concern.
Related
I'm using the ControlsFX library to create an AutoComplete Textfield for my JavaFX application. The autocomplete function works, but the problem is that I have to type at least 1 letter (and delete it after), so I can see the drop down menu with all the possible suggestions.
Is there any way to show the drop down menu of this AutoComplete TextField, just by clicking it?
This is my current code:
TextFields.bindAutoCompletion(cityTextField, citiesList);
Thank you!
First I apologize if my English is not very good. it's my 4th language :P:P.
I have a java program (which I run using NetBeans) that open a graphic window (application), when I restore this window then I do a right click on its button in the toolbar it shows a menu that contains a button to close the window (like it does for every window XD), I want to add another button or text to re-size the window to [30,30],(example: we add text "send window to [30,30]" and when we click on it it resize the window to 30,30) cause when I do a remote connection from home I can't see the window its big and it appears in the 2nd screen. I don't know how to write this in Java. I'll be grateful for any help. If I didn't explain the problem well please don't hesitate to ask me and i'll explain it other way. :)
Thank you and have a lovely day everyone :):)
I made a Checkbox so where when you click it it opens another window with more checkboxes. How is it you would go about making those checkboxes open another window?
Have you tried adding an actionlistener to your checkBox component?
It's hard to see what excactly you're trying to achieve; but from what you write it shouldn't be more than that.
You can try this tutorial, for starters:
http://www.java2s.com/Code/JavaAPI/javax.swing/JCheckBoxaddActionListenerActionListenerlis.htm
I have this form where there are extendable controls like there's a textbox for the user to type and beside it is an add button which the user would use to add another textbox beneath the previous one.
My problem is i don't even know how to make that add button work so that another textarea/textbox would appear just beneath the previous control..im doing it in netbeans ide 7.0 and in design mode...
I have researching for quite a while now and i'm so confused already what to do..at least you could provide me with an idea not really the code.
You should create a Layout.
For your case (Form kinda layout) , it seems that you need GridLayout.
For example, please check this link for all type of layout or directly go to Grid Layout link.
Since you're going to be dynamically adding controls to your form, you'd simply want to put in a panel where you want the textbox and the button. Inside that panel place your textbox and button, you'd probably not want to use netbeans to do this, and use a LayoutManager like GridLayout. Now you'lld want to connect your button to an ActionListener that adds a textfiield to the panel.
See the Nested Layout Example for an example of (amongst other things) adding components to a GUI dynamically.
I have a JTabPane, and i have added a MoustListener to it(for tab's title).
When i press right click, a popup menu is created.
i need to make it invisible when i press the mouse button in any place of window. how can i do this??
(the MouseListener is applied only for tab's title.)
i need to make it invisible when i
press the mouse button in any place of
window. how can i do this??
This is the default behavour of a JPopupMenu so you don't have to do anything special.
Read the JPopupMenu API and you will find a link to the Swing tutorial on "How to Use Menus". The tutorial contains a working example of using a popup menu. Compare your code with the tutorial to see whats different. We can't help you because we don't know what your code is like.
If you need more help post your SSCCE.
in the good old days what I did to solve this problem was to register a mouse listener with ALL the components.
you can write a fairly simple function that recursively traverses a top level container and do it.
this was with Java 1.1, so maybe there is a better option today.
One way off the top of my head would be to grab the coordinates of the clicks, and then have another method to determine if the clicks are on the tab, or inside of the content area of the tabs.