| Vetoing a change by DefaultCellEditor in JTable |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- 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
- 1
- 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?
- 2
- 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
- 2
- 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:
- 2
- Implementing inheritance in JAVAHi,
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
- 2
- 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
- 3
- 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
- 6
- 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
- 12
- 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
- 15
- 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
- 15
- 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
- 15
- Welcome Back Roedy Green!Have you been back for awhile? (Maybe I'm just stupid!)
I was . . surprised to see a post from you
:)
- 16
- 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
- 16
|
| Author |
Message |
trin

|
Posted: 2003-8-27 8:47:00 |
Top |
java-programmer, Vetoing a change by DefaultCellEditor in JTable
I'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.
|
| |
|
| |
 |
Tor Iver Wilhelmsen

|
Posted: 2003-8-28 1:36:00 |
Top |
java-programmer >> Vetoing a change by DefaultCellEditor in JTable
email***@***.com (Brian J. Sayatovic) writes:
> 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?
Override the TableModel's stopCellEditing() to catch the exception and
return false, otherwise return true.
|
| |
|
| |
 |
| |
 |
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
- Error :could not initialize interface awt - Exception:java.lang.ExceptionInInitializerErrorHello
i had problems by the install of the german language pack 6.0.2.CF1
for a Lotus domino Server 6.0.2 CF1.
the System:
Acer altos 19000 Server
2X Pentium Pro 200 Mhz
512 MB Ram
OS windows 2000 Server SP4
the Update of the Notes Server was no Problem but when I tried to
install the Language Pack German (its an Java install Wizard ) there
coms the following Error Message :
Error :could not initialize interface awt - Exception:
java.lang.ExceptionInInitializerError
and if i installd the java software jre 1.3.1 standart the Aplet in
Systemcontrol could not be opend without anny Error Message.
what can I do?
Please help.
Thanks for Help
Stefan Germany
- 3
- Image Processing Problem. Need HelpHello, I am writing a web application with Java. There is a function that
user can upload a picture to server, and the server will resize it. I am
using the Java API to do this function. However, the result is not very
satisfactory. The resized image quanlity is very bad.
Can anyone reccommend that any way or tool can resize image with good
quality?
Please help. My boss needs me to complete this project this week.
Regards,
Chris
- 4
- Is Eclipse the Commercial IDE Killer?Thomas G. Marshall wrote:
> Super Spinner coughed up:
>> Tim Tyler wrote:
>>> In comp.lang.java.advocacy Super Spinner <email***@***.com>
>>> wrote or quoted:
>>>
>>> [Eclipse plugins]
>>>
>>>> I'd say that anyone that came up with an extension wouldn't be able
>>>> to make money because an OSS group would make a knock-off and give
>>>> it away for free.
>>>
>>> Your argument apparently suggests that nobody can make money selling
>>> software. I think history has proven that that is not the case.
>>
>> I think that one can make money by selling software only if the
>> software is "complex", where "complex" means "too complex to be
>> satisfactorily knocked off by OSS". And the set of "complex" sofware
>> becomes smaller and smaller, as OSS commodotizes more and more
>> markets. I used to think that something like Excel was sufficiently
>> complex to be safe from OSS, but I now know that within the next 5
>> years the spreadsheet market will be fully commodotized and therefore
>> not profitable. The same goes for all "office"-type apps. The same
>> goes for Photoshop and the like.
>>
>> The only software that I can see being safe from commodotization is
>> software that requires special domain knowledge, knowledge that devs
>> themselves do not possess and aren't likely to obtain in a competent
>> manner. Something like tax preparation software; this requires expert
>> knowledge of the tax laws and accountants that have such knowledge
>> aren't foolish enough to work for free like software devs appear to be
>> eager to do. So I can't see OSS "winning" in that space (yes, there
>> are OSS tax preparation packages, but the vast majority won't trust
>> that the devs understand the tax laws enough to trust those packages).
>>
>> Now, as for IDE extensions, sorry, there's no way that those are out
>> of the reach of OSS commodotization. Any extension would be knocked
>> off within a year, so the developers of the original would only have
>> one year to recoup the initial investment of resources and I don't see
>> anyone bothering to try. So nearly all future IDE extensions will
>> have to come from OSS from the get-go.
>>
>> A lot of OSS starts life as poor man's versions of commercial software
>> and gradually improves, but as commercial software is killed off, new
>> software inventions will have to come from OSS itself.
>>
>> As for individual programmers, they'll have to make money by working
>> on in-house stuff or custom solutions for a contractor, because it'll
>> be quite difficult to make money selling software to the general
>> public since OSS competition will make such an effort prohibitive.
>
> I have said for a lonnng time that if you write free software, you are
> only
> making it more difficult for other software engineers to earn a living. I
> don't mean small little utilities, like OE_QuoteFix and the like. But
> creating entirely free large scale applications doesn't make you a hero,
> it makes you a villain.
>
There's an easy solution to this. All the "for money" people have to do is
WRITE BETTER software...
I can't believe that projects like Eclipse are doing so well, simply because
they are OSS. It's because they are better...
--
******************************************************************************
Registered Linux User Number 185956
FSF Associate Member number 2340 since 05/20/2004
Join me in chat at #linux-users on irc.freenode.net
Buy an Xbox for $149.00, run linux on it and Microsoft loses $150.00!
7:42pm up 10 days, 4:15, 1 user, load average: 0.05, 0.07, 0.03
- 5
- Any HID support for Java?Human Interface Device (mouse, etc)
Does anyone know whether java support the HID devices? (under MS
Windows)
I checked the document but did not see any. A google on this group
also returns little information.
Thanks a lot.
- 6
- Reference and Garbage CollectionI'm not quite sure about what kind of references to an object determine
its "alive" quality and its readiness for garbage collection. For the
moment I understand that *any* living reference, including non-explict
of member classes, keep the object alive.
Would you agree that the follwoing class "NeverRelease" entails
instances which will never get prone to garbage collection?
class NeverRelease
{
Child1 child;
public NeverRelease ()
{
child = new Child1();
}
private class Child1
{
}
}
While would you also agree that instances of the following class
"AlwaysRelease" always become garbage because the member class is static
and hence does not take reference to the enclosing class?
class AlwaysRelease
{
Child2 child;
public AlwaysRelease ()
{
child = new Child2();
}
private static class Child2
{
}
}
- 7
- src.zip of j2ee1.4 sdkHi,
I downloaded the j2ee1.4 sdk, but I can't seem to find the source files
in that package. They used to be in a src.zip file, or not? Anyway I
already looked at the Sun website, but I didn't find a URL to download
the source files from.
Kind regards,
Dirk
- 8
- How to receive events from a jcombobox in an internal Jpanel ??Good evening,
I've a Frame with two Jpanel, in Jpanel1 I've a Jcombobox and it's
listener while in Jpanel2 I've a JLabel where I want to write the
selected value of the Jcombobox,
Jpanel1 , Jpanel2 and the main frame are in 3 separate class and files,
this because I want to arrange a modular design.
My question is how I can receive in the main Frame the event coming
from Jcombox value changed in Jpanel1 ???
Thanks for your help
Antonio
www.etantonio.it/en
- 9
- 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
- 10
- performance and memory usage.
Hi
I created a test program to try the speed and size management of the JDK
HashMap. With regards to this I was wondering if anybody has any
comments on whether this is an appropriate way of testing this
performance, i.e. how realistic is the results with respect to caching
influence of data, heap management etc. The code is simple, but would it
produce a correct result. (the program finishes in 11 seconds on my
machine). the code is attached.
Secondly, I was wondering about the memory (heap) usage in java for this
program. It needs at least 256 MB of heap to run to finish. cmd:
java -Xms32m -Xmx256m -cp target/classes/ App
Using -Xmx128m causes OutOfMemoryError.
When calculating on the size of the datastructure i find approx that
2M Dto's = 16MB
2M Integer's for map key = 8MB
2M Integer's for ArrayList = 8MB
Thats a total of 32MB plus some megabytes for the objects,
datastructures, JVM and so on. So probably about 48-64MB in total.
Thats a completely different number from 128 MB or 256 MB.
Does anybody have any comments on why the program requires that much memory?
arnie
*****************
/* Create 2 million Dto objects with random data and insert into HashMap
also add key to an iterable list */
public void test1() {
int size = 2000000;
Map<Integer, Dto> hmap = new HashMap<Integer, Dto> (size);
Collection<Integer> alist = new ArrayList<Integer> (size);
Random r = new Random();
Dto data;
for (int c=size; c>0; c--) {
data = new Dto();
data.ip= r.nextInt(2000000000);
hmap.put(data.ip, data);
alist.add(data.ip);
}
int c = 1;
for (Integer d : alist) {
hmap.get(d);
}
}
/* Simple data placeholder */
public class Dto
{
public int ip;
public int serialnum;
}
- 11
- Java encryption <--> .NET encryptionHajo,
I need to exchange encypted data between
.NET and Java environments. The first
problem I encountered is that symmetric
ciphers in .NET needs initialization
vector and Java counterparts don't.
Can some one point me out the place
where I can find any practise and
patterns for encrypted communication
between Java and .NET ?
thanks for any info
Gawel
- 12
- Location of Temp Directory?I'm having an app developed for me and they are storing the files in a
newly created folder on the C: drive but I don't want to make directory
there. Is there not a way to get the temp variable for machine, like
%temp or %tmp? Thanks
- 13
- what i do wrong???Hello All!
I think I have a mistake in my logical sequence of thoughts...
When I want to take influence on my JComponents (JTextField,
JCheckBox, etc.),
do I have to place a listener within the constructor???
My problem was the following. I wanted to get the values from my
different JTextFields an write them to any *.txt file. That did only
work, when I inserted a KeyListener who registered any changes in the
text fields. But my real problem is now, to get the values back from
the *.txt file an set them with setText(String) in the text fields.
This don't work.
I have seen in the NG, that there will be oft spoken about
revalidate() or repaint(), but that don't work anyway.
It does not matter, what I want to do - set a component enabled, or
disabled or what ever, I have to have an adequate listener within the
constructor so that the changes will be visible, isn't it that way???
For example:
public void any_method()
{
myTextfield.setEnabled(false);
}
// IT DON'T WORK
// ...but I don't know why. When I put it within the constructor, it
works...
I don't know what to to. I know it from MFC, there I could get
influence on my components in any method.
I don't know what I do wrong in Java.
(My program is an application with JFrame and SWING componets. I use
JTabbedPane and for each tab a Jpanel)
There must be a simple solution for my problem (I hope so).
Please led me out from this dead-end street.
Thanks in advance
Dariusz
- 14
- 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.
- 15
- 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
|
|
|