|
is there any means how one can set the print preferences of a jtextpane in the code and print the pane without print dialog?
|
|
|
|
|
print on paper without user interaction? or just setting up a print-view like a PDF-file?
regards
Torsten
I never finish anyth...
|
|
|
|
|
Ive been trying to print both a jtable and a graph on the same paper. anybody with an idea of how this can be achieved?
|
|
|
|
|
I have a function that is similar to the following:
public int LoadFromFile(String fileName) {
FileReader reader = null;
try {
int rval = 0;
reader = new FileReader(fileName);
return rval;
} finally {
if (reader != null) reader.close();
}
} I don't understand why I am getting the compile-time error, "missing return statement". Either execution gets to the line "return rval;", or an exception is thrown and no value needs to be returned. I can get the compile-time error to go away if I move the return value declaration prior to the try block and move the return statement after the finally block (I read online that putting a return statement within the finally block suppresses all exceptions), but I don't understand why I need to do that. Thanks for any help,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
The above code does work. Turns out I had the return statement within a while loop on accident, so if the condition was initially false I wouldn't have thrown an error nor returned a value.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
Hi I am generating xml beans for a project at work and I get the following error when I try to run the generated code.
Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s7EDC8529CB4E8F6B440E5C8C61A4B41C.TypeSystemHolder
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:769)
Can someone please help me with this...
Thanks
Stephen
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Hello
I don't understand the concept of the following:
Q. "Your immutable system will be compromised if you don't make your classes 'final'."
Can someone explain this to me please (with a concrete example)?
Thanks.
Regards,
Treval
|
|
|
|
|
4 Questions in a row, straight from your course papers?
Sounds like it to me......(i'm in the middle of a uni course at the moment, and its full of questions like this)
Go back and review your notes, or start reading about the topics via google.
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
|
Think it through. You have a class designed to be immutible. What does marking it final mean?
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Consider the following text:
Q. "Make the scope of your variables always as narrow as possible,
otherwise conflicts exist in threads; all methods have access to the attribute of the class."
What is the problem with this? What's wrong with having an attribute whose scope is too wide?
Concurrency problems?
Can someone please give me a concrete example in which this problem is explained?
Thank you.
Regards,
CSTreval
|
|
|
|
|
Really simple explained:
if you give access to a variable, anyone who manages to make an instance on the class can access and modify your variable.
So you keep your variables unobtainable to control changes and behaviour of your object.
You give getter and setter to control what your object looks like from the "outside".
You set up an interface to give certain access to some methods.
greets
Torsten
I never finish anyth...
|
|
|
|
|
I don't think it's relating to public/private access, it's relating to scope.
So, prefer variables scoped at method level to variables scoped at instance level where possible. Instance variables are shared across threads; method variables are not. Even if the variable is private, if it is scoped at instance level then two threads could modify it and conflict with each other.
|
|
|
|
|
I agree, this is the view from threads accessing some variables.
greets
Torsten
I never finish anyth...
|
|
|
|
|
Hello
What is meant by the following text?
Q. "public synchronized List (only 1 thread can access it at the same time)"
What does that mean? Does that mean Lists get auto-locked?
Regards,
CSTreval
|
|
|
|
|
The list is synchronized across all threads as described here[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Is this a part of method declaration or what ?
|
|
|
|
|
No it's the constructor as described in the link I gave you. As it says in the description "Returns a synchronized (thread-safe) list".
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hello
Please check out the following picture:
http://i55.tinypic.com/35mk6eq.png[^]
I am interested in knowing what the left and right arrows mean precisely.
Does the arrow to the right mean that 'Thread' is dependent on 'Runnable'?
What does the left (bottom) arrow mean?
Someone told me it means 'inherits'.
I'm not sure how that relates to 'implements'.
It's all a bit fuzzy to me still.
Thank you for reading.
Regards,
|
|
|
|
|
MyRunnable implements the Runnable interface. Runnable extends Thread.
See David Skelly's answer....
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
Wrong way round. Thread implements Runnable.
|
|
|
|
|
bugger.....Reading your answer, i might be half right!
I'm sure i've seen the exact same diagram in my uni course texts, but i can't find it. It will be buried somewhere.
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
This diagram isn't really UML so it is hard to know what it is intended to show.
In UML, the solid arrow means that Thread implements Runnable (Thread is a Runnable).
The other arrow is an open arrow and in UML this would normally represent a "has a" relationship rather than "is a". So, this would mean that MyRunnable has a Runnable, and the concrete implementation of that Runnable is a Thread.
However, the names of the classes in this example lead me to think this is not what is intended.
It might be that MyRunnable implements Runnable, and this runs as the target of a Thread, in which case the meaning of the symbols would be completely reversed. MyRunnable is a Runnable, and Thread has a Runnable target.
In other words, this diagram could have two completely opposite meanings. It is not a good diagram.
|
|
|
|
|
Hello,
I define a class as bellow
public class Items
{
public int id;
public String model;
public String type;
public String name;
public String description;
public String creator;
public Date created;
public void setId(int _id)
{
this.id = _id;
}
public int getId()
{
return id;
}
public void setModel(String _model)
{
this.model = _model;
}
public String getModel()
{
return model;
}
public void setType(String _type)
{
this.type = _type;
}
public String getType()
{
return type;
}
public void setName(String _name)
{
this.name = _name;
}
public String getName()
{
return name;
}
public void setDescription(String _description)
{
this.description = _description;
}
public String getDescription()
{
return description;
}
public void setCreataor(String _creator)
{
this.creator = _creator;
}
public String getCreator()
{
return creator;
}
public void setCreated(Date _created)
{
this.created = _created;
}
public Date getCreated()
{
return created;
}
public Items(int Id, String Model, String Type, String Name, String Description, String Creator, Date Created)
{
this.id = Id;
this.model = Model;
this.type = Type;
this.name= Name;
this.description = Description;
this.creator = Creator;
this.created = Created;
}
}
next, I have another class and in this class I define a method with argument
public class dataInteraction
{
public static insert(int id, String model, String type, String name,
String description, String craetor, Date created )
{
ArrayList arrayList = new ArrayList();
arrayList.add(??????????????)
}
}
my question is do I have to add argument or class?
arrayList.add(Items)
or
arrayList.add(id);
.
.
.
arrayList.add(created);
|
|
|
|