Results 1 to 20 of 51
Thread: Help: strike out in my code
- 12-23-2008, 02:40 AM #1
- 12-23-2008, 02:47 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
That's the right margin of the editor. No need to worry about that at coding time. Actually use it for two reason.
1. To keep away horizontal scroll bar. Easy to read the full page
2. For Java documenting. That margin define the right-side end of the page. If it's going to exceed, NetBeans wrap them to the define page size. In that case your text can be too small.
- 12-23-2008, 03:45 AM #3
bro thanks for your reply.
but wat i meant was the strike out for the code line such as:
dtStart.setDay(st.getDay());
dtStart.setMonth(st.getMonth());
dtStart.setYear(st.getYear());
the strike out can be seen for st.GetDay(), st.getMonth()) ,st.getYear(),
- 12-23-2008, 09:36 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Ah that's what you are talking about.
That's the way NetBeans notified deprecated methods. Those methods are deprecated with the version you are working on. Read on the Java doc, you can find the Suns' suggestion on that.
Keep the cursor on that method and press Shift + F1 to open the Java doc on the NetBeans.
- 12-23-2008, 02:32 PM #5
yea alright ... :D
ok so i did enter the documetation, which mean the above strike out code contains error which the documentation can help suggest the correct input that need to be coded?Last edited by fiqueudrue; 12-23-2008 at 02:34 PM.
- 12-23-2008, 03:54 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Those are not wrong, not comes with errors. But the way it's working is not safe. So Suns' have safe implementations for that. They suggest to use something different. Actually you can use the same things in your code. But keep in mind they are not safe to use.
- 12-24-2008, 01:36 AM #7
yeah i should agree with you that these code could be dangerous.
because when i trired to run the program,and after sdelecting the approx date, which is specifically set from 17-03-2008 to 20-03-2008, the result will show none, but for the exception result stated,
javax.xml.ws.soap.SOAPFaultException: Server was unable to process request. ---> SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
- 12-24-2008, 01:59 AM #8
btw, is there any other method than by invoking this:
javax.xml.datatype.XMLGregorianCalendar dtStart;
dtStart = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();
javax.xml.datatype.XMLGregorianCalendar dtEnd ;
dtEnd = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();
Date st = cldStart.getSelectedDate();
Date en = cldEnd.getSelectedDate();
dtStart.setDay(st.getDay());
dtStart.setMonth(st.getMonth());
dtStart.setYear(st.getYear());
dtEnd.setDay(en.getDay());
dtEnd.setMonth(en.getMonth());
dtEnd.setYear(en.getYear());
- 12-24-2008, 03:05 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
To deal with current data time work around with DateFormat class.
- 12-24-2008, 11:30 AM #10
alright ..
will keep updating about the possible result here.
thanks :D
- 12-24-2008, 04:37 PM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Simply you want to get the current date/time information, isn't it?
Anyway have a try and see.
- 12-26-2008, 05:30 AM #12
yea..
get the date/time of the data given to that date and show the result.
not sure if im doing is correct
Date st = cldEnd.getSelectedDate();
Date en = cldEnd.getSelectedDate();
java.util.Calendar stc =java.util.Calendar.getInstance();
stc.setTime(st);
dtStart.setDay(stc.setTime());
dtStart.setMonth(st.getMonth());
dtStart.setYear(st.getYear());
dtEnd.setDay(en.getDay());
dtEnd.setMonth(en.getMonth());
dtEnd.setYear(en.getYear());
- 12-26-2008, 12:51 PM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
oK what happen when you work on with this code in your application? Did you get the correct results?
I'm not quite clear what you are doing here. Specially because of this,
Java Code:dtStart.setDay(stc.setTime());
- 12-28-2008, 07:19 AM #14
hey bro sorry for the late reply, festive season ya.
heee..
alright, basically, im doind a web service client.
whereby the code generate itself when i called it like below:
try {
// Call Web Service Operation
org.hogauctionwebservice.AuctionServiceSoap port = service.getAuctionServiceSoap();
// TODO initialize WS operation arguments here
javax.xml.datatype.XMLGregorianCalendar dtStart = new javax.xml.datatype.XMLGregorianCalendar();
javax.xml.datatype.XMLGregorianCalendar dtEnd = new javax.xml.datatype.XMLGregorianCalendar();
// TODO process result here
org.hogauctionwebservice.ArrayOfAveragePricePerDay result = port.getHogAuctionPrices(dtStart, dtEnd);
System.out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
- 12-28-2008, 07:23 AM #15
and i edited the current code to be like this:
however,it not working.
the code with dtStart.setDay(stc.DAY_OF_WEEK); where by stc show Access Static Field with orange underline
try {
org.hogauctionwebservice.AuctionServiceSoap port = service.getAuctionServiceSoap();
javax.xml.datatype.XMLGregorianCalendar dtStart;
dtStart = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();
javax.xml.datatype.XMLGregorianCalendar dtEnd ;
dtEnd = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();
Date st = cldEnd.getSelectedDate();
Date en = cldEnd.getSelectedDate();
java.util.Calendar stc = java.util.Calendar.getInstance();
stc.setTime(st);
java.util.Calendar enc = java.util.Calendar.getInstance();
stc.setTime(en);
dtStart.setDay(stc.DAY_OF_WEEK);
dtStart.setMonth(stc.MONTH);
dtStart.setYear(stc.YEAR);
dtEnd.setDay(enc.DAY_OF_WEEK);
dtEnd.setMonth(enc.MONTH);
dtEnd.setYear(enc.YEAR);
org.hogauctionwebservice.ArrayOfAveragePricePerDay result = port.getHogAuctionPrices(dtStart, dtEnd);
List<org.hogauctionwebservice.AveragePricePerDay> d = result.getAveragePricePerDay();
for(int i = 0; i < d.size(); i++){
org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
}
} catch (Exception ex) {
lblEx.setText(ex);
}
- 12-28-2008, 07:37 AM #16
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What's the message you can see on that orange colored text?
- 12-28-2008, 08:09 AM #17
the message shows "Accessing static field DAY_OF_MONTH" for the code dtStart.setDay(stc .DAY_OF_MONTH);and so on for the rest of the code...
Last edited by fiqueudrue; 12-28-2008 at 08:11 AM.
- 12-28-2008, 08:22 AM #18
or do i need to replace that code with this :
dtStart.setDay(java.util.Calendar.DAY_OF_MONTH);
- 12-28-2008, 04:31 PM #19
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Ok what happen when you try that?
Actually you can access static members with class name as the reference, rather using an object.
- 12-29-2008, 01:26 AM #20
Similar Threads
-
Is it possible to code like this?
By Orange in forum New To JavaReplies: 8Last Post: 08-13-2008, 10:29 AM -
Need help with web code
By nemutah1 in forum New To JavaReplies: 1Last Post: 07-10-2008, 08:33 PM -
I need help fixing my code.. or non code?
By MrHuggykins in forum New To JavaReplies: 1Last Post: 03-19-2008, 10:12 PM -
tic tac toe code
By zoe in forum New To JavaReplies: 1Last Post: 07-23-2007, 04:36 PM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks