| Implementing inheritance in JAVA |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- How can JComboBox listener to MouseEvent?
Since JComboBox and JButton both are
extends from JComponent.
When I addMouseListener(this);
for jButton, it listens to the MouseEvent.
But jComboBox doesn't listen to the MouseEvent.
public void mouseEntered(MouseEvent me) {
System.out.println("mouse entered");
jComboBox.setToolTipText("mouse entered"); // not work
jButton.setToolTipText("mouse entered button"); // works fine
}
mouseEntered just move your mouse pointer on
the object, no need to click (pressed and released).
I just want to detect the mouse entered on JComboBox
(i.e. popup a ToolTip) before I click it for select an item.
Do I miss something? Do I need to setXXX and/or enableXXX
JComboBox before I addMouseListener?
Thank Q for your help!
- 2
- changing the classpath at runtime in codeIs it possible for a java app to change it's classpath at runtime. I
tried:
System.setProperty("java.class.path","foo")
The reason for wanting to try is URLClassLoader will not physically
reread a class file if it is in the classpath. See
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/793a9146df18365a/ceaa154348f6f271#ceaa154348f6f271
- 3
- Java data objects to XMLI am trying to figure out a *smart* way of generating XML documents from
custom data objects. Of course, to be able to apply different XSLTs in the
presentation layer.
The custom data objects will be JavaBeans with attributes and/or collections
of other JavaBeans.
One way would be to create specific converter classes with hard coded XML
tags for each JavaBean that needs to be converted but that isn't very
maintainable. Changes in data objects require changes in the converter
classes.
I see two possibilities:
1. Having a more general converter that is able to convert data objects
according to some DTDs. DTDs could be used for mapping between the data
objects and wanted XML document.
2. Using some open source framework, Quick seems to be suitable.
http://qare.sourceforge.net/web/2001-12/products/quick/
Have any of you solved this problem previously?
David
- 3
- Doubt regarding InterfacesThanks everyone for your replies!
I have a basic question - in the above instance Runnable is an
interface and interfaces cannot be instantiated. So something like 'new
Runnable()' seems puzzling to me. Is this syntax for instantiating an
object of the Anonymous class?
Also, is the above snippet similar to the following in the end result:
class ac implements Runnable{
public void run() {
System.out.println("Hello World on " +
Thread.currentThread());
}
};
ac doHelloWorld = new ac();
- 3
- 3
- XML inputstreamI have used the SAXparser to read XML into a class using
parse(java.io.File f, DefaultHandler dh)
Now I want something different, I want to pass the XML directly, without
a file. I found that I have to use parse(java.io.InputStream is,
DefaultHandler dh) instead. My problem is, how do I generate the
InputStream, since I can only read from an InputStream? How can I have
my class generating an InputStream for the parser?
--
Peter Grison
- 3
- Making Internet DialerGreetings;
I am trying to build a windows internet dialer... I have gained
control of my modem through javax.comm API and I can dial a number
through my modem... the problem is I can not figure out how to pass
the username and password to my ISP.
I want to know what steps are involved in getting connected to my
isp... and also I want my windows O/S to know that i am connected.
Any resource given will be helpful.
I hope someone can help me in this regard.
Thanks
- 3
- newbie java/OOP questionPerhaps someone here can help me with this, I tried asking someone else
about this but couldn't quite describe my question.
I understand that this syntax calls a method on behalf of an object:
b1.method();
but in some java example code I see stuff like this (from a link list app) :
answer.head = IntNode.listCopy(head);
I know that "head" is an instance variable of the class, specfically an
IntNode. I also know that "answer" is a method variable of the type
IntLinkedBag.
My question is: what the heck is going on during the "answer.head"
operation? I don't understand how answer is interacting with head.
They're just two objects. What does the period do when it connects two
objects?
Any pointers or keywords to look up would be apprecited.
--
Mike
Block Banner Ads Now
http://everythingisnt.com/hosts.html
- 3
- emailtosmsemail***@***.com wrote:
> Anyone know how to send sms from email i [sic] mean email to sms
Set the phone number as the destination address, according to the standard
mapping of phone numbers to email addresses set by the devices service provider.
--
Lew
- 3
- J2ME HTTP Post Method ProblemHello,
I built a midlet that sends an information by POST method in HTTP
connection.
in the emulators (such as Nokia 6270,6230, 6230i..) I See the "post
data" in the diagnostic, but the data doesn't arrive to the server. I
tried several servers and they didn't work. I tried to run the SDK's on
different computers and it was the same.
If I run my midlet on my Cellphone (6230) everything works fine.
Example for the post data:
action=Login&Username=tony&password=1234
is a known problem?
Any suggestions on how to solve it ?
Here is additional information:
My J2ME Code:
String params = new String("action=Login&username=&password=");
httpConn = (HttpConnection)Connector.open(url, Connector.READ_WRITE );
httpConn.setRequestMethod(HttpConnection.POST);
httpConn.setRequestProperty("Content-Type", "text/plain");
os = httpConn.openOutputStream();
byte postmsg[] = params.getBytes();
for(int i=0;i<postmsg.length;i++) {
os.write(postmsg[i]);
}
os.flush();
StringBuffer sb = new StringBuffer();
is = httpConn.openDataInputStream();
int chr;
while ((chr = is.read()) != -1) {
sb.append((char) chr);
}
response = new String(sb.toString().getBytes(),"UTF-8");
Here is Simple PHP file which is on the server:
<?php
header('Content-type: text/plain');
if ($_POST["action"]=="Login") {
if($_POST["username"]=='tony') {
echo "<?xml version=\"1.0\"?>\n";
echo "<dictionary>\n";
echo "<Status>1</Status>\n";
echo "<Reason>0</Reason>\n";
echo "<Key>JFKDL54GFDYU85T43NJKGH89N543KGFD</Key>\n";
echo "</dictionary>\n";
exit;
}
else {
echo "<?xml version=\"1.0\"?>\n";
echo "<dictionary>\n";
echo "<Status>0</Status>\n";
echo "<Reason>Wrong Username</Reason>\n";
echo "</dictionary>\n";
exit;
}
}
echo "Not Good!";
?>
When I run the midlet on my cellphone, the server recognize the value
of $_POST["action"]
but when I run the midlet on the emulators, the server doesn't
recognize the value of $_POST["action"]. in other words, the server
doesn't get the string.
But, when I look in the Diagnostic of the emulator I see that the data
were sent.
Here is the log of the Request operation:
Location = [http://10.0.0.101/dic.php]
Request Method = [POST]
Post Data = [action=Login&username=&password=]
Headers (8)
Host = [10.0.0.101]
Content-Type = [ text/plain]
User-Agent = [ Nokia6270/2.0 (p03.20) Profile/MIDP-2.0
Configuration/CLDC-1.1 Profile/MIDP-1.0 Confirguration/CLDC-1.0,
Nokia6270/2.0 (p03.20) Profile/MIDP-2.0 Configuration/CLDC-1.1
UNTRUSTED/1.0]
Content-Length = [ 32]
Connection = [ Keep-Alive]
x-wap-profile = [
"http://nds1.nds.nokia.com/uaprof/N6270r100.xml"]
Here is the log og the response:
Request Status = 200: "OK"
Location = [http://10.0.0.101/dic.php]
Headers (6)
Transfer-Encoding = [ chunked]
Date = [ Tue, 13 Jun 2006 23:30:08 GMT]
Content-Type = [ text/plain]
Server = [ Apache/1.3.33 (Unix) PHP/4.3.10]
X-Powered-By = [ PHP/4.3.10]
Via = [ 1.1 Bezeq-L2TP-MED-Stack1 (NetCache NetApp/5.6.2R1)]
Content Data: 9 bytes, text/plain; ISO-8859-1
Not Good!
(The Not good is the string that appears in the end of the php. we get
there only if the "IF" statment is false.
- 3
- Java EE Developer-HOT HOT OPENINGSTitle: Java EE Developer
Trinity Consultancy Services
Skills: Java EE, EJB, Java, JSF, Spring, Hibernate, JSP
Trinity Consultancy Services is seeking applications from qualified
and experienced software engineers with above skills for various
requirements with their Clients.
Job description:
The Java EE Developer handles web application development using Java
EE and various open source frameworks and technologies.
Responsibilities include the development and implementation of large
and small-scale Java projects using agile methodologies for a variety
of Fortune 500 clients. Technologies and frameworks include: Java EE,
EJB, Java, JSF, Spring, Hibernate, JSP, Servlets, ANT, XML, JBoss,
WebLogic, WebSphere, and Oracle.
Required Experience:
* Bachelor's degree.
* Strong full life cycle software application development background
is required.
* Experience with Struts and/or JSF frameworks
* 1-3 years of solid Java EE development experience in a professional
environment
* Solid knowledge of Object Oriented Analysis and Design techniques.
* Excellent oral and written communication skills.
* Prior project leadership experience is a plus.
* Experience in Financial, Insurance, Commercial Retail or Government
industries.
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
- 14
- Welcome Back Roedy Green!Have you been back for awhile? (Maybe I'm just stupid!)
I was . . surprised to see a post from you
:)
- 14
- How to define a default font for JLabel or whole program?I don't really like how Java2 default font is bold. I think the plain
looks much better.
How can I set the default font for a JLabel or for the whole program.
I would like to change it from BOLD to PLAIN.
About half of my JLabels in my program are anonymous. It would quite a
pain to go and define a bunch of new JLabels, then change the font to
plain.
- 14
- Problem in running external processHello all,
I am facing problem in running external process .
Well i want to run the an external command "HMMBUILD" with two
arguments as "seq.hmm" and "seq.msf"
I have written the following code:
import java.io.*;
public class Test {
public static void main(String argv[ ]) {
try {
String[ ] cmd = {"C:/hmmer-2.3/hmmbuild","abc.hmm","abc.msf"};
String line;
Process p = Runtime.getRuntime ().exec(cmd);
BufferedReader input = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close ();
}
catch (Exception err) {
err.printStackTrace();
}
}
}
But i m not getting any output.
I would of great help to me if anyone could tell me the possible error
that i m commiting.
- 14
- JDO nad MYSQLHello.
Im looking form examples usage JDO (opensource) to MYSQL. It's possible to
it ???
Where can I find it ???
Thanks for Your help
E.N
|
| Author |
Message |
manjunath.d

|
Posted: 2005-2-8 20:00:00 |
Top |
java-programmer, Implementing inheritance in JAVA
Hi,
I am a naive JAVA user. Can you please tell me, oh how to implement
the following scenario
A
^ ^
/ \
B C
^ ^
\ /
D
Classes B and C extends class A, but how to define class D, such that
members of both B and C are available to D.
Thanks
>> manjunath
|
| |
|
| |
 |
asb

|
Posted: 2005-2-8 20:09:00 |
Top |
java-programmer >> Implementing inheritance in JAVA
email***@***.com wrote in comp.lang.java.programmer:
> Classes B and C extends class A, but how to define class D, such that
> members of both B and C are available to D.
Java does not support multiple inheritance, so class D can not
provide the methods through Java's inheritance mechanism.
Internet contains a lot of information about this. Search Google
for "java multiple inheritance".
--
Antti S. Brax Rullalautailu pitæ»— lapset poissa ladulta
http://www.iki.fi/asb/ http://www.cs.helsinki.fi/u/abrax/hlb/
"Disconnect this cable to shorten, re-connect to lengthen."
-- Instructions on Logitech's USB mouse extension cord.
|
| |
|
| |
 |
John

|
Posted: 2005-2-8 20:39:00 |
Top |
java-programmer >> Implementing inheritance in JAVA
email***@***.com wrote:
> Hi,
>
> I am a naive JAVA user. Can you please tell me, oh how to implement
> the following scenario
>
> A
> ^ ^
> / \
> B C
> ^ ^
> \ /
> D
>
> Classes B and C extends class A, but how to define class D, such that
> members of both B and C are available to D.
>
> Thanks
>
>>>manjunath
>
>
You can't. Make D a subclass of A, just like B and C. If you want to
specify some additional behaviour for D then define interface(s) that it
must implement, along with (optionally) either B, C, or both B and C.
John
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2005-2-8 22:25:00 |
Top |
java-programmer >> Implementing inheritance in JAVA
You cannot do that. Java does not support multiply inheritence of
*implementation*.
However, if you were to make A, B and C _interfaces_, then D could
implement both B and C. Then, using patterns (such as
Wrapper/Decorator), you could do the following:
A--extended by-->B--implemented by-->Bimpl
A--extended by-->C--implemented by-->Cimpl
D--extends both-->[B,C]--contains instances of-->[Bimpl,Cimpl]
Then your D could pass calls to those methods defined in the A, B and C
interfaces to the specific instance variables of tyep Bimpl and Cimpl
as necessary.
|
| |
|
| |
 |
Lorenzo Bettini

|
Posted: 2005-2-14 22:45:00 |
Top |
java-programmer >> Implementing inheritance in JAVA
Darryl L. Pierce wrote:
> You cannot do that. Java does not support multiply inheritence of
> *implementation*.
>
> However, if you were to make A, B and C _interfaces_, then D could
> implement both B and C. Then, using patterns (such as
> Wrapper/Decorator), you could do the following:
>
> A--extended by-->B--implemented by-->Bimpl
> A--extended by-->C--implemented by-->Cimpl
>
> D--extends both-->[B,C]--contains instances of-->[Bimpl,Cimpl]
>
> Then your D could pass calls to those methods defined in the A, B and C
> interfaces to the specific instance variables of tyep Bimpl and Cimpl
> as necessary.
>
In our paper
On Multiple Inheritance in Java
L. Bettini, M. Loreti, B. Venneri. Technology of Object-Oriented
Languages, Systems and Architectures, Proc. of TOOLS Eastern Europe
2002, (Theo D'Hondt, Ed.), pages 1-15, Kluwer Academic Publishers, 2003.
http://music.dsi.unifi.it/abstracts/multipinh-abs.html
http://music.dsi.unifi.it/papers/multipinh.ps.gz
we provide a general algorithm to automatically implement multiple
inheritance in Java; this also shows that it is not straighforward to
simulate the exact semantics of multiple inheritance through interfaces
and object composition.
Lorenzo
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science |
| Dip. Sistemi e Informatica, Univ. di Firenze |
| Tel +39 055 4237441, Fax +39 055 4237437 |
| Florence - Italy (GNU/Linux User # 158233) |
| Home Page : http://www.lorenzobettini.it |
| http://music.dsi.unifi.it XKlaim language |
| http://www.lorenzobettini.it/purple Cover Band |
| http://www.gnu.org/software/src-highlite |
| http://www.gnu.org/software/gengetopt |
| http://www.lorenzobettini.it/software/gengen |
| http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Precision problem with doubleHi everyone,
I am a Java beginner, and I am trying to create a very simple binary
tree.
Each node has a value, the left child has the same value + an
increment, the right child has the same value - the same increment.
I try to recursively create the tree, but I have precision problems.
My "main" node has a value of 10, the increment is 0.1, tree depth is
4
So i want a tree that goes like this :
depth 1 : 10
depth 2 : 0.9 / 10.1
depth 3 : 0.8 / 10 / 10 / 10.2
depth 4 : 0.7 / 0.9 / 0.9 / 10.1 / 0.9 / 10.1 / 10.1 / 10.3
But at depth 4 when I try to print the value I get 9.700000000000001
instead of 9.7, and 10.299999999999999 instead of 10.3
And things get worse when the depth increase.
All the values and increment are stored in double (native type).
Is it normal? How can I avoid this problem?
Thanks a lot,
Tom.
[main class]
double increment = 0.1;
double startValue = 10;
int maxDepth = 4;
Tree myTree = new Tree(startValue, 1);
myTree.recursivelyCreateChildren(increment, maxDepth);
[Tree.java]
public int depth;
public double value;
public Tree leftChild;
public Tree rightChild;
Tree(double value, int depth){
this.value=value;
this.depth=depth;
System.out.println("node of depth " + depth + " created, value = " +
value);
}
public void createChildren(double increment){
rightChild = new Tree(value - increment, depth+1);
leftChild = new Tree(value + increment, depth+1);
}
public void recursivelyCreateChildren(double increment, int maxDepth)
{
if (depth < maxDepth){
createChildren(increment);
leftChild.recursivelyCreateChildren(increment, maxDepth);
rightChild.recursivelyCreateChildren(increment, maxDepth);
}
}
- 2
- changing code while program is runningHello,
I would like to have my class code loaded into application, which is
already running. I tried something like this:
public class Main
{
...
private void reloadClass() throws Exception
{
new Pair("","").print(); //class to be reloaded
System.in.read (); //interval - here comes manual class recompilation
ClassLoader.getSystemClassLoader ().loadClass ("Pair"); //reload class
new Pair("","").print(); //check if new version loaded
}
}
It seems that ClassLoader.loadClass checks the presence of the Pair
class in memory and doesn't relod it. How to omit it?
regards
blacky
- 3
- JComboBox strange behaviorHello!
I have interesting problem with javax.swing.JComboBox (java 1.4.2)
When I click at combo to open list - there is no reaction to mouse
moves except these on combo header or outside my combo. So I cannot
choose any item from the list.
But I can use keyboard...
This is default combo, I've just create it and populate some Strings
into it.
any idea what's wrong?
B.
- 4
- 5
- Recognize Windows ShutdownHi,
how can i recognize that Windows is shutting down (when i'm logged off)?
Sorry for stupid questions, but i didn't found the right solution!
Greets,
Nico
-> remove the underscores in the email <-
- 6
- Java FACT ?"FACT: Java has no first-class functions and no macros. This results in
warped code that hacks around the problem, and as the code base grows,
it takes on a definite, ugly shape, one that's utterly unique to Java.
Lisp people can see this clear as day. So can Python folks, so can Ruby
folks. Java people flip out, and say "macros are too much power",
or "what do u mean i dont understand u" or "fuck you, you jerk,
Lisp will NEVER win". -- Steve Yegge, 2006-04-15
what would you people make of the above statement ? Has anyone here
used Lisp *and* Java on major projects ? If so would you say this
sounds off-base or correct ?
thanks,
--dcnstrct
- 7
- 8
- Removing Item From JList - getSelectedIndex problemHi all,
I am currently working on a JList that populates data into a JList
from a CSV file. I have a button that is supposed to get the Selected
index and then delete that item from the JList. Below is the code that
I am using:
int index = lstComputerExceptions.getSelectedIndex();
System.out.println("index is: " + index);
model.remove(0);
int size = model.getSize();
if (size == 0) { //Nobody's left, disable firing.
btnDelete.setEnabled(false);
} else { //Select an index.
if (index == model.getSize()) {
//removed item in last position
index--;
}
lstComputerExceptions.setSelectedIndex(index);
lstComputerExceptions.ensureIndexIsVisible(index);
}
I have printed out what index is and no matter what item I have in the
Jlist I have selected it will always print out
-1. Therefore keeps on causing my program to crash and not delete the
item out of the Jlist.
Any help in this matter would be highly appreicated.
Thank you
- 9
- java/81177: java patch server down
>Number: 81177
>Category: java
>Synopsis: java patch server down
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-java
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Tue May 17 20:30:07 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Ron
>Release: FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD justok.thuisnetwerk.nl 5.4-STABLE FreeBSD 5.4-STABLE #0: Sat May 14 16:24:15 CEST 2005 email***@***.com:/usr/obj/usr/src/sys/MYKERNEL i386
>Description:
jdk14 and jdk15 can not be installed, because http://www.eyesbeyond.com/freebsddom/java/jdk15.html is down.
<code/input/activities to reproduce the problem (multiple lines)>
Use any webbrowser to visit the URL, and see that it's down.
>How-To-Repeat:
>Fix:
Someone should bring up the webserver or let the URL point to a webserver that is up.
>Release-Note:
>Audit-Trail:
>Unformatted:
- 10
- JNI: passing Objects containing non-primitive types back and forthHi folks,
looked through a lot a threads overhere already but did not find an
answer detailed enough:
I want to map a c-structure like this created in my native code
struct mystruct {
long pid ;
long data[] ;
long meta[][] ;
} ;
to a java-object within my Java-code which would look like this IMHO:
public class ComplexData {
final int maxdata = 100 ;
final int maxmeta = 5 ;
private long pid ;
private data[] = new long[maxdata] ;
private meta[][] = new long[maxdata][maxmeta] ;
public void ComplexData() {
// Assigning values
pid = 1234 ;
data[0] = ...
}...
As far as I understood it is now possible to pass this Java-object to
the native code using the JNI-Function NewObject and read the members
and assign their values to the c-structure's members (to make them
available from within c) and the other way round, assign the values
from the c-structure to the members within the Java-object (possibly
without the initialization in the "Java-world" (I need both
directions).
My problem now is: How do I access the object's members (especially
the array types) from within c? Functions pointed to in different
threads (e.g. (Get|Set)LongArrayRegion ) need the reference to the
array, but I have only the reference to the object up to now.
Any code snippets based on the code above would be helpful.
Cheers
Bernd
- 11
- PrintServiceLookup.lookupPrintServices fails to list new printers until re-start (JDK1.4.2_03, Linux RedHat, Tomcat 4.x)Hi Forum,
How could I get
javax.print.PrintServiceLookup.lookupPrintServices(null,null) to return the
current available services while the program that uses lookupPrintServices
is running? In a tomcat servlet I use the lookupPrintServices(..) to get a
list of the printer services available. The class works well and returns the
list but if I install a new printer, the servlet does not list the newly
installed service until I restart Tomcat. Is there a way to unload and
reload the PrintServiceLookup class and then call
PrintServiceLookup.lookupPrintServices?
It appears that the lookupPrintServices(..) returns the list of services
that was available when the instance of the virtual machine was started.
Hence, while the instance is running, it allways returns the same list of
services. If I run a program that lists the services and then exits, the
program lists the newly added printer on re-run. But if the program never
exits (it runs in a loop, re-listing the services every so often), and I add
a new printer while the program is running, the newly added printer is not
listed until I terminate teh rpogram and re-start it.
Thanks in advance for your responser
- 12
- SET CLASSPATHhi, i'm using the abstract class definition, and when compiling the abstract
class it's ok, but the problem is when compiling the subclass: i get the
following message:
Rect.java:9: cannot resolve symbol
symbol : class GeoFigure
location: class figures.Rect
public class Rect extends GeoFigure
^
1 error
the abstract class is called: GeoFigure;
and the subclass is Rect
so how cn use the set classpath at command line, should it include the
directory where are located all the package files(the abstract class and
subclass .java files), or should it point at onel evel before the directory
that contains the package files?
thank's!
--
SAID BARA
- 13
- Vetoing a change by DefaultCellEditor in JTableI'm using a DefaultCellEditor with a JTextField to capture a String
that is ultimately passed to setValueAt in my TableModel. In that
method, I have logic which could throw an exception if the String's
contents proves to be invalid (i.e. one use is where the String is a
regular expression that might be syntactically invalid).
How can I handle this? Right now, the code throws an Exception which
I'd like to catch, display a dialog, and then return the user to
editing without ever committing the value. Is this easily doable?
Regards,
Brian.
- 14
- Download a webpage that contains javascriptI am trying to download the html page at
http://www.dreamteamfc.com/dtfc04/servlet/PostPlayerList?catidx=1
Using the code
public class DownloadWebPage
{ public static void main (String[] args) throws IOException
{
URL url = new
URL("http://www.dreamteamfc.com/dtfc04/servlet/PostPlayerList?catidx=1");
BufferedReader webRead = new BufferedReader(new
InputStreamReader(url.openStream()));
String line;
while ((line = webRead.readLine()) != null)
{
System.out.println(line);
}
}
}
But all I am getting is
<HTML><HEAD><SCRIPT
LANGUAGE="JAVASCRIPT">location.replace("http://www.dreamteamfc.com");</SCRIPT></HEAD></HTML>
I'm guessing that when the web brower meets this code it executes the
javascript
location.replace("http://www.dreamteamfc.com")
And somehow loads the web page.
How do I go about downloading the actual web page that gets displayed
in a normal web browser.
Any help appeciated!
pat
- 15
- Help needed (GUI/passing objects)
Hi, I'm a student learning java. In my latest assignment, I am to create a
Scheduler/Diary, with a GUI.
I am getting the error
Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
<init>
()V not found
at Dairy.main(Dairy.java:22)
From the main method in 'project.class', I create the diary object, which
creates month and day objects etc...
I create a state object, which takes in the Diary Object and points to the
selected month, day, appointment etc
I then create a gui object, which is to change the state (through methods in
the state).
This error occurs whenever I pass in the state object to the GUI
('BaseFrame').
Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
<init>
()V not found
at Dairy.main(Dairy.java:22)
I'm not sure whats causing this. I'm checking like 22 in the 'diary' class,
but it's a }. Not too helpful.
GUI appears when no state object is passed, can't manipulate the data with
that though....
In main:
------------
//set up the Diary
Diary dia = new Diary();
//set up the state
State diaryState = new State(dia);
//Set up the gui
BaseFrame firstFrame = new BaseFrame(diaryState);
---------------
When setting up the GUI:
---------------
State curState;
//constructor for the basic frame, takes in a state object
public BaseFrame(State sta)
{
curState = sta;
.....................}
--------------------------
Done a search online, didn't get too far. Any ideas? What does that error
mean exactly?
|
|
|