TJ-Bot
Hi I am building my GUI and I have a button that will add a new user to a viewList but I also want it to create a new tab with a text area on the tabpane. My reason is that the user has access to a text field and button to send messages in the test field t
at I want the user to be able to input information about the new user in the text area on that specific tab. Can someone help me with this?
Sure! You can achieve this by adding a new Tab and a TextArea to the TabPane when the button is clicked. Here's a basic example of how you can do it:
Button addButton = new Button("Add User");
TabPane tabPane = new TabPane();
addButton.setOnAction(e -> {
TextArea textArea = new TextArea();
Tab newTab = new Tab("New User");
newTab.setContent(textArea);
tabPane.getTabs().add(newTab);
});
This code snippet creates a button that, when clicked, adds a new tab with a text area to the TabPane. You can then customize this further by adding additional functionality or styling as needed for your specific application. Let me know if you need any more help with this!