| Protected inner classes and inheritance |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- Please Please Help!!WocBSe1QFHLRlEH2Ki+Gl8DIjHmu9wcQ
Hi all,
Dont know if this is the right place to submit questions. but i need
help :(
I need to convert this pl/sql function to java function so that i can
use it my jsp page.
FUNCTION countItem(adminUser IN STRING,
m_menu IN NUMBER)
RETURN NUMBER IS
cno NUMBER := 0;
CURSOR cAdminMenu(adminUser VARCHAR2 ) IS
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM useraccess P, pages G, menues M, submenues T
WHERE P.userid = adminUser
AND T.menuid = M.menuid
AND T.pageid = G.pageid
AND P.pageid=G.pageid
AND G.publicaccess = 'N'
UNION
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM groupaccess P, pages G, menues M, submenues T
WHERE P.grpid IN (SELECT GRP_ID FROM GROUPUSERS WHERE USR_ID =
adminUser)
AND T.menuid = M.menuid
AND T.pageid = G.pageid
AND P.pageid=G.pageid
AND G.publicaccess = 'N'
UNION
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM pages G, menues M, submenues T
WHERE T.menuid = M.menuid
AND T.pageid = G.pageid
AND G.publicaccess = 'Y'
ORDER BY 1,2;
BEGIN
FOR t IN cAdminMenu(adminUser) LOOP
IF t.menuid = m_menu THEN
cno := cno + 1;
END IF;
END LOOP;
RETURN cno;
END;
I would really appreciate your help.
Regards,
Ayeda
- 3
- Eclipse 3.08 problemEclipse show not problems, it means when I write code must every time
rebuild to view compiler errors.
How it fix?
- 3
- JDK 1.5.0_05 won't load applets from the Internet?I'm setting up a new PC with a brand-new installation of Windows XP and
Fedora Core 3 (each with all the latest updates).
I'm having trouble with the Java plug-in: it won't load any applets
from the Internet (from the local filesystem works fine). I'm behind a
SOCKS v4 proxy; the browsers and DNS are configures appropriately and
surfing the net works fine, using Mozilla and IE under Windows and
using Mozilla under Linux -- but trying to load a page with an applet
just displays the pretty coffee mug image where the applet should be,
and when I try to leave the page, the browser hangs, presumably because
the JVM is stuck trying to download the applet.
I tried reconfiguring the gateway to use plain NAT, so I could take the
proxy out of the picture, but this did not fix things.
I never had problems like these with JDK 1.4.2.*, but with 1.5.0_05, I
just can't get it to work at all. Web Start doesn't work either -- just
sits there "checking for latest version" indefinitely.
I have Java configured to use the browser's settings; configuring the
proxy settings manually makes no difference. (Of course when I use NAT
on the gateway, there is no proxy involved at all, but that does not
work either.)
N.B. The applets themselves do not appear to be the problem -- I tried
some really simple ones, including samples from the Java Tutorial;
nothing even gets pulled across the network.
I'm hoping someone can shed some light on this -- I'm stumped!
Thanks,
- Thomas
- 3
- Java Developer - Oracle, UML, Spring, Hibernate -HOT HOT OPENINGSTitle: Java Developer - Oracle, UML, Spring, Hibernate
Company: Trinity Consultancy Services
Skills: Java Developer, Software Engineer, Java Programmer, Software
Developer, Software Programmer, Java Engineer, UML, Hibernate, Spring
- Java Developer, Software Engineer, Java Programmer, Software
Developer, Software Programmer, Java Engineer, UML, Hibernate, Spring
Trinity Consultancy Services is seeking applications from qualified
and experienced software engineers with above skills for various
requirements with their Clients.
Job description and Skills:
* Java Developer, Software Engineer, Java Programmer, Software
Developer, Software
* Programmer, Java Engineer, UML, Hibernate, Spring
* Java Developer- Oracle, UML, Spring, Hibernate
* 4+ years of Java experience
* Oracle expertise
* Knowledge of Spring and/or Hibernate and/or Tapestry
* UML experience
* Experience in creating database intensive applications from the
ground up
* Full life cycle software development
* Design and deliver complex web applications
Trinity Consultancy Services is a leading source of Information
Technology, Engineering and Management Experts that corporations of
all sizes turn to, from Global 2000 corporations to mid-sized and
small organizations nationwide. With the commitment to excellence, is
subtly managed to find, recruit, screen, submit and effectively
organize a technical workforce anywhere in the United States for
various Technical needs of corporation irrespective of its size.
Trinity Consultancy Services is one of its unique kind of the leading
information technology consulting services, and business process
outsourcing organizations committed for excellence.
Trinity provides business consulting, systems integration, application
development, staffing services and managed services to Global 2000
Corporations, medium-sized businesses, and government organizations
throughout the United States.
Trinity can mobilize the right resources, skills and technologies to
enable our clients to reach their dreams by enhanced performance. With
deep industry and business process expertise and broad global
resources, Trinity Consultancy Services is committed for excellence.
Please contact our Human Resource Manager Ms. Ann and send your
detailed Resume with your work authorization status, current salary
and expectations.
Mention the position you are applying in the subject line.
Email: email***@***.com
www.trinityconsultancy.com
- 3
- getting starting with ...... Java
I am newbie of sorts: I'm familiar with java to a some extent, but I have
never had the chance to use it. Which means, I'm not as comfortable with
it as I am with other languages (php,asp,python,c,perl,etc). What is the
best way to get comfortable? Is there any particular direction I should be
heading? I never read a book from start to end, unless it's a novel, so
with other programming languages I've learnt the fundamentals, and the
bits and pieces here and there as needed. Database connectivity, web
(server based) apps are of interest as most work I do is related to these.
Current projects include pulling stats from a database (Postgres,mysql) in
python and, a web credit card payment system in php. Im also maintaining
one of our "legacy" systems in perl.
I have lots of time, and I want use doing something productive in java,
that is my aim.
Directions will be helpfull....
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
- 3
- 4
- Interested in ai project in java ??hi, anybody interested in long term artificial intelligence software
project to develop an intelligent bot for stock market trading in india
?, the project is to be implemented in java using the bea weblogic
application server platform on almost all paltforms
(windows/linux/solaris/bsd), with a capability of handling the trading
accounts of thousands of clients with their perferances. if u r
interested plz let me know. i will put all the project requirements and
tools and programming languages required for the project in my project
page at http://www.aistockbot.ravichoudhari.worldfreeweb.com after 22nd
jan 2k6. if u r interested then send me a mail at
email***@***.com.
- 11
- Anonymous inner Classes accessing final variables?Hi
When a write an inner class inside a method , it can access the
variables in the enclosing method if and only if they are final ...
Why is the compiler enforcing this ??
What might be the reason for java doing this ?? Is it that these Local
Variables will be cached for Inner class usage ??
Thanks a lot in advance!
- 12
- ANNOUNCE: Ice 2.0 releasedHi,
we've just released Ice 2.0 with quite a lot of new features:
- new language mappings for Visual Basic and Python
- a new light-weight and super-efficient firewall
- a streaming API that allows you to control the encoding and decoding of
objects in arbitrary formats (or the native Ice format)
- dynamic invocation and dispatch interfaces, so you can write generic
clients and server that do not require compile-time type knowledge
- new chapters in the documentation for the new features
- numerous other improvements and bug fixes
See http://www.zeroc.com/vbulletin/showthread.php?s=&threadid=987
for more info.
Cheers,
Michi.
- 14
- thread status jdk 1.3How can I know thread status with jdk 1.3?
It doesn't have thread.getStatus().
How can I do?
Thanks
Palmis
- 15
- Reading data from a file using AntHi Everyone,
Im new to Ant and I am encountering some problems.
I have a text file which contains a value in there. I need that value
to be set into another file.
I tried using Javascript but Javascript does not support I/O for files.
Is there any command in Ant that can read a value from a text file (
eg. output.txt ) and then use that value to replace into another file (
eg. jsp ).
Thanks,
Marvin
- 15
- type Map does not take parameters ?Hi all,
I got a strange error message from the java 1.5.0 compiler:
"type Map does not take parameters" which Map certainly does.
The complete code was this mini class:
import java.util.*;
class AAA {
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<Integer,String>();
System.out.println(map);
}
}
NB, it does not compile with the original compiler, but compiles happily
within an Eclipse 3.1 environment.
And it does also compile with the original compiler when I change the
reference type from Map to HashMap.
How can this be?
Yours,
Bu.
- 15
- Instant dragging from JTreeHi NG,
I cannot drag an unselected element of a JTree. First I have to select
it, then I can drag it. Is there a way to implement that? I think I can
spare that extra click.
Best regards, Christoph
- 15
- log4j - openning a new fileHi,
I need to open a new log file in a specific location in the code, how
can I do that?
Log file size and number of records are unknown so I cannot use this
information.
- 16
- Hiding table columns?Hi,
I'm no professional programmer, but I suppose I know enough about the
Table API to do most of the things I need. Now I'm trying to figure
out a good way to implement a functionality into my apps to toggle the
visibility of table columns.
I wonder if anyone here can provide some tips on how to handle this as
the TableColumn class doesn't seem to provide a setVisible() method.
All my tables use a TableModel, so I suspect that's where I need to do
most of the stuff. I'm thinking of setting up some kind of
two-dimensional array to hold the column names, and a visibility flag
for each column. In the TableModel methods I could then use that flag
to determine what columns and data should be processed.
Any help is much appreciated.
--
Luc Van Bogaert
|
| Author |
Message |
sharper3

|
Posted: 2007-3-30 4:53:00 |
Top |
java-programmer, Protected inner classes and inheritance
Apologies if I am missing something obvious, but here's the situation. I have
a top-level class with a protected inner class. I have a second-level class
in a different package that extends the top-level class. For example:
package somePackage;
public class TopLevel
{
protected class Inner
{
protected int intField = 0;
protected Inner()
{
// constructor
}
protected void innerMethod()
{
return;
}
}
}
package somePackage.otherPackage;
import somePackage.TopLevel;
import somePackage.TopLevel.Inner;
public class SecondLevel extends TopLevel
{
public SecondLevel()
{
// constructor
}
public void someMethod()
{
Inner inner = new Inner();
inner.intField = 1;
inner.innerMethod();
}
}
When I compile the second class, I get at least 4 errors:
The type somePackage.TopLevel.Inner is not visible
The constructor TopLevel.Inner() is not visible
The field TopLevel.Inner.intField is not visible
The method innerMethod() from the type TopLevel.Inner is not visible
I thought I read the Java docuementation clearly when is says
"The protected modifier specifies that the member can only be accessed within
its own package (as with package-private) and, in addition, by a subclass of
its class in another package."
and
"You can use the same modifiers for inner classes that you use for other
members of the outer class. For example, you can use the access specifiers --
private, public, and protected -- to restrict access to inner classes, just as
you do to other class members."
If I simply make TopLevel.Inner a public class, the errors go away. But I
don't really want to do that... Anything obvious??
thanks
scott
|
| |
|
| |
 |
sharper3

|
Posted: 2007-3-30 4:58:00 |
Top |
java-programmer >> Protected inner classes and inheritance
In article <GGVOh.4023$email***@***.com>, email***@***.com (Scott Harper) wrote:
>
>If I simply make TopLevel.Inner a public class, the errors go away. But I
>don't really want to do that...
Check that... I have to make *everything* in the Inner class public to
resolve all the errors. And by doing that I no longer need to import the
Inner class either...
scott
|
| |
|
| |
 |
sharper3

|
Posted: 2007-3-30 5:01:00 |
Top |
java-programmer >> Protected inner classes and inheritance
In article <OLVOh.4024$email***@***.com>, email***@***.com (Scott Harper) wrote:
>In article <GGVOh.4023$email***@***.com>,
> email***@***.com (Scott Harper) wrote:
>>
>>If I simply make TopLevel.Inner a public class, the errors go away. But I
>>don't really want to do that...
>
>Check that... I have to make *everything* in the Inner class public to
>resolve all the errors. And by doing that I no longer need to import the
>Inner class either...
Also, if I move the SecondLevel class into the package somePackage, I can keep
the Inner class and its members protected.
|
| |
|
| |
 |
visionset

|
Posted: 2007-3-30 5:02:00 |
Top |
java-programmer >> Protected inner classes and inheritance
"Scott Harper" <email***@***.com> wrote in message
news:OLVOh.4024$email***@***.com...
> In article <GGVOh.4023$email***@***.com>,
> email***@***.com (Scott Harper) wrote:
>>
>>If I simply make TopLevel.Inner a public class, the errors go away. But I
>>don't really want to do that...
>
> Check that... I have to make *everything* in the Inner class public to
> resolve all the errors. And by doing that I no longer need to import the
> Inner class either...
>
>
Inner is only accessible to members of the same package or any subclass.
You are not in the same package and you have no subclass of Inner.
--
Mike W
|
| |
|
| |
 |
Lew

|
Posted: 2007-3-30 6:15:00 |
Top |
java-programmer >> Protected inner classes and inheritance
visionset wrote:
> Inner is only accessible to members of the same package or any subclass.
> You are not in the same package and you have no subclass of Inner.
What about
> public class SecondLevel extends TopLevel
from the original post?
I, too, am surprised that Inner (not its members, but the class itself) would
not be accessible from a subclass.
-- Lew
|
| |
|
| |
 |
visionset

|
Posted: 2007-3-30 6:23:00 |
Top |
java-programmer >> Protected inner classes and inheritance
"Lew" <email***@***.com> wrote in message
news:email***@***.com...
> visionset wrote:
>> Inner is only accessible to members of the same package or any subclass.
>> You are not in the same package and you have no subclass of Inner.
>
> What about
>> public class SecondLevel extends TopLevel
> from the original post?
I don't see that is relevant.
However, when I made the inner class subclass TopLevel.Inner it didn't help,
and so now I'm suprised too.
I couldn't find anyhing in the JSL that made explicit mention to this. Only
the phrase 'not all modifiers apply to all declarations' or some such. I'm
aware of this and that the compiler silently ignores superfluous key-wordage
all over the place eg public in interface methods.
>
> I, too, am surprised that Inner (not its members, but the class itself)
> would not be accessible from a subclass.
>
> -- Lew
|
| |
|
| |
 |
Daniel Pitts

|
Posted: 2007-3-30 6:29:00 |
Top |
java-programmer >> Protected inner classes and inheritance
On Mar 29, 2:00 pm, email***@***.com (Scott Harper)
wrote:
> In article <OLVOh.4024$email***@***.com>, email***@***.com (Scott Harper) wrote:
>
> >In article <GGVOh.4023$email***@***.com>,
> > email***@***.com (Scott Harper) wrote:
>
> >>If I simply make TopLevel.Inner a public class, the errors go away. But I
> >>don't really want to do that...
>
> >Check that... I have to make *everything* in the Inner class public to
> >resolve all the errors. And by doing that I no longer need to import the
> >Inner class either...
>
> Also, if I move the SecondLevel class into the package somePackage, I can keep
> the Inner class and its members protected.
Actually, I think the problem is with your import statements:
Change them to:
import somePackage.TopLevel;
//import somePackage.TopLevel.Inner; Or delete this...
and try again.
|
| |
|
| |
 |
Piotr Kobzda

|
Posted: 2007-3-30 7:50:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Daniel Pitts wrote:
[...]
> Actually, I think the problem is with your import statements:
> Change them to:
> import somePackage.TopLevel;
> //import somePackage.TopLevel.Inner; Or delete this...
It makes an Inner class accessible from SecondLevel. However, it's
strange a bit that the compiler checks an access to classes on import
statement level... it shouldn't (IMO) !
Anyway, previously inaccessible members of TopLevel.Inner class now
might be accessed that way:
public class SecondLevel extends TopLevel {
protected /* or private */ class Inner extends TopLevel.Inner {
// all protected members of TopLevel.Inner are accessible
here...
piotr
|
| |
|
| |
 |
sharper3

|
Posted: 2007-3-30 8:08:00 |
Top |
java-programmer >> Protected inner classes and inheritance
In article <email***@***.com>, "Daniel Pitts" <email***@***.com> wrote:
>
>Actually, I think the problem is with your import statements:
>Change them to:
>import somePackage.TopLevel;
>//import somePackage.TopLevel.Inner; Or delete this...
>
>and try again.
no, that doesn't solve it...
scott
|
| |
|
| |
 |
Daniel Pitts

|
Posted: 2007-3-30 8:18:00 |
Top |
java-programmer >> Protected inner classes and inheritance
On Mar 29, 5:07 pm, email***@***.com (Scott Harper)
wrote:
> In article <email***@***.com>, "Daniel Pitts" <email***@***.com> wrote:
>
>
>
> >Actually, I think the problem is with your import statements:
> >Change them to:
> >import somePackage.TopLevel;
> >//import somePackage.TopLevel.Inner; Or delete this...
>
> >and try again.
>
> no, that doesn't solve it...
>
> scott
Hmm..
You're right. However, if you make everything public, you can keep
Inner protected.
This make sense to me in a way.
Inner's members are protected from anyone who doesn't inherit from
Inner. The only inconsistency here is that outer classes can reference
inner classes members, regardless of access modifier. Inner itself
isn't inherited into SecondLevel, only the namespace of the definition
is.
|
| |
|
| |
 |
sharper3

|
Posted: 2007-3-30 9:11:00 |
Top |
java-programmer >> Protected inner classes and inheritance
In article <email***@***.com>, "Daniel Pitts" <email***@***.com> wrote:
>
>Hmm..
>You're right. However, if you make everything public, you can keep
>Inner protected.
>
>This make sense to me in a way.
>
>Inner's members are protected from anyone who doesn't inherit from
>Inner. The only inconsistency here is that outer classes can reference
>inner classes members, regardless of access modifier. Inner itself
>isn't inherited into SecondLevel, only the namespace of the definition
>is.
Ah ha, I hadn't tried that particular permutation, but right you are...
So, I'm not inheriting from Inner, I'm inheriting from TopLevel, which has
Inner as a (protected) member. I guess by making Inner itself protected, only
my inherited class (SecondLevel) has access to it (outside of Inner's
package). And then, because Inner's members are all public, once I can
"see" the class, I have access to the public members.
Any other class that didn't inherit from TopLevel wouldn't be able to
reference Inner anyway, so it doesn't matter if its members are public or not.
Or is that what you just said? :-)
Just for grins, I made Inner private, and sure enough, even though its members
are still public, the inheriting class (SecondLevel) can't resolve them.
thanks
scott
|
| |
|
| |
 |
Lew

|
Posted: 2007-3-30 10:03:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Scott Harper wrote:
> Any other class that didn't inherit from TopLevel wouldn't be able to
> reference Inner anyway, so it doesn't matter if its members are public or not.
Classes in the same package with TopLevel would see TopLevel's protected
members whether or not they extend TopLevel.
-- Lew
|
| |
|
| |
 |
Piotr Kobzda

|
Posted: 2007-3-30 15:20:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Scott Harper wrote:
> In article <email***@***.com>, "Daniel Pitts" <email***@***.com> wrote:
>> Actually, I think the problem is with your import statements:
>> Change them to:
>> import somePackage.TopLevel;
>> //import somePackage.TopLevel.Inner; Or delete this...
>>
>> and try again.
>
> no, that doesn't solve it...
It does. Moreover, it solves most important problem. Even when all
Inner's members are public, and both above imports holds, the compiler
complains with:
SecondLevel.java:4: somePackage.TopLevel.Inner has protected access in
somePackage.TopLevel
import somePackage.TopLevel.Inner;
^
1 error
So the above change is required to solve other problems.
After having it solved you can choose from different solutions of
accessing Inner's members (make them public, inherit using own inner
class, and the like...).
However, I don't understand why the compiler prohibits the second
import? Importing something doesn't implies any access violation on its
use, does it?
Is there some reasonable explanation for that prohibition?
piotr
|
| |
|
| |
 |
Piotr Kobzda

|
Posted: 2007-3-30 16:16:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Scott Harper wrote:
[...]
> Any other class that didn't inherit from TopLevel wouldn't be able to
> reference Inner anyway, so it doesn't matter if its members are public or not.
It's safe, if you do not expose any Inner's instance to the other
classes, and Inner constructors are protected (or private). Otherwise,
public members are accessible.
For example, the following will change 'intField' of a given
TopLevel.Inner instance:
Object innerInstance = ...
innerInstance.getClass().getField("intField")
.setInt(innerInstance, 100);
> Just for grins, I made Inner private, and sure enough, even though its members
> are still public, the inheriting class (SecondLevel) can't resolve them.
Even when class is private, reflective access to its public members is
still allowed -- standard Java security mechanisms (SecuritManager
enabled, etc.) do not prohibit that.
Of course, my first statement from this post still holds here, if you
protect an instance and its class' constructors, you are safe.
piotr
|
| |
|
| |
 |
Piotr Kobzda

|
Posted: 2007-3-30 17:25:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Daniel Pitts wrote:
> However, if you make everything public, you can keep
> Inner protected.
[...]
> Inner's members are protected from anyone who doesn't inherit from
> Inner.
Not fully protected (see my previous post).
> The only inconsistency here is that outer classes can reference
> inner classes members, regardless of access modifier. Inner itself
> isn't inherited into SecondLevel, only the namespace of the definition
> is.
Hmm... I don't get it -- there is no any inconsistency IMHO.
AIUI, the Inner class is a member of TopLevel class, and as a member
(not a ?namespace?) is inherited by/into the SecondLevel class.
The access modifiers of Inner's members are honored the same way as for
any other language element, regardless of the SecondLevel class access
level to the Inner class.
That's how I see that. Am I missing something?
piotr
|
| |
|
| |
 |
Lew

|
Posted: 2007-3-30 21:15:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Piotr Kobzda wrote:
> Daniel Pitts wrote:
>
>> However, if you make everything public, you can keep
>> Inner protected.
>
> [...]
>
>> Inner's members are protected from anyone who doesn't inherit from
>> Inner.
>
> Not fully protected (see my previous post).
>
>> The only inconsistency here is that outer classes can reference
>> inner classes members, regardless of access modifier. Inner itself
>> isn't inherited into SecondLevel, only the namespace of the definition
>> is.
>
> Hmm... I don't get it -- there is no any inconsistency IMHO.
>
> AIUI, the Inner class is a member of TopLevel class, and as a member
> (not a ?namespace?) is inherited by/into the SecondLevel class.
>
> The access modifiers of Inner's members are honored the same way as for
> any other language element, regardless of the SecondLevel class access
> level to the Inner class.
>
> That's how I see that. Am I missing something?
It's dicey to articulate Java's rules because sometimes we see it as a
strictly compiled language, and sometimes we explicitly acknowledge its
interpretive and reflective capabilities. I was reading the first part of the
thread in terms of javac only, as stated by the OP, wherein reflection is not
relevant.
Had the topic opened the door to runtime considerations then we'd be in "yeah,
but" territory.
-- Lew
|
| |
|
| |
 |
Piotr Kobzda

|
Posted: 2007-3-30 23:13:00 |
Top |
java-programmer >> Protected inner classes and inheritance
Lew wrote:
> Piotr Kobzda wrote:
>> Daniel Pitts wrote:
>>
>>> However, if you make everything public, you can keep
>>> Inner protected.
>>
>> [...]
>>
>>> Inner's members are protected from anyone who doesn't inherit from
>>> Inner.
>>
>> Not fully protected (see my previous post).
>>
>>> The only inconsistency here is that outer classes can reference
>>> inner classes members, regardless of access modifier. Inner itself
>>> isn't inherited into SecondLevel, only the namespace of the definition
>>> is.
>>
>> Hmm... I don't get it -- there is no any inconsistency IMHO.
Ah, I see that now! Daniel is talking about inconsistency with general
access rules between the same level outer and inner classes -- which I
completely agree with (don't mind here, how that access is
implemented!). I, by mistake, tried to apply Daniel's point into the
OP's particular case, taking as outer class the SecondLevel class (not
even sure now, if it's legal to call it outer?). So, that part is clear
now.
>>
>> AIUI, the Inner class is a member of TopLevel class, and as a member
>> (not a ?namespace?) is inherited by/into the SecondLevel class.
>>
>> The access modifiers of Inner's members are honored the same way as
>> for any other language element, regardless of the SecondLevel class
>> access level to the Inner class.
>>
>> That's how I see that. Am I missing something?
>
> It's dicey to articulate Java's rules because sometimes we see it as a
> strictly compiled language, and sometimes we explicitly acknowledge its
> interpretive and reflective capabilities. I was reading the first part
> of the thread in terms of javac only, as stated by the OP, wherein
> reflection is not relevant.
Sure. However, I'm not really care about reflection here.
> Had the topic opened the door to runtime considerations then we'd be in
> "yeah, but" territory.
Oh, not really. My confusion expressed here is Java language level related.
For me, each inner class is _a member_ of the class immediately
enclosing it, and just like other members (i.e. fields, and methods), is
inherited by subclasses of that enclosing class.
Daniel said, that inner class is not inherited, and that's what I'm
trying to argue with.
piotr
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- How best to keep code and gui separated but harmoniousHello,
I am wishing to create an image model class and will need some way to
display images.
I know that JFrame, JPanel and Canvas support displaying images and are
ideal candidates.
Rather than put all the code for image related functionality in one of
these components, I want to be able to create an image model class
separately taking one of these components or even a subclass of these
components but only this range of components and perform operations on
it I guess like an MVC but only two classes not three.
So as an example I have JFrame but do not want to display the image
directly on it but instead want to use a JPanel or a Canvas inside a
scroll pane and have my image model class perform the operations on the
JPanel or Canvas or subclass of.
So I know that the image model class would take a reference to the
JPanel, Canvas or a subclass of these but nothing else and the JFrame
would have a reference to the image model class.
Selecting menu or button items from the JFrame would invoke a command,
passed to the image model class which would execute the command and
apply changes to the JPanel, Canvas or subclass of one of these.
How would I even start I have read information on Generics and
Interfaces and can see either of these could be used but not sure where
to start.
I am not trying to create a photoshop clone :) but want basics like zoom
in out and area, rotate and flip. In time I will probably add new image
related functionality, but don't want to be tied to a JPanel or a Canvas
or anything, especially if a new component appears in the future which
maybe better suited?
I hope someone can understand what I am trying to achieve here I sort of
do but it is still a bit hazy and vague and not sure where to start or
how to start.
Thanks
Rich
- 2
- weird exception during start of applet... (J2SE5)Hi,
does somebody have an idea what the exception:
java.lang.NoClassDefFoundError: IllegalName: <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown
Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown
Source)
at Graph.init(Graph.java:465)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
mean?
The weird thing is, i have two pages on the first one i get this
exception
and on the other one, the applet work.
Check it out
not working -> http://www.stephan-zehrer.de/LiveGraph
working -> http://www.stephan-zehrer.de/html/graph/
They both uses the same jar file.
What's wrong?
thx
Steve
- 3
- Eclipse Javadoc Auto-Formatting: HTML Tags Trailing Spacecomp.lang.java.softwaretools -
I've been using Eclipse for a few years and am currently using 3.1. I've
noticed that whenever I include an anchor (<a>) tag in my Javadoc, the code
formatter always adds a trailing space before the closing tag. E.g.
Before: Go <a href="http://www.google.com">here</a>.
After: Go <a href="http://www.google.com">here </a>.
It doesn't happen with the <code> tag, and I'm hoping that it's configurable
somewhere. It's doesn't appear to be an option in the main Code Formatter
interface.
Thanks,
Josh
--
Josh
- 4
- Questions for the Smalltalkers and the Javaists (?)In article <email***@***.com> (Mon, 31 May 2004
20:49:51 +0000), Roedy Green wrote:
> On Mon, 31 May 2004 16:28:13 -0400, James A. Robertson
> <email***@***.com> wrote or quoted :
>
>>>> Java has some significant advantages, but programming is unlikely
>>>> to be one of them.
>>>
>>>Troll.
>>
>>Meaning, you had no actual rebuttal to anything he said.
>
> You could look on at as a challenge to demonstrate the
> alleged troll's sincerity.
The troll's not very sincere. Unfortunately, my statement was quoted out
of context.
I don't mean to say that Java is a bad language and it's certainly proven
itself to be useful; it has considerable support in the industry, by far
its biggest benefit.
What does Smalltalk have that "Java" doesn't -- with the possible
exception of IBM's late VisualAge for Java? An integrated environment,
where the editor, compiler, class browser, debugger, process manager, et
al., all run together.
Some disclaimers:
* The benefit of the fully-integrated environment is perhaps not obvious
without having used it. I liked (but not loved) the VB6 environment
until I tried Eclipse. I really liked (but not loved) Eclipse until
I tried Smalltalk.
* Until October, I was fully convinced of the necessity for static type
checking. Since then, I've learned Python and Smalltalk, often finding
now that dynamic typing allows considerable freedom, conciseness and
expressiveness in programming.
What's wrong with Java?
* A large, complicated grammar. Python has a cleaner syntax, and
Smalltalk's is sufficiently simple it never gets in the way.
* Static type checking with a compiler that allows certain Array
operations to succeed but which can be shown, statically, to
cause type exceptions at runtime.
- 5
- JNI: Accessing value in an arrayI have a code::
jobject headerVal;
//jsize size = 0;
jclass objClass;
jmethodID mid = NULL;
void * headval;
do
{
/* after this call, headval will contain a pointer to an array.and
HeadID will contain an int value.*/
GetValue( headval,headdID);
if(headval)
{
objClass = (*env)->FindClassenv, "Ljava/lang/Object;");
if(objClass == NULL)
{
break;
}
mid = (*env)->GetMethodID(env, objClass, "<init>", "(J)V");
if(mid == NULL)
{
break;
}
if(headID>0x30 || headID < 0x3F)
{
headerVal = (*env)->NewObject(env, objClass, mid,(jstring)headval);
}
else if(headerID>0x70 || headerID < 0x7F)
{
headerVal = (*env)->NewObject(env, objClass, mid,(jbyteArray)headval);
}
else if(headerID>0xB0 || headerID < 0xBF)
{
headerVal = (*env)->NewObject(env, objClass, mid,
(jbyte)headval);
}
else if(headerID>0xF0 || headerID < 0xFF)
{
headerVal = (*env)->NewObject(env, objClass, mid,
(jlong )headval);
}
}
}while(FALSE);
return headerVal;
}
I know it is not the correct way to assign headerVal. how can i assign
the value contained in array pointed by headval???
I am a beginner in c and dont know much abt pointers...
please do help me...
- 6
- operator precedance: new MyClass.method()Hi,
According to the operator precedence table, the dot operator has a higher
precedence than the 'new' operator:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html
Therefore when I write
new myClass.method()
it should, according to this table, be parsed as
new (myClass.method())
which is nonsensical and doesn't compile.
It seems to be parsed as this instead:
(new myClass).method()
Is there an explanation?
****
sample code:
****
public class C {
public int i = 0;
public C(int i) {
this.i = i;
}
public int getI() {
return i;
}
public static void main(String args[]){
System.out.println(new C(20).getI());
// is parsed as:
//System.out.println( (new C(20)).getI() ); ==> ok
// but according to precedance table should be parsed as:
//System.out.println( new (C(20).getI()) ); ==> wrong
}
}
--
Rob
- 7
- java/44922: JVM crashSynopsis: JVM crash
State-Changed-From-To: open->feedback
State-Changed-By: glewis
State-Changed-When: Thu Apr 1 17:07:01 PST 2004
State-Changed-Why:
The submitter has been asked for feedback.
Responsible-Changed-From-To: freebsd-java->glewis
Responsible-Changed-By: glewis
Responsible-Changed-When: Thu Apr 1 17:07:01 PST 2004
Responsible-Changed-Why:
Over to maintainer.
http://www.freebsd.org/cgi/query-pr.cgi?pr=44922
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 8
- Open source JVM that supports JazelleIs there any open-source JVM available that supports ARM processors
with Jazelle extensions? If not, does anyone know of a closed-source
JVM for Jazelle-enabled ARM processors running under linux that can be
obtained by a lone researcher (I do not work for Nokia, etc)?
I have examined numerous open-source JVMs (Kaffe, gcj, etc.) and have
not seen any evidence of their using Jazelle, and in the Sun
documentation for the CDLC, I have seen references to linux_jazelle.c,
but have not been able to track down the actual code.
Perhaps the Jazelle extensions are a secret? If so, anyone interested
in doing some reverse-engineering?
Thanks in advance, Hobi
- 9
- JTree display update issue with new nodesI have a problem with the following code. The code is supposed to create a
new node and add it as a child to another node in a JTree. This is indeed
happening but the tree is only updating the display and selecting the new
node the first time a node is added. For each subsequent child node, it
appears as though the child node is added successfully but it is just not
appearing in the tree. If I check getChildCount() on the parent node after
each child is added it reveals the correct number so it seems to be a
display issue. Could someone please point out the mistake in the following
code?
This code exists in a control class (not in the JTree itself). The variable
parentNode is a DefaultMutableTreeNode passed in as a parameter:
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode();
parentNode.add(childNode);
tree.setSelectionPath(new TreePath(childNode.getPath()));
MyTreeModel model = (MyTreeModel)tree.getModel();
model.nodesWereInserted(parentNode, new int[] {parentNode.getChildCount() -
1});
tree.repaint();
This is the tree model:
public class MyTreeModel extends DefaultTreeModel
{
private DefaultMutableTreeNode root;
private ArrayList<TreeModelListener> listeners = new
ArrayList<TreeModelListener>();
public MyTreeModel(DefaultMutableTreeNode root)
{
super(root);
this.root = root;
}
public void addTreeModelListener(TreeModelListener l)
{
listeners.add(l);
}
public Object getChild(Object parent, int index)
{
return ((DefaultMutableTreeNode)parent).getChildAt(index);
}
public int getChildCount(Object parent)
{
return ((DefaultMutableTreeNode)parent).getChildCount();
}
public int getIndexOfChild(Object parent, Object child)
{
return
((DefaultMutableTreeNode)parent).getIndex((DefaultMutableTreeNode)child);
}
public Object getRoot()
{
return root;
}
public boolean isLeaf(Object node)
{
return ((DefaultMutableTreeNode)node).isLeaf();
}
public void removeTreeModelListener(TreeModelListener l)
{
listeners.remove(l);
}
public void valueForPathChanged(TreePath path, Object newValue)
{
}
}
--
And loving it,
qu0ll
______________________________________________
email***@***.com
(Replace the "SixFour" with numbers to email)
- 10
- refactoringPatricia Shanahan <email***@***.com> writes:
> Roedy Green wrote:
>> I have always felt that a if a method can have multiple inputs it
>> should be able to have multiple outputs, but very few language
>> designers (Forth and PostScript being exceptions) have agreed.
>
> Matlab is another exception.
As is Common Lisp.
Regards,
Patrick
------------------------------------------------------------------------
S P Engineering, Inc. | Large scale, mission-critical, distributed OO
| systems design and implementation.
email***@***.com | (C++, Java, Common Lisp, Jini, middleware, SOA)
- 11
- Eclipse Plug-insI have installed Eclipse 2.0.2. In working through the tutorial I came
upon "Creating Your First Java Project." Step #5 says this:
Click the Browse button next to the Zip file field and browse to
select
<workbenchRoot>/plugins/org.eclipse.jdt.ui.examples.projects/archive/junit/junit37src.jar.
Note: This step assumes that the JDT example plug-ins have been
downloaded and installed.
The closest thing within the IDE is this:
<workbenchRoot>/plugins/org.eclipse.jdt.ui
I have looked all through the Eclipse website. I have found several
plug-ins but not this set. Can anybody point me in the right
direction?
Bob
- 12
- Converting String<->byte[] -- No Data Loss?If I have a byte[] and I convert it to string (String sData = new
String(byte[] bData), then convert it back (byte bData = sData.getBytes()),
will all data be intact, or do Strings have problems with bytes that are
not printable characters? I've tested this and it seems to work fine, but
I want to make sure there isn't some condition or situation I'm not aware
of that could cause problems.
I'm doing this because it's easier to do some of my work with strings, so
I'm reading a Zip file, saving each entry as a String, modifying some, then
saving it as a new Zip. I've found with Zip files, you can't always be
sure of how much data you'll be able to read in, so I'm reading in data in
blocks upto 2k, then taking each block and converting it to a String, so I
can concatenate the amount read in onto the end of another string. (With
Strings, I can use sString.substring(), I can't find a way to concatenate
byte[] arrays without continually creating a new array and using
System.arrayCopy().)
Thanks for any info.
Hal
- 13
- [Swing-JButton] Images are not displayed from g.drawImage( )I expect from the following program to show a JButton and
an another button of (my) class JImageButton where the states
'normal' and 'pressed' are taken from two PNGs (download from
http://www.geocities.com/theodosisx/2buttons.zip)
in directory C:\images.
I override the paintComponent() method to show the images and for test
reasons i draw also a line.
The problem is, the images are not displayed. Can anyone help me?
The source follows:
import java.awt.image.*;
import java.awt.*;
import javax.imageio.*;
import javax.swing.*;
import java.net.URL;
import java.io.*;
import java.net.*;
class JImageButton extends JButton
{
public Image Im_normal, Im_pressed;
JImageButton ( )
{
Dimension size = getPreferredSize();
size.width = 115;
size.height = 75;
setPreferredSize(size);
Im_normal = Toolkit.getDefaultToolkit().getImage("C:/images/button_normal.png");
Im_pressed = Toolkit.getDefaultToolkit().getImage("C:/images/button_pressed.png");
setOpaque(false);
setFocusPainted(false);
setContentAreaFilled(false);
}
protected void paintComponent( Graphics g)
{
g.drawLine(0,0,20,20);
g.drawImage( Im_normal, 0,0,this);
if ( getModel().isArmed())
g.drawImage( Im_pressed,0,0,this);
else
g.drawImage( Im_normal, 0,0,this);
}
}
public class TestFrame extends JFrame
{
JPanel pane;
JButton A_Normal_Button;
JButton My_JImage_Button;
TestFrame( )
{
pane = (JPanel) this.getContentPane();
pane.setLayout(null);
A_Normal_Button = new JButton ( );
My_JImage_Button = new JImageButton( );
A_Normal_Button.setBounds (new Rectangle(10, 10,80,50));
My_JImage_Button.setBounds(new Rectangle(10,100,115,75));
pane.add(A_Normal_Button);
pane.add(My_JImage_Button);
this.setSize (800,600);
this.setVisible(true);
}
public static void main(String[] args)
{
new TestFrame();
}
}
- 14
- public key encryption javax.cryptoMy primary eperience with crypto is using PGP, but now I'd like to use
crypto in a Java application. I've been wading therough the javadocs
for the "javax.crypto" package, and I'm having a hard time finding any
straightforward way to just perform basic public key encryption like
PGP does. I've found references to ElGamal and Diffie-Hellman
algorithms, but they seem to be all about "key agreements", not
encryption.
Is there anything in javax.crypto that will just let me generate key
pairs and then perform encryptions to public keys and decryptions from
private keys?
- 15
- struts html:checkboxHello
I have a following problem. I want to have both checked in unchecked
checkboxes on my jsp according to values i give them but i dont know how to
force chceckbox that it will be chcecked. I read somewhere that it
corresponds with ActionForm. But how can i set it up before that affect this
checkbox later in form?? I should put it in session ?it doesnt work. when
form is displayed i thought that always a new ActionForm bean is created. So
when can i change values in this bean?? Please help
Marcin Goldyn
|
|
|