Error parsing refactored code [message #850026] |
Thu, 19 April 2012 17:38  |
Eclipse User |
|
|
|
Built a ui using Window Builder, got it all working, then refactored to move some code out of main class. Now WindowBuilder won't show the ui.
Any way of checking for errors in the parsing to work out what is causing the parser not to recognise the new code?
I had everything in one class, then moved it into a new class which extends JFrame. Every time the design view parses the new class, it only shows the content pane.
Is there a specific way of defining content in source that WindowBuilder is looking for?
Is there an error log I can look at?
Is there a way of running the parser outside Eclipse so I could see any exceptions thrown?
Thanks for help & suggestions.
This is the code that's causing the problems...
public class DestPredWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JDesktopPane desktopPane;
private final JLabel lblNewLabel = new JLabel("Training Data");
private String theDirectory=".";
FileFilter trnFilter = new FileNameExtensionFilter("File Type","type");
public DestPredWindow() throws Exception {
}
/**
* Initialize the contents of the frame.
* @throws Exception
*/
public void initialize() throws Exception {
setBounds(100, 100, 1160, 861);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
desktopPane = new JDesktopPane();
getContentPane().add(desktopPane, BorderLayout.CENTER);
final JPanel panel = new JPanel();
panel.setBorder(new LineBorder(new Color(0, 0, 0), 2));
panel.setBounds(6, 6, 209, 255);
desktopPane.add(panel);
panel.add(lblNewLabel);
final JList trainingFilesList = new JList();
trainingFilesList.setModel(new DefaultListModel() {
String[] values = new String[] {"Select Training File(s)"};
public int getSize() {
return values.length;
}
public Object getElementAt(int index) {
return values[index];
}
});
panel.add(trainingFilesList);
JButton btnBrowse = new JButton("Browse");
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnBrowse.setToolTipText("browse for training data");
panel.add(btnBrowse);
JButton btnTrain = new JButton("Train");
btnTrain.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
panel.add(btnTrain);
JSeparator separator = new JSeparator();
panel.add(separator);
JLabel lblNewLabel_1 = new JLabel("Testing Data");
panel.add(lblNewLabel_1);
final JList testFilesList = new JList();
testFilesList.setModel(new DefaultListModel() {
String[] values = new String[] {"Select Test File(s)"};
public int getSize() {
return values.length;
}
public Object getElementAt(int index) {
return values[index];
}
});
panel.add(testFilesList);
JButton btnBrowse_1 = new JButton("Browse");
btnBrowse_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
JSeparator separator_1 = new JSeparator();
separator_1.setOrientation(SwingConstants.VERTICAL);
panel.add(separator_1);
JSeparator separator_2 = new JSeparator();
separator_2.setOrientation(SwingConstants.VERTICAL);
panel.add(separator_2);
panel.add(btnBrowse_1);
JButton btnTest = new JButton("Test");
btnTest.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
panel.add(btnTest);
JButton btnNext = new JButton("Next");
btnNext.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
panel.add(btnNext);
JButton btnReset = new JButton("Reset");
btnReset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
panel.add(btnReset);
JPanel mapPanel = new TileMapPanel(new Dimension(724,799), this);
mapPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
mapPanel.setBounds(215, 6, 939, 805);
desktopPane.add(mapPanel);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenuItem mntmExit = new JMenuItem("Exit");
mntmExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(-1);
}
});
mnFile.add(mntmExit);
}
/**
* Gets some files from a directory.
* Starts off in the directory given by 'theDirectory', returns all files selected
* from that directory
* @param ff a file filter describing what kinds of files should be selected
* @return the files that the user has selected
*/
File[] getFromFileDialog(FileFilter ff, Component par ) {
System.out.println("The Directory: \""+theDirectory+"\"");
JFileChooser fc = new JFileChooser(theDirectory);
File[] theFiles=null;
fc.addChoosableFileFilter(ff);
fc.setMultiSelectionEnabled(true);
int ret = fc.showOpenDialog(par);
if ( ret == JFileChooser.APPROVE_OPTION ) {
theFiles = fc.getSelectedFiles();
theDirectory = theFiles[0].getParent();
}
return theFiles;
}
}
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03668 seconds