🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
4 messages
4 total messages Started by Pete Antoniak Sun, 08 Jun 2003 19:36
Path problems after doing a Rebuild
#561
Author: Pete Antoniak
Date: Sun, 08 Jun 2003 19:36
91 lines
2997 bytes
I am an experienced Java Programmer that recently switched from VisualCafe
to JBuilder Personnel Version.  I had a lot of problems getting all the
classes to reference each other at first, but somehow I got everything to
compile and thing were going fine for the last two months.  However recently
I accidentally did a "Rebuild" of the whole project and everything turned to
c**p.  Almost nothing will compile now.    I have struggled with this for
two days and have tried to reduce the problem to a simple test to explain
it.



I have two directories

                  com.edugames.games

and

                  com.edugames.common.



and two classes:



                  com.edugames.games.Base

and

                  com.edugames.common.D



The header to Base is



   "package com.edugames.games;

   import com.edugames.common.*;"





If  I comment out  "import com.edugames.common.*" I get the following error
in the structure panel



  a.. "Variable D not found in class com.edugames.games.Base at line 37 "
So I know that the paths are correct because the IDE sees
"com.edugames.common.*."



However and when I try to do a "make" on Base I get the following error:



  a.. "D.java": Error #: 901 : package COM.edugames.common stated in source
C:\CodeJB\com\edugames\common\D.java does not match directory
COM.edugames.common at line 1, column 22 "
Note that the path is now  "COM.edugames.common".  Could this be a DOS
thing?



If I try to compile D from the "game" Project I get:



  a.. "D.java": Error #: 901 : package COM.edugames.common stated in source
C:\CodeJB\com\edugames\common\D.java does not match directory
COM.edugames.common at line 1, column 22
Just to test that I could compile D, I created a Project with a working
directory of "com.edugames.common" and was able to compile D with no
problems.



I am using Windows XP.  My working directory is
C:/CodeJB/com/edugames/games.



Thanks in advance if you can help me.



Pete Antoniak
Re: Path problems after doing a Rebuild
#562
Author: Lori M Olson (TeamB)
Date: Sun, 08 Jun 2003 21:06
73 lines
3384 bytes
Pete Antoniak wrote:
> I am an experienced Java Programmer that recently switched from VisualCafe
> to JBuilder Personnel Version.  I had a lot of problems getting all the
> classes to reference each other at first, but somehow I got everything to
> compile and thing were going fine for the last two months.  However recently
> I accidentally did a "Rebuild" of the whole project and everything turned to
> c**p.  Almost nothing will compile now.    I have struggled with this for
> two days and have tried to reduce the problem to a simple test to explain
> it.
> 
>> 
>   a.. "D.java": Error #: 901 : package COM.edugames.common stated in source
> C:\CodeJB\com\edugames\common\D.java does not match directory
> COM.edugames.common at line 1, column 22 "
> Note that the path is now  "COM.edugames.common".  Could this be a DOS
> thing?
> 
> 
> 
> If I try to compile D from the "game" Project I get:
> 
> 
> 
>   a.. "D.java": Error #: 901 : package COM.edugames.common stated in source
> C:\CodeJB\com\edugames\common\D.java does not match directory
> COM.edugames.common at line 1, column 22
> Just to test that I could compile D, I created a Project with a working
> directory of "com.edugames.common" and was able to compile D with no
> problems.
> 
> 
> 
> I am using Windows XP.  My working directory is
> C:/CodeJB/com/edugames/games.
> 
> 
> 
> Thanks in advance if you can help me.
> 
> 
> 
> Pete Antoniak
> 
> 

It's a case problem.  Windows doesn't care about "COM" vs "com", and 
even hides it from you, but Java cares.

Get out of JBuilder.  Get into a command-line prompt, and "cd" to 
"C:\CodeJB".  Rename your "com" directory to "junk".  Then rename it 
back to "com", making sure you are using lower case.

Start up JBuilder again, and make sure that you do a "clean" first. 
Hopefully it will work now.

-- 

Regards,

Lori Olson (TeamB)

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
	http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
	http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
	http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: Path problems after doing a Rebuild
#571
Author: Pete Antoniak
Date: Wed, 11 Jun 2003 21:08
16 lines
1794 bytes
I just downloaded and installed JB9.  I started a whole new Project and the
problem went away.

However, I did notice a problem with the way JB relates to classes that
reference other classes.  If  I have a JTabbedPane class and add JPanels to
it.  And I want to have the JPanels relate back to the JTabbedPane, I can't
do this directly.  I must create a compile the original JTabbedPane and
dependent JPanels before I create a reference  in the dependent JPanels to
the original JTabbedPane.  If you bring a project in from another IDE,  this
can become problematic if all the classes are already referencing each
other.  JB has a fit.

The work-around I use is to remark out all references first, then compile,
then unremark them and compile again.

Pete Antoniak
Re: Path problems after doing a Rebuild
#573
Author: Paul Furbacher TeamB
Date: Thu, 12 Jun 2003 15:14
212 lines
7476 bytes
In <3ee79a57@newsgroups.borland.com> Pete Antoniak wrote:
>  
>  However, I did notice a problem with the way JB relates to classes 
>  that reference other classes.  If  I have a JTabbedPane class and add 
>  JPanels to it.  And I want to have the JPanels relate back to the 
>  JTabbedPane, I can't do this directly.  ...

What do you mean by "relate back to"?  Do you want to maintain
a reference to the tab pane in each sub-panel?  If you
provide accessor/mutator (getter/setter) methods for 
doing this in your custom panel classes, you shouldn't 
have any problem.  The compiler should handle this just
fine, and the Property Inspector (UI Designer) should 
allow you to set that property.

>  I must create a compile the original JTabbedPane and 
>  dependent JPanels before I create a reference in the
>  dependent JPanels to the original JTabbedPane.  If 
>  you bring a project in from another IDE,  this can 
>  become problematic if all the classes are already 
>  referencing each other.  JB has a fit.

Though I don't doubt you are experiencing problems, I'm 
wondering whether you can solve this by writing your
custom panel classes so that they are more amenable to 
UI Designer tooling.  The following, ...

>  The work-around I use is to remark out all references 
>  first, then compile, then unremark them and compile again.

.. really shouldn't be necessary.  Something else
is going on which you should come to grips with.

Below my sig is an example of how you could approach this.


Paul Furbacher [TeamB]

  Save time, search the archives:
       http://info.borland.com/newsgroups/ngsearch.html
       
  Is it in Joi Ellis's Faq-O-Matic? 
       http://www.visi.com/~gyles19/fom-serve/cache/1.html
 
  Finally, please send responses to the newsgroup only.
  That means, do not send email directly to me.
  Thank you.

***** Place the following into two separate source code
files in a folder hierarchy:

   d:/myProjects
       /myProject
         /src
           /tabpane_pane_communication
             - Frame1.java
             - TabPaneReferencePanel.java

Create a new project which resides in the "myProjects/myProject"
folder.  JBuilder should auto-discover the source files.

Create a runtime config for tabpane_pane_communication.Frame1.

At this point, you are good to go.

*****

package tabpane_pane_communication;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/**
 * <p> To demonstrate that custom panels can maintain a reference 
 *     to an owning tab pane without messing up the compiler.</p>
 * <p> </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author Paul Furbacher
 * @version 1.0
 */

public class TabPaneReferencerPanel extends JPanel {

  JTabbedPane tabPane = null;

  GridBagLayout gridBagLayout1 = new GridBagLayout();
  JButton button1 = new JButton();

  public TabPaneReferencerPanel() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    button1.setText("Press me to do something to the tab pane");
    button1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        button1_actionPerformed(e);
      }
    });
    this.setLayout(gridBagLayout1);
    this.add(button1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, 
            new Insets(0, 0, 0, 0), 0, 0));
  }

  public JTabbedPane getTabPane() {
    return tabPane;
  }

  public void setTabPane(JTabbedPane tabPane) {
    this.tabPane = tabPane;
  }

  /** Show that with the tabPane ivar (member variable) reference,
   * we can yank it around.
   */
  void button1_actionPerformed(ActionEvent e) {
    // randomly set the current tab's foreground color
    int val = (int)(Math.random() * 255.0);
    Color c = new Color(val, val, val);
    tabPane.setForegroundAt(tabPane.getSelectedIndex(), c);
    // randomly set the next tab index.
    tabPane.setSelectedIndex((int)(Math.random() * tabPane.getComponentCount()));
    System.out.println(" value: " + val);
  }
}

**** 

package tabpane_pane_communication;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * <p> To demonstrate that custom panels can maintain a reference to an
 * owning tab pane without messing up the compiler.</p>
 * <p> </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author Paul Furbacher
 * @version 1.0
 */

public class Frame1 extends JFrame {
  JTabbedPane jTabbedPane1 = new JTabbedPane();
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JPanel jPanel3 = new JPanel();
  TabPaneReferencerPanel customPanel1 = new TabPaneReferencerPanel();
  TabPaneReferencerPanel customPanel2 = new TabPaneReferencerPanel();
  TabPaneReferencerPanel customPanel3 = new TabPaneReferencerPanel();

  public Frame1() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  /**
   * Look here!  Note that the Object Inspector was used to
   * set the tabPane property of the three custom panels nested
   * in the tabPane.
   *
   * @throws java.lang.Exception
   */
  private void jbInit() throws Exception {
    this.getContentPane().setLayout(borderLayout1);
    customPanel1.setTabPane(jTabbedPane1);
    customPanel2.setTabPane(jTabbedPane1);
    customPanel3.setTabPane(jTabbedPane1);
    this.getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
    jTabbedPane1.add(jPanel1,    "Tab One");
    jTabbedPane1.add(jPanel2,   "Tab Two");
    jTabbedPane1.add(jPanel3,   "Tab Three");
    jPanel1.add(customPanel1, null);
    jPanel2.add(customPanel2, null);
    jPanel3.add(customPanel3, null);
    jTabbedPane1.setSelectedComponent(jPanel3);
    this.addWindowListener(new java.awt.event.WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        this_windowClosing(e);
      }
    });
  }

  public static void main(String[] args) {
    Frame1 frame = new Frame1();
    frame.pack();
    frame.show();
  }

  void this_windowClosing(WindowEvent e) {
    System.exit(0);
  }

}
  

*****
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads