(String)myObject vs myObject.toString() -- Needed Help
Ihave Some thing like
String myString = Integer.parseInt((String)pageContext.getAttribute("myKey"));In page context I'm storing a reference to my class , but tis line gives me an error. ( Class Cast Exception)
But,
String myString = Integer.parseInt(pageContext.getAttribute("myKey").toString()); OR
String myString = Integer.parseInt(" "+pageContext.getAttribute("myKey")); Will solve the problem, please tell me why ?
Thanks in adavnce.
You should try to use the simplest example code you can. Firstly, this
has nothing to do with Integer.parseInt, which return an int not a String
anyway, and pageContext isn't important in this example either. It boils down to:
Object myObject = a reference to my class, whatever that is...
String string1 = (String) myObject;
//versus:
String string2 = myObject.toString();
//or
String string3 = "" + myObject;Is it clearer now?
Similar Messages
-
Need help in Creating classes for my assignment
Hi ,
I just started learning Java and have the following requirement
1) Create the following classes/interfaces using descriptions:
a) Account � data members : id:String, type:String, balance:BigDecimal, methods : Account, Account with String parameter, getId, getType, getBalance, setId, setType, setBalance, deposit, withdraw, compareTo, toString
b) Bank � data members: instance:Bank, accountsMap:Map, customersMap:Map, customersAccount:Map, transactionMap:Map, methods: getAccountsMap, getCustormersMap, getCustomersAccounts, getTransactionMap, associate, addTransaction, getAccount, getCustomer, getAccounts, getTransactions, deposit, withdraw, transfer
c) AccountDoesNotExistException, BankException, CustomerDoesNotExistException, InsufficientFundsException, InvalidAmountException, ZeroAmountException
2) Create the util package using the following class
a) AmountConverter � methods: fromDecimal(BigDecim al), fromString(String)
In 1 b how to Create Instance:bank in the class .Also how to do part2.If possible can you help me with all the parts.Based on these I've some more to do.Here is what I've come with
ACCOUNT.JAVA
import java.math.*;
public class Account {
private String Id;
private String Type;
private BigDecimal balance;
public Account( ) {
public Account(String Id,String Type,BigInteger balance) {
this.Id = Id;
this.Type = Type;
this.balance = balance;
public String getId( ) {
return Id;
public void setId(String Id) {
this.Id = Id;
public String getType( ) {
return Type;
public void setType(String Title) {
this.Title = Type;
public String getBalance( ) {
return id;
public void setBalance(String balance) {
this.balance = balance;
public String withdraw( ) {
public String deposit( ) {
public void setLastName(String LastName) {
this.id = id;
CUSTOMER.JAVA
public class Customer {
private String Id;
private String Title;
private String firstName;
private String lastName;
/** Construct a Customer with no data -- must be a no-argument */
public Customer( ) {
/** Construct a Customer with String Parameter */
public Customer(String Id,String Title,String firstName,String lastName) {
this.Id = Id;
this.Title = Title;
this.firstName = firstName;
this.lastName = lastName;
/** Return the Id. */
public String getId( ) {
return Id;
/** Set the Id */
public void setId(String Id) {
this.Id = Id;
/** Return the Title */
public String getTitle( ) {
return Title;
/** Set the Title */
public void setTitle(String Title) {
this.Title = Title;
/** Return the Firstname. */
public String getFirstName( ) {
return id;
/** Set the Firstname. */
public void setFirstName(String FirstName) {
this.id = id;
/** Return the Lastname. */
public String getLastName( ) {
return LastName;
/** Set the Lastname. */
public void setLastName(String LastName) {
this.id = id;
TRANSRECORD.JAVA
import java.util.*;
import java.math.*;
public class TransRecord implements Comparable{
private Date timeStamp;
private String transType;
private BigDecimal transAmt;
/** Construct a Trans Record with no data -- must be a no-argument */
public TransRecord( ) {
/** Construct a Customer with String Parameter */
public Customer(String transType,String transAmt) {
this.transType = transType;
this.transAmt = transAmt;
/** Return the timeStamp. */
public String gettimeStamp( ) {
return timeStamp;
/** Set the timeStamp */
public void settimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
/** Return the TransType */
public String getTransType( ) {
return TransType;
/** Set the TransType */
public void setTransType(String TransType) {
this.TransType = TransType;
/** Return the TransAmt */
public String getTransAmt( ) {
return TransAmt;
/** Set the TransAmt */
public void setTransAmt(String TransAmt) {
this.TransAmt = TransAmt;
/** Return a String representation. */
public String toString( ) {
/** CompareTo method */
public int compareTo(Object argument)
===============
ACCOUNTDOESNOTEXISTEXCEPTION.JAVA
public class AccountDoesNotExistException
extends Exception
public AccountDoesNotExistException()
super();
public AccountDoesNotExistException(String message)
super(message);
=================
BANKEXCEPTION.JAVA
public class BankException
extends Exception
public BankException()
super();
public BankException(String message)
super(message);
CUSTOMERDOESNOTEXISTEXCEPTION.JAVA
public class CustomerDoesNotExistException
extends Exception
public CustomerDoesNotExistException()
super();
public CustomerDoesNotExistException(String message)
super(message);
ACCOUNTDOESNOTEXISTEXCEPTION.JAVA
public class AccountDoesNotExistException
extends Exception
public AccountDoesNotExistException()
super();
public AccountDoesNotExistException(String message)
super(message);
INSUFFICIENTFUNDSEXCEPTION.JAVA
public class InsufficientFundsException
extends Exception
public InsufficientFundsException()
super();
public InsufficientFundsException(String message)
super(message);
INVALIDAMOUNTEXCEPTION.JAVA
public class InvalidAmountException
extends Exception
public InvalidAmountException()
super();
public InvalidAmountException(String message)
super(message);
ZEROAMOUNTEXCEPTION.JAVA
public class ZeroAmountException
extends Exception
public ZeroAmountException()
super();
public ZeroAmountException(String message)
super(message);
I need help with Bank Class and the util class.Correct me If I've missed any exceptions or if any syntax is wrong
THanks
AKsh -
Need Help in Splitting a String Using SQL QUERY
Hi,
I need help in splitting a string using a SQL Query:
String IS:
AFTER PAINT.ACOUSTICAL.1..9'' MEMBRAIN'I would like to seperate this string into multiple lines using the delimeter .(dot)
Sample Output should look like:
SNO STRING
1 AFTER PAINT
2 ACOUSTICAL
3 1
4
5 9" MEMBRAIN
{code}
FYI i am using Oracle 9.2There's this as well:
with x as ( --generating sample data:
select 'AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN' str from dual union all
select 'BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN' str from dual)
select str,
row_number() over (partition by str order by rownum) s_no,
cast(dbms_xmlgen.convert(t.column_value.extract('//text()').getstringval(),1) as varchar2(100)) res
from x,
table(xmlsequence(xmltype('<x><x>' || replace(str,'.','</x><x>') || '</x></x>').extract('//x/*'))) t;
STR S_NO RES
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 1 AFTER PAINT
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 2 ACOUSTICAL
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 3 1
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 4
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 5 9" MEMBRAIN
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 1 BEFORE PAINT
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 2 ELECTRIC
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 3 2
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 4
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 5 45 caliber MEMBRAIN
{code} -
Need help for string tokenizer!
I need help in writing out the string tokenizer.. i've got all of the functions written except for the nexttokken function which i am stuck in. Can anyone help me out in writing the function?
An example of splitting string by comma
String str"A,B,C";
StringTokenizer st = new StringTokenizer(str,",");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
This is just an example of usage; i would prefer to use split() function instead -
Need help in the String Format method
really need help in string.Format method. I would like to show the s in two digit numbers.
for example:
if s is below 10 then display *0s*
the expecting result is 01,02,03.. 09,10,11....
I tried this method, somehow i got the errors msg. pls advise. thx.
public void setDisplay(String s) {
String tmpSS=String.format("%02d",s);
this.ss.setText(tmpSS);
Edited by: bluesailormoon on May 19, 2008 10:30 AMApparently, you expect the string to consist of one or two digits. If that's true, you could do this:String tmpSS = (s.length() == 1) ? ("0" + s) : s; or this: String tmpSS = String.format("%02d", Integer.parseInt(s));
-
I need help to convert a string to date and time
Good aft,
1.How can i get a date from the user input thro' Frames?
2.How to parse it to the date object(I need to include java.util.Date but for the database i need to include java.sql.*,if i do so, i have error as
found:java.util.Date
Required:java.sql.Date)
3.How to insert into the database
The same i need help to insert time into database?
I need solution and explanation...
Reply me immediately...
If u send me the code, its better to me.Hello,
The best way is to use the HEX to decimal coversion VI in the string pallette. Then, write this decimal directly to your chart. If you are doing it a point at a time put it into a while loop.
Doug -
Need help in laoding flat file data, which has \r at the end of a string
Hi There,
Need help in loading flat file data, which has \r at the end of a string.
I have a flat file with three columns. In the data, at the end of second column it has \r. So because of this the control is going to the beginning of next line. And the rest of the line is loading into the next line.
Can someone pls help me to remove escape character \r from the data?
thanks,
ragHave you looked into the sed linux command? here are some details:
When working with txt files or with the shell in general it is sometimes necessary to replace certain chars in existing files. In that cases sed can come in handy:
1 sed -i 's/foo/bar/g' FILENAME
The -i option makes sure that the changes are saved in the new file – in case you are not sure that sed will work as you expect it you should use it without the option but provide an output filename. The s is for search, the foo is the pattern you are searching the file for, bar is the replacement string and the g flag makes sure that all hits on each line are replaced, not just the first one.
If you have to replace special characters like a dot or a comma, they have to be entered with a backslash to make clear that you mean the chars, not some control command:
1 sed -i 's/./,/g' *txt
Sed should be available on every standard installation of any distribution. At lesat on Fedora it is even required by core system parts like udev.
If this helps, mark as correct or helpful. -
Still need help with case sensitive strings
Hello guy! Sorry to trouble you with the same problem again,
but i still need help!
"I am trying to create a scrypt that will compare a String
with an editable text that the user should type to match that
String. I was able to do that, but the problem is that is not case
sensitive, even with the adobe help telling me that strings are
case sensitive. Do you guys know how to make that comparison match
only if all the field has the right upper and lower case letters?
on exitframe
if field "t:texto1" = "Residencial Serra Verde"then
go to next
end if
end
|----> thats the one Im using!"
There were 2 replys but both of them didnt work, and the
second one even made the director crash, corrupting even previously
files that had nothing to do with the initial problem..
first solution given --
If you put each item that you are comparing into a list, it
magically
makes it case sensitive. Just put list brackets around each
item.
on exitframe
if [field "t:texto1"] = ["Residencial Serra Verde"] then
go to next
end if
end
Second solution given--
The = operator is not case-sensitive when used on strings,
but the < and > operators are case-sensitive.
So another way to do this is to check if the string is
neither greater than nor less than the target string:
vExpected = "Residencial Serra Verde"
vInput = field "t:texto 1"
if vExpected < vInput then
-- ignore
else if vExpected > vInput then
-- ignore
else
-- vExpected is a case-sensitive match for vInput
go next
end if
So any new solutions??
Thanks in advance!!
joao rsmThe first solution does in fact work and is probably the most
efficient way
of doing it. You can verify that it works by starting with a
new director
movie and adding a field named "t:texto1" into the cast with
the text
"Residencial Serra Verde" in the field. Next type the
following command in
the message window and press Enter
put [field "t:texto1"] = ["Residencial Serra Verde"]
You will see it return 1 which means True. Next, make the R
in the field
lower case and execute the command in the message window, it
will return 0
(true).
Now that you know this works, you need to dig deeper in your
code to find
what the problem is. Any more info you can supply? -
Need help in String operations
HI all,
I need help in String operations.I am getting file path of an image as
c:\test\img\abc.gif"
I need to convert it in to c:/test/img/abc.gif".
Can any one suggest the solution for this.
Thanks,
Durga.[email protected] wrote:
I used String replace method but I am not able to do it because "/" is a special character."/" is not a special character, "\" is a special character, which needs to be escaped by "\" itself. -
Need help in converting string to numeric array
I am trying to convert a string to a numeric array ... the first # in the string gets cut off, the last three seem to come through.
This may be fairly simple, but I really haven't worked with the string functions all that much.
Help would be appreciated.
Thanks,
Attachments:
String to Array Example.vi 10 KBSteve Chandler wrote:
If you remove the first and last byte from the string using string subset then the read spreadsheet string would probably have worked.
Yup.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
String to Array ExampleMOD2.vi 10 KB -
Need help with my HttpConnection From Midlet To Servlet...
NEED HELP ASAP PLEASE....
This class is supposed to download a file from the servlet...
the filename is given by the midlet... and the servlet will return the file in bytes...
everything is ok in emulator...
but in nokia n70... error occurs...
Http Version Mismatch shows up... when the pout.flush(); is called.. but when removed... java.io.IOException: -36 occurs...
also i have posted the same problem in nokia forums..
please check also...
http://discussion.forum.nokia.com/forum/showthread.php?t=105567
now here are my codes...
midlet side... without pout.flush();
public class DownloadFile {
private GmailMidlet midlet;
private HttpConnection hc;
private byte[] fileData;
private boolean downloaded;
private int lineNumber;
// private String url = "http://121.97.220.162:8084/ProxyServer/DownloadFileServlet";
private String url = "http://121.97.221.183:8084/ProxyServer/DownloadFileServlet";
// private String url = "http://121.97.221.183:8084/ProxyServer/Attachments/mark.ramos222/GmailId111d822a8bd6f6bb/01032007066.jpg";
/** Creates a new instance of DownloadFile */
public DownloadFile(GmailMidlet midlet, String fileName) throws OutOfMemoryError, IOException {
System.gc();
setHc(null);
OutputStream out = null;
DataInputStream is= null;
try{
setHc((HttpConnection)Connector.open(getUrl(), Connector.READ_WRITE));
} catch(ConnectionNotFoundException ex){
setHc(null);
} catch(IOException ioex){
ioex.printStackTrace();
midlet.alertScreen = new AlertScreen("Error C1", ioex.toString(),
null, AlertType.ERROR);
midlet.alertScreen.setTimeout(Alert.FOREVER);
midlet.display.setCurrent(midlet.alertScreen);
try {
if(getHc() != null){
getHc().setRequestMethod(HttpConnection.POST);
getHc().setRequestProperty("Accept","*/*");
getHc().setRequestProperty("Http-version","HTTP/1.1");
lineNumber = 1;
getHc().setRequestProperty("CONTENT-TYPE",
"text/plain");
lineNumber = 2;
getHc().setRequestProperty("User-Agent",
"Profile/MIDP-2.0 Configuration/CLDC-1.1");
lineNumber =3;
out = getHc().openOutputStream();
lineNumber = 4;
PrintStream pout = new PrintStream(out);
lineNumber = 5;
pout.println(fileName);
lineNumber = 6;
// pout.flush();
System.out.println("File Name: "+fileName);
lineNumber = 7;
is = getHc().openDataInputStream();
long len = getHc().getLength();
lineNumber = 8;
byte temp[] = new byte[(int)len];
lineNumber = 9;
System.out.println("len "+len);
is.readFully(temp,0,(int)len);
lineNumber = 10;
setFileData(temp);
lineNumber = 11;
is.close();
lineNumber = 12;
if(getFileData() != null)
setDownloaded(true);
else
setDownloaded(false);
System.out.println("Length : "+temp.length);
midlet.setAttachFile(getFileData());
lineNumber = 13;
pout.close();
lineNumber = 14;
out.close();
lineNumber = 15;
getHc().close();
} catch(Exception ex){
setDownloaded(false);
ex.printStackTrace();
midlet.alertScreen = new AlertScreen("Error C2+ line"+lineNumber,
ex.toString()+
" | ",
null, AlertType.ERROR);
midlet.alertScreen.setTimeout(Alert.FOREVER);
midlet.display.setCurrent(midlet.alertScreen);
public HttpConnection getHc() {
return hc;
public void setHc(HttpConnection hc) {
this.hc = hc;
public String getUrl() {
return url;
public void setUrl(String url) {
this.url = url;
public byte[] getFileData() {
return fileData;
public void setFileData(byte[] fileData) {
this.fileData = fileData;
public boolean isDownloaded() {
return downloaded;
public void setDownloaded(boolean downloaded) {
this.downloaded = downloaded;
}this is the midlet side with pout.flush();
showing Http Version Mismatch
public class DownloadFile {
private GmailMidlet midlet;
private HttpConnection hc;
private byte[] fileData;
private boolean downloaded;
private int lineNumber;
// private String url = "http://121.97.220.162:8084/ProxyServer/DownloadFileServlet";
private String url = "http://121.97.221.183:8084/ProxyServer/DownloadFileServlet";
// private String url = "http://121.97.221.183:8084/ProxyServer/Attachments/mark.ramos222/GmailId111d822a8bd6f6bb/01032007066.jpg";
/** Creates a new instance of DownloadFile */
public DownloadFile(GmailMidlet midlet, String fileName) throws OutOfMemoryError, IOException {
System.gc();
setHc(null);
OutputStream out = null;
DataInputStream is= null;
try{
setHc((HttpConnection)Connector.open(getUrl(), Connector.READ_WRITE));
} catch(ConnectionNotFoundException ex){
setHc(null);
} catch(IOException ioex){
ioex.printStackTrace();
midlet.alertScreen = new AlertScreen("Error C1", ioex.toString(),
null, AlertType.ERROR);
midlet.alertScreen.setTimeout(Alert.FOREVER);
midlet.display.setCurrent(midlet.alertScreen);
try {
if(getHc() != null){
getHc().setRequestMethod(HttpConnection.POST);
getHc().setRequestProperty("Accept","*/*");
getHc().setRequestProperty("Http-version","HTTP/1.1");
lineNumber = 1;
getHc().setRequestProperty("CONTENT-TYPE",
"text/plain");
lineNumber = 2;
getHc().setRequestProperty("User-Agent",
"Profile/MIDP-2.0 Configuration/CLDC-1.1");
lineNumber =3;
out = getHc().openOutputStream();
lineNumber = 4;
PrintStream pout = new PrintStream(out);
lineNumber = 5;
pout.println(fileName);
lineNumber = 6;
pout.flush();
System.out.println("File Name: "+fileName);
lineNumber = 7;
is = getHc().openDataInputStream();
long len = getHc().getLength();
lineNumber = 8;
byte temp[] = new byte[(int)len];
lineNumber = 9;
System.out.println("len "+len);
is.readFully(temp,0,(int)len);
lineNumber = 10;
setFileData(temp);
lineNumber = 11;
is.close();
lineNumber = 12;
if(getFileData() != null)
setDownloaded(true);
else
setDownloaded(false);
System.out.println("Length : "+temp.length);
midlet.setAttachFile(getFileData());
lineNumber = 13;
pout.close();
lineNumber = 14;
out.close();
lineNumber = 15;
getHc().close();
} catch(Exception ex){
setDownloaded(false);
ex.printStackTrace();
midlet.alertScreen = new AlertScreen("Error C2+ line"+lineNumber,
ex.toString()+
" | ",
null, AlertType.ERROR);
midlet.alertScreen.setTimeout(Alert.FOREVER);
midlet.display.setCurrent(midlet.alertScreen);
public HttpConnection getHc() {
return hc;
public void setHc(HttpConnection hc) {
this.hc = hc;
public String getUrl() {
return url;
public void setUrl(String url) {
this.url = url;
public byte[] getFileData() {
return fileData;
public void setFileData(byte[] fileData) {
this.fileData = fileData;
public boolean isDownloaded() {
return downloaded;
public void setDownloaded(boolean downloaded) {
this.downloaded = downloaded;
}here is the servlet side...
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if(request.getMethod().equals("POST")){
BufferedReader dataIN = request.getReader();
String fileName = dataIN.readLine();
File file = new File(fileName);
String contentType = getServletContext().getMimeType(fileName);
response.setContentType(contentType);
System.out.println("Content Type: "+contentType);
System.out.println("File Name: "+fileName);
int size = (int)file.length()/1024;
if(file.length() > Integer.MAX_VALUE){
System.out.println("Very Large File!!!");
response.setContentLength(size*1024);
FileInputStream fis = new FileInputStream(fileName);
byte data[] = new byte[size*1024];
fis.read(data);
System.out.println("data lenght: "+data.length);
ServletOutputStream sos = response.getOutputStream();
sos.write(data);
// out.flush();
}else{
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
BufferedReader dataIN = request.getReader();
String msg_uid = dataIN.readLine();
System.out.println("Msg_uid"+msg_uid);
JDBConnection dbconn = new JDBConnection();
String fileName = dbconn.getAttachment(msg_uid);
String[] fileNames = fileName.split(";");
int numFiles = fileNames.length;
out.println(numFiles);
for(int i = 0; i<numFiles; i++){
out.println(fileNames);
out.flush();
out.close();
Message was edited by:
Mark.Ramos2221) Have you looked up the symbian error -36 on new-lc?
2) Have you tried the example in the response on forum nokia?
3) Is the address "121.97.220.162:8084" accessible from the internet, on the device, on the specified port? -
I need help with Creating Key Pairs
Hello,
I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
the class is :
import java.io.*;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.*;
import java.security.interfaces.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import au.net.aba.crypto.provider.ABAProvider;
class CreateKeyPairs {
private static KeyPair keyPair;
private static KeyPairGenerator pairGenerator;
private static PrivateKey privateKey;
private static PublicKey publicKey;
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
return;
createKeys();
saveKey(args[0],publicKey);
saveKey(args[1],privateKey);
private static void createKeys() throws Exception {
Security.addProvider(new ABAProvider());
pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
pairGenerator.initialize(1024, new SecureRandom());
keyPair = pairGenerator.generateKeyPair();
privateKey = keyPair.getPrivate();
publicKey = keyPair.getPublic();
private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
out.writeObject(key);
out.close();
private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
out.writeObject(key);
out.close();
the public key is:
�� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�| xpt Javaur [Ljava.lang.String;��V��{G xp q ~ ur [B���T� xp ��ccR}o���[!#I����lo������
����^"`8�|���Z>������&
d ����"B��
^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
How i can generated the key pairs in base 64 or binary????
Thanxs for help me
Luis Navarro Nu�ez
Santiago.
Chile.
South America.I don't use ABA but BouncyCastle
this could help you :
try
java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
java.security.KeyPair kp = kg.generateKeyPair();
java.security.Key pub = kp.getPublic();
java.security.Key pri = kp.getPrivate();
System.out.println("pub: " + pub);
System.out.println("pri: " + pri);
byte[] pub_e = pub.getEncoded();
byte[] pri_e = pri.getEncoded();
java.io.PrintWriter o;
java.io.DataInputStream i;
java.io.File f;
o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
o.println(new sun.misc.BASE64Encoder().encode(pub_e));
o.close();
o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
o.println(new sun.misc.BASE64Encoder().encode(pri_e));
o.close();
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
StringBuffer keyBase64 = new StringBuffer();
String line = br.readLine ();
while(line != null)
keyBase64.append (line);
line = br.readLine ();
byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
keyBase64 = new StringBuffer();
line = br.readLine ();
while(line != null)
keyBase64.append (line);
line = br.readLine ();
byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
System.out.println("pub: " + pubKey);
java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
System.out.println("pri: " + priKey);
catch(Exception e)
e.printStackTrace ();
} -
URGENT: Need help reading URL of current page
Hello kind people!
I need help, and its very simple:
How do i read the URL of a web page?
For example, the URL of this page is:
http://forums.sun.com/thread.jspa?threadID=5327796
So how can i be able to read in this URL in my java program?
thanks SO MUCH
P.S. I HAVE searched the java docs and everything, the closest thing i found was request.getRequestURL().? but i have no idea how to use it. you have NO IDEA how appreciative i would be if you could simply show me exactly how to read in the URL of a given page.
thanks SO MUCH
Edited by: homegrownpeas on Aug 31, 2008 5:19 PMGoing by what I understand here is a simple version of how you can read data from over HTTP.
This expects the "page" to be text (hence an InputStreamReader instead of an InputStream.)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
* GPLv2.
* @author karlm816
public class HomeGrownPeas {
* @param args
public static void main(String[] args) {
HashMap<String, String> params = new HashMap<String, String>();
params.put("threadID", "5327796");
System.out.println(loadHttpPage("http://forums.sun.com/thread.jspa", params));
public static String loadHttpPage(String sUrl, HashMap<String, String> params) {
// Build the HTTP request string
StringBuilder sb = new StringBuilder();
if (params != null) {
for (String key : params.keySet()) {
if (sb.length() > 0) {
sb.append("&");
sb.append(key);
sb.append("=");
sb.append(params.get(key));
System.out.println("params: " + sb.toString());
try {
URL url = new URL(sUrl);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Length", "" + sb.length());
connection.setUseCaches(false);
if (connection instanceof HttpURLConnection) {
HttpURLConnection conn = (HttpURLConnection) connection;
conn.setRequestMethod("POST");
OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
osw.write(sb.toString());
osw.close();
// Now use sb to hold the resutls from the request
sb = new StringBuilder();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String s;
while ((s = in.readLine()) != null) {
sb.append(s);
// To make it more "human readable"
sb.append("\n");
in.close();
} catch (IOException e) {
e.printStackTrace();
return null;
return sb.toString();
} -
Need Help in trying to understand class objects
I need help on understanding following problem.I have two files for that, which are as follows:
first file
public class Matrix extends Object {
private int matrixData[][]; // integer array to store integer data
private int rowMatrix; // number of rows
private int colMatrix; // number of columns
public Matrix( int m, int n )
{ /*Constructor: initializes rowMatrix and colMatrix,
and creates a double subscripted integer array matrix
of rowMatrix rows and colMatrixm columns. */
rowMatrix = m;
colMatrix = n;
matrixData = new int[rowMatrix][colMatrix];
public Matrix( int data[][] )
{ /* Constructor: creates a double subscripted integer array
and initilizes the array using values of data[][] array. */
rowMatrix = data.length;
colMatrix = data[0].length;
matrixData = new int [rowMatrix][colMatrix];
for(int i=0; i<rowMatrix; i++)
for(int j=0; j<colMatrix; j++)
matrixData[i][j] = data[i][j];
public int getElement( int i, int j)
{ /* returns the element at the ith row and jth column of
this matrix. */
return matrixData[i][j];
public boolean setElement( int x, int i, int j)
{ /* sets to x the element at the ith row and jth column
of this matrix; this method should also check the
consistency of i and j (i.e., if i and j are in the range
required for subscripts; only in this situation the operation
can succeed); the method should return true if the operation
succeeds, and should return false otherwise.
for(i=0;i<rowMatrix;i++){
for(j=0;j<colMatrix;j++){
x = matrixData[i][j];
if(i<rowMatrix && j<colMatrix){
return true;
else{
return false;
public Matrix transposeMatrix( )
{ /*returns a reference to an object of the class Matrix,
that contains the transpose of this matrix. */
Verify tata;
Matrix trans;
//Matrix var = matrixData[rowMatrix][colMatrix];
for(int row=0;row<rowMatrix;row++){
for(int col=0;col<colMatrix;col++){
matrixData[rowMatrix][colMatrix] = matrixData[colMatrix][rowMatrix];
trans = new Matrix(matrixData);
return trans;
public Matrix multipleMatrix( Matrix m )
/*returns a reference to an object of the class Matrix,
that contains the product of this matrix and matrix m. */
m = new Matrix(matrixData);
//Matrix var = matrixData[rowMatrix][colMatrix];
for(int row=0;row<rowMatrix;row++){
for(int col=0;col<colMatrix;col++){
//trans[row][col] = getElement(row,col);
return m;
public int diffMatrix( Matrix m )
/*returns the sum of the squared element-wise differences
of this matrix and m ( reference to the formula in the description
of assignment 5) */
return 0;
public String toString( )
/* overloads the toString in Object */
String output = " row = " + rowMatrix + " col="+colMatrix + "\n";
for( int i=0; i<rowMatrix; i++)
for( int j=0; j<colMatrix; j++)
output += " " + getElement(i,j) + " ";
output += "\n";
return output;
Second file
public class Verify extends Object {
public static void main( String args[] )
int[][] dataA = {{1,1,1},{2,0,1},{1,2,0},{4,0,0}}; // data of A
int[][] dataB = {{1,2,2,0},{1,0,3,0},{1,0,3,4}}; // data of B
Matrix matrixA = new Matrix(dataA); // matrix A
System.out.println("Matrix A:"+matrixA);
Matrix matrixB = new Matrix(dataB); // matrix B
System.out.println("Matrix B:"+matrixB);
// Calculate the left-hand matrix
Matrix leftFormula = (matrixA.multipleMatrix(matrixB)).transposeMatrix();
System.out.println("Left Side:"+leftFormula);
// Calculate the right-hand matrix
Matrix rightFormula = (matrixB.transposeMatrix()).multipleMatrix(matrixA.transposeMatrix());
System.out.println("Right Side:"+rightFormula);
// Calculate the difference between left-hand matrix and right-hand matrix
// according to the formula in assignment description
double diff = leftFormula.diffMatrix(rightFormula);
if( diff < 1E-6 ) // 1E-6 is a threshold
System.out.println("Formula is TRUE");
else
System.out.println("Formula is FALSE");
}My basic aim is to verify the formula
(A . B)' =B' . A' or {(A*B)tranpose = Btranspose * A transpose}Now My problem is that I have to run the verify class file and verify class file will call the matrix class and its methods when to do certain calculations (for example to find left formula it calls tranposematrix() and multipleMatrix();)
How will I be able to get the matrix which is to be transposed in transposeMatrix method (in Matrix class)becoz in the method call there is no input for transposematrix() and only one input for multipleMatrix(matrix m).
please peeople help me put in this.
thanking in advancePlease don't crosspost.
http://forum.java.sun.com/thread.jspa?threadID=691969
The other one is the crosspost.Okay, whatever. I'm not really concerned with which one is the original. I just view the set of threads overall as being a crosspost, and arbitrarily pick one to point others toward.
But either way
knightofdurham... pick one thread and post only in
the one.Indeed. And indicate such in the other one. -
Need help in storing data from JList into a vector
need help in doing the following.-
alright i click a skill on industryskills Jlist and press the add button and it'll be added to the applicantskills Jlist. how do i further store this data that i added onto the applicantskills JList into a vector.
here are the codes:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import java.util.Vector;
import javax.swing.JScrollPane.*;
//import javax.swing.event.ListSelectionListener;
public class Employment extends JFrame
//declare class variables
private JPanel jpApplicant, jpEverything,jpWEST, jpCENTRE, jpEAST, jpAddEditDelete,
jpCentreTOP, jpCentreBOT, jpEastTOP, jpEastCENTRE, jpEastBOT,
jpBlank1, panel1, panel2, panel3, panel4,jpBottomArea,
jpEmptyPanelForDisplayPurposes;
private JLabel jlblApplicantForm, jlblAppList, jlblName, jlblPhone,
jlblCurrentSalary, jlblPassword, jlblDesiredSalary,
jlblNotes, jlblApplicantSkills, jlblIndustrySkills,
jlblBlank1, jlblBlank2, ApplicantListLabel,
NotesListLabel, ApplicantSkillsLabel,
IndustrySkillsLabel,jlblEmptyLabelForDisplayPurposes;
private JButton jbtnAdd1, jbtnEdit, jbtnDelete, jbtnSave, jbtnCancel,
jbtnAdd2, jbtnRemove;
private JTextField jtfName, jtfPhone, jtfCurrentSalary, jtfPassword,
jtfDesiredSalary;
private JTabbedPane tabbedPane;
private DefaultListModel /*listModel,*/listModel2;
String name,password,phone,currentsalary,desiredsalary,textareastuff,NotesText;
String selectedname;
final JTextArea Noteslist= new JTextArea();;
DefaultListModel listModel = new DefaultListModel();
JList ApplicantSkillsList = new JList(listModel);
private ListSelectionModel listSelectionModel;
JList ApplicantList, /*ApplicantSkillsList,*/ IndustrySkillsList;
//protected JTextArea NotesList;
//Vector details = new Vector();
Vector<StoringData> details = new Vector<StoringData>();
public static void main(String []args)
Employment f = new Employment();
f.setVisible(true);
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
f.setResizable(false);
}//end of main
public Employment()
setSize(800,470);
setTitle("E-commerce Placement Agency");
Font listfonts = new Font("TimesRoman", Font.BOLD, 12);
JPanel topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );
createPage1();
createPage2();
createPage3();
createPage4();
tabbedPane = new JTabbedPane();
tabbedPane.addTab( "Applicant", panel1 );
tabbedPane.addTab( "Job Order", panel2 );
tabbedPane.addTab( "Skill", panel3 );
tabbedPane.addTab( "Company", panel4 );
topPanel.add( tabbedPane, BorderLayout.CENTER );
public void createPage1()//PAGE 1
/*******************TOP PART********************/
panel1 = new JPanel();
panel1.setLayout( new BorderLayout());
jpBottomArea = new JPanel();
jpBottomArea.setLayout(new BorderLayout());
jpApplicant= new JPanel();
jpApplicant.setLayout(new BorderLayout());
Font bigFont = new Font("TimesRoman", Font.BOLD,24);
jpApplicant.setBackground(Color.lightGray);
jlblApplicantForm = new JLabel("\t\t\t\tAPPLICANT FORM ");
jlblApplicantForm.setFont(bigFont);
jpApplicant.add(jlblApplicantForm,BorderLayout.EAST);
panel1.add(jpApplicant,BorderLayout.NORTH);
panel1.add(jpBottomArea,BorderLayout.CENTER);
/********************************EMPTY PANEL FOR DISPLAY PURPOSES*************************/
jpEmptyPanelForDisplayPurposes = new JPanel();
jlblEmptyLabelForDisplayPurposes = new JLabel(" ");
jpEmptyPanelForDisplayPurposes.add(jlblEmptyLabelForDisplayPurposes);
jpBottomArea.add(jpEmptyPanelForDisplayPurposes,BorderLayout.NORTH);
/*****************************************WEST*********************************/
jpWEST = new JPanel();
jpWEST.setLayout( new BorderLayout());
//Applicant List
listModel2=new DefaultListModel();
ApplicantList = new JList(listModel2);
listSelectionModel = ApplicantList.getSelectionModel();
listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
JScrollPane scrollPane3 = new JScrollPane(ApplicantList);
ApplicantList.setPreferredSize(new Dimension(20,40));
scrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
ApplicantListLabel = new JLabel( "Applicant List:");
jpWEST.add(ApplicantListLabel,"North");
jpWEST.add(scrollPane3,"Center");
jpBottomArea.add(jpWEST,BorderLayout.WEST);
/*********CENTRE*********/
jpCENTRE = new JPanel();
jpCENTRE.setLayout(new GridLayout(2,1));
jpCentreTOP = new JPanel();
jpBottomArea.add(jpCENTRE,BorderLayout.CENTER);
jpCENTRE.add(jpCentreTOP);
jpCentreTOP.setLayout(new GridLayout(6,2));
//Creating labels and textfields
jlblName = new JLabel( "Name:");
jlblBlank1 = new JLabel ("");
jtfName = new JTextField(18);
jlblBlank2 = new JLabel("");
jlblPhone = new JLabel("Phone:");
jlblCurrentSalary = new JLabel("Current Salary:");
jtfPhone = new JTextField(13);
jtfCurrentSalary = new JTextField(7);
jlblPassword = new JLabel("Password:");
jlblDesiredSalary = new JLabel("Desired Salary:");
jtfPassword = new JTextField(13);
jtfDesiredSalary = new JTextField(6);
//Add labels and textfields to panel
jpCentreTOP.add(jlblName);
jpCentreTOP.add(jlblBlank1);
jpCentreTOP.add(jtfName);
jpCentreTOP.add(jlblBlank2);
jpCentreTOP.add(jlblPhone);
jpCentreTOP.add(jlblCurrentSalary);
jpCentreTOP.add(jtfPhone);
jpCentreTOP.add(jtfCurrentSalary);
jpCentreTOP.add(jlblPassword);
jpCentreTOP.add(jlblDesiredSalary);
jpCentreTOP.add(jtfPassword);
jpCentreTOP.add(jtfDesiredSalary);
//Noteslist
jpCentreBOT = new JPanel();
jpCentreBOT.setLayout( new BorderLayout());
jpCENTRE.add(jpCentreBOT);
jpBlank1 = new JPanel();
// Noteslist = new JTextArea(/*Document doc*/);
JScrollPane scroll3=new JScrollPane(Noteslist);
scroll3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
NotesListLabel = new JLabel( "Notes:");
jpCentreBOT.add(NotesListLabel,"North");
jpCentreBOT.add(scroll3,"Center");
jpCentreBOT.add(jpBlank1,"South");
jpBottomArea.add(jpCENTRE,BorderLayout.CENTER);
/**********EAST**********/
//Applicant Skills Panel
//EAST ==> TOP
jpEAST = new JPanel();
jpEAST.setLayout( new BorderLayout());
jpEastTOP = new JPanel();
jpEastTOP.setLayout( new BorderLayout());
ApplicantSkillsLabel = new JLabel( "Applicant Skills");
JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList);
scrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
ApplicantSkillsList.setVisibleRowCount(6);
jpEastTOP.add(ApplicantSkillsLabel,"North");
jpEastTOP.add(scrollPane1,"Center");
jpEAST.add(jpEastTOP,BorderLayout.NORTH);
jpBottomArea.add(jpEAST,BorderLayout.EAST);
//Add & Remove Buttons
//EAST ==> CENTRE
jpEastCENTRE = new JPanel();
jpEAST.add(jpEastCENTRE,BorderLayout.CENTER);
jbtnAdd2 = new JButton("Add");
jbtnRemove = new JButton("Remove");
//add buttons to panel
jpEastCENTRE.add(jbtnAdd2);
jpEastCENTRE.add(jbtnRemove);
//add listener to button
jbtnAdd2.addActionListener(new Add2Listener());
jbtnRemove.addActionListener(new RemoveListener());
//Industry Skills Panel
//EAST ==> BOTTOM
jpEastBOT = new JPanel();
jpEastBOT.setLayout( new BorderLayout());
String[] data = {"Access97", "Basic Programming",
"C++ Programming", "COBOL Programming",
"DB Design", "Fortran programming"};
IndustrySkillsList = new JList(data);
JScrollPane scrollPane = new JScrollPane(IndustrySkillsList);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
IndustrySkillsLabel = new JLabel( "Industry Skills:");
jpEastBOT.add(IndustrySkillsLabel,"North");
jpEastBOT.add(scrollPane,"Center");
jpEAST.add(jpEastBOT,BorderLayout.SOUTH);
//BOTTOM
jpAddEditDelete= new JPanel();
jbtnAdd1= new JButton("Add");
jbtnEdit= new JButton("Edit");
jbtnDelete= new JButton("Delete");
jbtnSave= new JButton("Save");
jbtnCancel= new JButton("Cancel");
jpAddEditDelete.add(jbtnAdd1);
jpAddEditDelete.add(jbtnEdit);
jpAddEditDelete.add(jbtnDelete);
jpAddEditDelete.add(jbtnSave);
jpAddEditDelete.add(jbtnCancel);
jbtnEdit.addActionListener(new EditListener());
jbtnDelete.addActionListener(new DeleteListener());
jbtnEdit.addActionListener(new EditListener());
jbtnAdd1.addActionListener(new Add1Listener());
jbtnCancel.addActionListener(new CancelListener());
jpBottomArea.add(jpAddEditDelete,BorderLayout.SOUTH);
public void createPage2()//PAGE 2
panel2 = new JPanel();
panel2.setLayout( new GridLayout(1,1) );
panel2.add( new JLabel( "Sorry,under construction" ) );
public void createPage3()//PAGE 3
panel3 = new JPanel();
panel3.setLayout( new GridLayout( 1, 1 ) );
panel3.add( new JLabel( "Sorry,under construction" ) );
public void createPage4()//PAGE 4
panel4 = new JPanel();
panel4.setLayout( new GridLayout( 1, 1 ) );
panel4.add( new JLabel( "Sorry,under construction" ) );
public class Add1Listener implements ActionListener
public void actionPerformed(ActionEvent e)
name = jtfName.getText();
password = jtfPassword.getText();
phone = jtfPhone.getText();
currentsalary = jtfCurrentSalary.getText();
int i= Integer.parseInt(currentsalary);
desiredsalary = jtfDesiredSalary.getText();
int j= Integer.parseInt(desiredsalary);
StoringData person = new StoringData(name,password,phone,i,j);
// StoringData AppSkillsList = new StoringData(listModel);
details.add(person);
// details.add(AppSkillsList);
listModel2.addElement(name);
jtfName.setText("");
jtfPassword.setText("");
jtfPhone.setText("");
jtfCurrentSalary.setText("");
jtfDesiredSalary.setText("");
// NotesList.setText("");
public class Add2Listener implements ActionListener
public void actionPerformed(ActionEvent e)
String temp1;
temp1 = (String)IndustrySkillsList.getSelectedValue();
listModel.addElement(temp1);
public class RemoveListener implements ActionListener
public void actionPerformed(ActionEvent e)
int index = ApplicantSkillsList.getSelectedIndex();
listModel.remove(index);
public class EditListener implements ActionListener
public void actionPerformed(ActionEvent e)
jtfName.setEditable(true);
jtfPassword.setEditable(true);
jtfPhone.setEditable(true);
jtfCurrentSalary.setEditable(true);
jtfDesiredSalary.setEditable(true);
Noteslist.setEditable(true);
jbtnAdd2.setEnabled(true);
jbtnRemove.setEnabled(true);
jbtnSave.setEnabled(true);
jbtnCancel.setEnabled(true);
public class DeleteListener implements ActionListener
public void actionPerformed(ActionEvent e)
int index1 = ApplicantList.getSelectedIndex();
listModel2.remove(index1);
public class SaveListener implements ActionListener
public void actionPerformed(ActionEvent e)
public class CancelListener implements ActionListener
public void actionPerformed(ActionEvent e)
jtfName.setText("");
jtfPassword.setText("");
jtfPhone.setText("");
jtfCurrentSalary.setText("");
jtfDesiredSalary.setText("");
public class SharedListSelectionHandler implements ListSelectionListener
public void valueChanged(ListSelectionEvent e)
selectedname =ApplicantList.getSelectedValue().toString();
StoringData selectedPerson = null;
jtfName.setEditable(false);
jtfPassword.setEditable(false);
jtfPhone.setEditable(false);
jtfCurrentSalary.setEditable(false);
jtfDesiredSalary.setEditable(false);
Noteslist.setEditable(false);
jbtnAdd2.setEnabled(false);
jbtnRemove.setEnabled(false);
jbtnSave.setEnabled(false);
jbtnCancel.setEnabled(false);
for (StoringData person : details)
if (person.getName1().equals(selectedname))
selectedPerson = person;
jtfName.setText(person.getName1());
jtfPassword.setText(person.getPassword1());
jtfPhone.setText(person.getPhone1());
//String sal1 = Integer.parseString(currentsalary);
// String sal2 = Integer.parseString(desiredsalary);
// jtfCurrentSalary.setText(sal1);
// jtfDesiredSalary.setText(sal2);
break;
// if (selectedPerson != null)
}Quit posting 300 line programs to ask a question. We don't care about your entire application. We only care about code that demonstrates your current problem. We don't want to read through 300 lines to try and find the line of code that is causing the problem.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.
Here is a simple SSCCE. Now make your changes and if you still have problems you have something simple to post. If it works then you add it to your real application.
Learn to simplify your problem by simplifying the code.
import java.awt.*;
import javax.swing.*;
public class ListTest2 extends JFrame
JList list;
public ListTest2()
String[] numbers = { "one", "two", "three", "four", "five", "six", "seven" };
list = new JList( numbers );
JScrollPane scrollPane = new JScrollPane( list );
getContentPane().add( scrollPane );
public static void main(String[] args)
ListTest2 frame = new ListTest2();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.setSize(200, 200);
frame.setLocationRelativeTo( null );
frame.setVisible( true );
}
Maybe you are looking for
-
To restrict appraisers for Business Event appraisal
Hi All, When i perform a Business Event appraisal, i need to restrict the appraisers to only those who have attended the training. i.e. Appraisee : Business Event Appraiser : Participants of the training. When i click on F4 for appraisers, i need to
-
"You are not connected to the internet" message
Until this morning, Safari worked pretty much ok. Now, when I launch it, I get the "you are not connected to the internet" page. Firefox and email work fine and network diagnostics verifies a proper connection. I can't even get to "software update."
-
PHP/Oracle/Apache on Windows mid tier
Hey, I am trying to set up PHP to connect to my oracle instance using apache. The PHP/Apache set up is on XP, which I also have a 9i client installed. I am trying to then connect to a database on a linux box. the 9i client works fine, SQL*Plus and ev
-
How to make iTunes support more than just one harddrive
The title of this topic says it all: How do I make iTunes support more than just one harddrive? I cannot afford to buy a really huge drive just because iTunes doesn't support more than one. There must be a way around this! Anyone?
-
Chnage background color of a region
Hi, How can we change or add a background color to a region in apex. thanks, tj