FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 301 : java mode with multiple tabs not working properly
Last modified: 2006-03-21 07:53
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
INVALID -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
22samurai
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2006-03-07 07:13
using Multple tabs in the PDE in java mode doesn't work well.
example using the Examples/Structures/Objects code example:
1. open the Objects example.
2. select the MRect class and cut it to the clipboard.
3. create a new tab. name it MRect.
4. paste the MRect class into the new tab
5. run it. (works fine)
6. enclose the remaining Objects.pde code in "public class Objects extends
PApplet { ... }"
7. run it. (error)
At this point, all the Processing methods in the MRect class are not
recognized by the compiler. Even changing the MRect class definition to
"public class MRect" and changing the tab name from MRect.pde to MRect.java
doesn't fix the problem.
In standard mode, the classes in any extra tabs are appended to the end of
the inner class that Processing creates. How does java mode treat the tabs?
Using v0107 on Windows 2000 Server
Additional Comment
#1 From fry 2006-03-07 07:22
when you use java mode, you're telling the compiler that you know what you're doing, and will
properly make the classes talk to each other. if you put "public class" around the contents of
the main tab, then the other tabs will be treated as separate classes, because you've closed off
the class definition in the main tab.
Additional Comment
#2 From 22samurai 2006-03-10 07:01
This answer explains why what I'm doing doesn't work, but doesn't suggest a
workaround.
I want to be able to run my application from the command line using
"...extends PApplet", but separate out a particular class (that uses some
of the Processing methods) into another tab.
How do I configure the PDE and my programs to achieve such an effect?
Additional Comment
#3 From fry 2006-03-10 07:05
don't use "public class" if running inside the pde, or pass the PApplet object to the other classes
when you create them. please use the board for general programming questions, this has been
covered there a couple of times.
Additional Comment
#4 From 22samurai 2006-03-17 10:12
>please use the board for general programming questions, this has been
> covered there a couple of times.
Perhaps you could provide a link to these previous discussions? I
searched and could not find a good, concise answer for this. If the
question's been asked a couple times, then it needs to be documented better.
Would it be too difficult to check the filenames of additional tabs and
perform a different task depending on the extension? Something along these
lines -
In advanced java mode:
if an add'l tab has .pde extension -> add to the end of the "main tab"'s
class before compiling
if an add'l tab has .java extension -> treat as an actual java class
This would prevent the need for passing PApplet as an object, which seems
like quite a kludge just to use a few convenience functions like nf().
The thing that initially confused me was the syntax highlighting in the
second tab. I naturally thought that since the PDE was highlighting
Processing's methods in the second tab, it was recognizing those methods as
valid, which is not actually the case. In the very least, the highlighter
should indicate when Processing methods will be recognized.
Additionally, it would be nice to see which of the three modes (I will
refer to them as Direct, Normal, and Advanced) that Processing is in via
some information on the status bar, as a hint of what to expect from the PDE.
You could even have notifications when the user has just changed modes. If
the user goes from Direct Mode to Normal Mode by adding a method, a dialog
could remind them to put their commands into setup() or draw(). In the
same way, a dialog could pop up with information about Advanced Mode when
the user moves from Normal to Advanced Mode when they 1)add "public
class... extends PApplet," 2) rename their file to .java, or 3) add a new
tab in such a way as to change the mode. Of course, each dialog would have
a "Don't show this message again" checkbox at the bottom for people who
don't want the reminders.
Additional Comment
#5 From fry 2006-03-21 07:53
(In reply to
comment #4
)
>
>
>
> Additional
Comment #4
From
> 22samurai
> 2006-03-17 10:12
>
> <!--
> addReplyLink(4); //-->[reply]
>
>
>
>
> >please use the board for general programming questions, this has been
> > covered there a couple of times.
>
> Perhaps you could provide a link to these previous discussions? I
> searched and could not find a good, concise answer for this. If the
> question's been asked a couple times, then it needs to be documented better.
>
> Would it be too difficult to check the filenames of additional tabs and
> perform a different task depending on the extension? Something along these
> lines -
>
> In advanced java mode:
> if an add'l tab has .pde extension -> add to the end of the "main tab"'s
> class before compiling
> if an add'l tab has .java extension -> treat as an actual java class
>
> This would prevent the need for passing PApplet as an object, which seems
> like quite a kludge just to use a few convenience functions like nf().
this is how things already work. now please move your discussion to the
discussion board, not the bugs database.