Results 1 to 8 of 8
- 11-28-2011, 01:22 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 60
- Rep Power
- 0
Old gui showing instead of new gui code
Now, I think I'm on the verge of going crazy because something very weird is happening. I had an old gui design which was very rudimentary, and I wanted to replace it with something cleaner. So I used my newly installed GUI design plugin in eclipse and designed a nice neat new gui. Then I migrated the old gui functionality to the new gui. I removed references to the old gui from the main execution thread and then ran the application only to find my old gui design sill being used by the application.
After trying repeatedly to see if there was any remaining reference to the old gui I finally erased the old gui code all together. But it would appear that just to spit in my face life decided to sill use my old gui.
So can anyone tell me why my old gui won't go away?
old gui: (I do realize there is a misspelling in the windows title, ill fix that soon)

new gui: (from design plugin preview)

Execute.java
new gui code:Java Code:import javax.swing.JFrame; public class Execute { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub //Store the sentence to be examined String sentence [] = {"The","cat","ran"}; //Initialize a new Word Manager WordManager test = new WordManager (3); //Initialize a new Action Module Actions testAction = new Actions(); //For each word in the sentence to be examined create a word for (int i = 0; i< sentence.length; i++){ Word word = new Word(sentence[i],test); } //Get the words that were added in the previous loop for (int i = 0; i < test.getWords().length; i++){ //Print out each word. System.out.println(test.getWords()[i].getName()); } MainApplicationWindow gui = new MainApplicationWindow (test); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); } }
old gui code:Java Code:import java.awt.event.ActionEvent; public class MainApplicationWindow extends JFrame { private JPanel contentPane; private JPanel wordPanel; private JComboBox selectColor; private JComboBox selectWord; private JButton button; private WordManager manager; Actions action = new Actions(); /** * Create the frame. */ public MainApplicationWindow(WordManager manager) { super ("Algorithm Analyser 0.1"); this.manager = manager; this.setLayout(null); setBounds(100, 100, 450, 156); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); wordPanel = action.getWordPanel(manager); wordPanel.setBounds(10, 11, 414, 59); contentPane.add(wordPanel); SelectListener handler = new SelectListener (); selectWord = new JComboBox(manager.getWordNames()); selectWord.setSelectedIndex(0); selectWord.setBounds(10, 81, 93, 20); selectWord.addActionListener(handler); contentPane.add(selectWord); selectColor = new JComboBox(action.getColorNames()); selectColor.setSelectedIndex(0); selectColor.addActionListener(handler); selectColor.setBounds(113, 81, 93, 20); contentPane.add(selectColor); button = new JButton ("Submit"); button.setBounds(216, 81, 89, 23); button.addActionListener(handler); contentPane.add(button); } //Begin action listener private class SelectListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub //When Submit button is pressed get the word and the colour then change them appropriately if (e.getActionCommand() == "Submit"){ action.ChangeColor(manager.getWords()[selectWord.getSelectedIndex()], action.getColors()[selectColor.getSelectedIndex()]); } } } }
Java Code:import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class GUI extends JFrame { //ComboBox for choosing the colour private JComboBox SelectColor; //ComboBox for choosing the word private JComboBox SelectWord; //Submit button to confirm colour and word private JButton Button; //Word manager to deal with the handling of words private WordManager manager; //Action manager to deal with actions Actions action = new Actions(); public GUI (WordManager manager){ //Title of the GUI super ("Algorithm Analyser 0.1"); //Initialise layout this.setLayout(new FlowLayout()); //set manager this.manager = manager; //Add the words to the GUI for (int i = 0; i < manager.getWords().length; i++){ this.add(manager.getWords()[i].getLabel()); } //Initialise event handler SelectListener handler = new SelectListener (); //Create and setup combobox for the words SelectWord = new JComboBox(manager.getWordNames()); SelectWord.setSelectedIndex(0); SelectWord.addActionListener(handler); this.add(SelectWord); //Create and setup combobox for the colours SelectColor = new JComboBox(action.getColorNames()); SelectColor.setSelectedIndex(0); SelectColor.addActionListener(handler); this.add(SelectColor); //Create and setup Submit button Button = new JButton ("Submit"); Button.addActionListener(handler); this.add(Button); } //Begin action listener private class SelectListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub //When Submit button is pressed get the word and the colour then change them appropriately if (e.getActionCommand() == "Submit"){ action.ChangeColor(manager.getWords()[SelectWord.getSelectedIndex()], action.getColors()[SelectColor.getSelectedIndex()]); } } } }
- 11-28-2011, 01:48 AM #2
Re: Old gui showing instead of new gui code
Not sure what your problem is. If you remove all references to the old classes from your code and remove all definitions for the old classes from your PC, how can the old versions of the programs come back?
The only answer is that somewhere there is still a version of the old code.
What is the purpose of your posted code? What does it show?
- 11-28-2011, 02:10 AM #3
Member
- Join Date
- Apr 2011
- Posts
- 60
- Rep Power
- 0
Re: Old gui showing instead of new gui code
Execute.java is my main class it runs the program and as you can see there is no reference there to GUI.java (which is my old GUI code) instead there is a reference to MainApplicationWindow.java (my new gui code) however despite this when I run Execute.java the old gui shows.
- 11-28-2011, 02:13 AM #4
Re: Old gui showing instead of new gui code
Does the new GUI sure the same Strings as the old GUI?
Change them to see what code is being used.
- 11-28-2011, 02:20 AM #5
Member
- Join Date
- Apr 2011
- Posts
- 60
- Rep Power
- 0
Re: Old gui showing instead of new gui code
Well, this is interesting, I changed the strings in Execute.java and found that the old gui shows, with "The cat ran" even though I changed the strings. I suppose I should also mention that I am using Subversion with eclipse to manage this project, I don't know if that helps but I could erase all local copies and grab another copy of the files from my local server.
- 11-28-2011, 02:22 AM #6
Re: Old gui showing instead of new gui code
Sounds like your IDE is in control. Did you pay your monthly fees?
Good luck.
- 11-28-2011, 02:25 AM #7
Member
- Join Date
- Apr 2011
- Posts
- 60
- Rep Power
- 0
Re: Old gui showing instead of new gui code
Good god! Skynet, the machines are rising :(
- 11-28-2011, 02:30 AM #8
Member
- Join Date
- Apr 2011
- Posts
- 60
- Rep Power
- 0
Similar Threads
-
Image not showing up!!
By ThrashingBoy in forum New To JavaReplies: 1Last Post: 11-08-2010, 10:22 PM -
Table not showing up
By dilpreet28 in forum New To JavaReplies: 3Last Post: 08-04-2010, 07:05 AM -
Changes in code not showing up when running program!?
By jchsu in forum New To JavaReplies: 1Last Post: 03-30-2010, 09:23 PM -
Showing
By bostonstate in forum New To JavaReplies: 3Last Post: 08-25-2008, 07:49 PM -
Why isn't this showing?
By JToolTip in forum Java AppletsReplies: 2Last Post: 07-07-2007, 11:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks