This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I'm developing a text editor and when it starts,it displays the main window, toolbar and menubar and this is it. When the user create a new file, it creates dynamically a JTextPane on a JScrollPane on a JTabbedPane, it is possible to create as many file as you want and close as well one by one and all of them. I would like when the user creates a new file, it will create a new tab with the scrollable textpane and it will get the focus on the textpane, when it creates another one; the same, the focus will be on the new textpane, when the user clicks on one of the tabs the textpane will get the focus and when the user closes one of the tabs, one of the tabs next to it will comes up and the textpane will get the focus. At the moment I've been trying to do this using a changeListener and adding it to the tabbedpane, but it doesn't work well. whe you create the first tab, the textpane get the focus but the caret doesn't blinck and whe you whan to close the right most tab, the next tab that get selected, its text pane doesn't get the focus. it is better to do the same using a focus listener and adding it to the textpane? or creates a new focusmanager or is it better to do it with the change listener? here is the code of the tabbedpane class, there is another class that extends a JFrame and has an instance of this class (TabbedPane)
many thanks, I hope it was clear what is the problem.