Hey all, I've recently started coding a program for my final year project of my uni degree. I am coding in Swing and have a very odd bug.
I'm using TabbedPane for the first time, although I've used CardLayout before and there seems little difference between them. I am generating my own version of a JPanel and inserting them into the JPanel on one of the tabs of the TabbedPane, this all works fine(ish - wont go into that one now).
The bug I'm getting came along when I applied a mouseListener to the personalised JPanels, so that I can change the colour of a drawn border (using only drawline commands) upon mouse click. I've used the border and colour code on a previous project with no problems. Now when I click on a panel to effectively highlight it the contents of the panel (previously a bunch of JTextPanels in a GridBagLayout) get replaced with what seems like a part screen dump of my program, the part screen dump cannot be interacted with even when it replicates buttons etc. Here's the kicker, the screen dump thing also contains random fragments of what the panel used to contain, none of which will be aligned within the panel as it should've been.
This explaination may seem vague but it feels like a problem that would have been seen before. I will happily paste up the code if need be, it just seems like it may be down to my lack of experience with Swing.
I'm also more than happy to provide print screens if that will help.
I'm using TabbedPane for the first time, although I've used CardLayout before and there seems little difference between them. I am generating my own version of a JPanel and inserting them into the JPanel on one of the tabs of the TabbedPane, this all works fine(ish - wont go into that one now).
The bug I'm getting came along when I applied a mouseListener to the personalised JPanels, so that I can change the colour of a drawn border (using only drawline commands) upon mouse click. I've used the border and colour code on a previous project with no problems. Now when I click on a panel to effectively highlight it the contents of the panel (previously a bunch of JTextPanels in a GridBagLayout) get replaced with what seems like a part screen dump of my program, the part screen dump cannot be interacted with even when it replicates buttons etc. Here's the kicker, the screen dump thing also contains random fragments of what the panel used to contain, none of which will be aligned within the panel as it should've been.
This explaination may seem vague but it feels like a problem that would have been seen before. I will happily paste up the code if need be, it just seems like it may be down to my lack of experience with Swing.
I'm also more than happy to provide print screens if that will help.
Comment