petermere Posted April 21, 2010 Share Posted April 21, 2010 1. In Java I have:Class A {private B b;private int field 1;}Class B {private int field 2;private int field 3;} In my jrmx file, how can I access field 2 and field 3, having a list of A object. 2. In iReport, how can I distribute the columns evenly.For example, I have:FirstName Name Telephone.I want all these 3 columns to have the same width. Post Edited by petermere at 04/21/2010 14:20Post Edited by petermere at 04/21/2010 14:28 Link to comment Share on other sites More sharing options...
petermere Posted April 21, 2010 Author Share Posted April 21, 2010 1. b.field2b.field3 2. The columns align automatically. Link to comment Share on other sites More sharing options...
keithrbennett Posted June 11, 2010 Share Posted June 11, 2010 > In my jrmx file, how can I access field 2 and field 3, having a list of A object.You can't. A's reference to its B is private. See the attached code. Code:File Test.java:import java.util.Arrays;import java.util.List;class A { private B b; private int field1;}class B { private int field2; private int field3;}public class Test { void foo() { List<A> list = Arrays.asList(new A()); A a = list.get(0); int n = a.b.field2; }}>javac Test.javaTest.java:19: b has private access in A int n = a.b.field2; ^Test.java:19: field2 has private access in B int n = a.b.field2; ^2 errors Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now