How to generate a variable-name from a string
I want to name some variables automaticly. The names are read from an ArrayList and converted to string.
I tried it this way, but I failed.
for(int m=0; m<tags.size(); m++){
System.out.println("javax.swing.JRadioButton "+tags.get(m).toString().toLowerCase()+"RadioButton;");
String temp = tags.get(m).toString().toLowerCase().concat("RadioButton");
javax.swing.JRadioButton temp.toString() = new JRadioButton();
buttonList.add(m, temp.toString());
Can anyone help me, please?!
Because of the Exception I printed the content of temp and of hsh.get(temp) and both are not null:
temp: authorRadioButton
hsh.get(temp)): javax.swing.JRadioButton[,0,0,0x0,invalid,layout=javax.swing.OverlayLayout,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@7dd60e50,flags=1184,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2],paintBorder=false,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=]
So I really don't know why this Exception occurs when trying to use the hsh.get(temp)-method.
Similar Messages
-
Generate variable name from a String
I've got a String "MyVariable" and I need to reference a static variable named MyStaticClass.MyVariable. How do you turn a String into a variable name?
You can't easily do it... you can using reflection:
MyStaticClass.class.getField().getXXX("MyVariable") //depending on what type the field is...But this seems like it may be a flawed design. Maybe you should try making a static HashMap in the class, use a Static init block and static get/set methods:
public class StaticClass
static Map properties;
static
properties = new HashMap();
properties.put("MyVariable", "Some Value");
properties.put("OtherVariable", new Integer(3));
public static Object get(String property)
return properties.get(property);
public static void set(String property, Object value)
//Maybe some code checking to make sure object is right type
//or don't use a set method at all to make the properties immutable
properties.put(property, value);
} -
Added dynamic text; How do I stop variable name from showing?
I am creating a simple game for kids. On the first page, I added an "input text" field for their first name. I called the variable firstname.
When they move to the next page, I used a "dyanamic text" field so I can call them by name on this page. It works. However, When I test the game, on the first page, where the firstname is input, it shows _level0.firstname instead of just a blank space for them to input their name.
I know I fixed this in the past and it was something simple, but I can't remember how to do it. I'd appreciate anyone's help!
Thanks.Beginning with Flash MX (version 6), you assign the text field an instance name using the Property inspector. Although you can use the variable name method with dynamic text fields for backwards compatibility to Flash 5 and earlier versions, Macromedia doesn't recommend this, because you can't control other text field properties, or apply style sheet settings
-
How to generate serialized variable name?
I want to dynamically generate a serial of varials, like var1, var2, var3... How can I do this?
Perhaps using arrays would suffice?
Example:
int[] int_array = new int[10];
Or if you want more flexibility, you can consider the container classes (such as Vector), which provide more flexibility for dynamically sized lists. -
How to retrieve the parameter names from a JSP page ? Urgent Please
Hello,
Can anybody tell me how to retrieve the parameter names from the JSP
page. (without using getParameterNames() method.)
The problem with the getParameterNames() method is I get the Jumbled output.
I need it very badly
With regards
Ananth R
email:[email protected]
[email protected]Dear duffymo,
My primary intention is to convert the JSP form information into a XML file.
If I do not get the Parameter names in the correct order how can I maintain
tag order in XML file.
For ex: (JSP PAGE VIEW)
Name--
FirstName
MiddleName
LastName
Address--
Street1
Street2
City
Country
&so on
(XML File to be generated)
<Name>
<FirstName>Value</FirstName>
</Name>
<Address>
<street1>value</street1>
</Address>
& so on
If I use getParameterNames() to get all the parameter names(Which form the tag names in the XML file ) the Enumeration object it returns will not be in the same order as the text fields in JSP.From this I can not construct a meaningful XML file.
order means: Order of entry on the page, from top to bottom
That's it
Waiting for your responses -
How to generate the BPEL interface from XSD?
I am new to the BPEL. How to generate the BPEL interface from XSD because I need the inputed payload to have a complex type instead the simple string?
Thank youI made the following change to the xsd file, however when the input type change to emailDataType, it is underline by red color. and the bpm process, activity guide, organization become the unknown project object.
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/SampleBPM/SampleEmailNotification/SendEmail"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="process">
<complexType>
<sequence>
<element name="input" type="emailDataType"/>
</sequence>
</complexType>
</element>
<element name="processResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
<complexType name="emailDataType" >
<sequence>
<element name="toEmailAddress" type="string" />
<element name="ccEmailAddress" type="string" />
<element name="emailSubject" type="string" />
<element name="emailContent" type="string" />
</sequence>
</complexType>
</schema>
The XSD file is viewed by the design mode is fine on JDeveloper. Please help! -
Discoverer Report: How to find Business Area name from Report Name.
Hi
I opened a report in Disco Desktop 4 -> Resonsibiolity --> Report Name.
So I know Report name but don’t know which Business Area it belongs to.
How to find Business Area Name from Report Name?
Cheers
VijayHi,
There is no relationship between reports and business areas. Each report can be built from many folders. Each folder can be in many business areas.
However you can try the following SQL which may give you the result you want for an v5 EUL. You will have to modify for Discoverer 4 EUL:
select distinct doc_name, obj.obj_name folder_name, bas.ba_name
from eul_us.eul5_documents doc
, eul_us.eul5_elem_xrefs xref
, eul_us.eul5_expressions exp
, eul_us.eul5_objs obj
, eul_us.eul5_ba_obj_links bol
, eul_us.eul5_bas bas
where xref.ex_from_id = doc.doc_id
and doc.doc_name = &your_report
and xref.ex_to_id = exp.exp_id
and obj.obj_id = exp.it_obj_id
and bol.bol_obj_id = obj.obj_id
and bas.ba_id = bol.bol_ba_id
Rod West -
How to pull only column names from a SELECT query without running it
How to pull only column names from a SELECT statement without executing it? It seems there is getMetaData() in Java to pull the column names while sql is being prepared and before it gets executed. I need to get the columns whether we run the sql or not.
Maybe something like this is what you are looking for or at least will give you some ideas.
public static DataSet MaterializeDataSet(string _connectionString, string _sqlSelect, bool _returnProviderSpecificTypes, bool _includeSchema, bool _fillTable)
DataSet ds = null;
using (OracleConnection _oraconn = new OracleConnection(_connectionString))
try
_oraconn.Open();
using (OracleCommand cmd = new OracleCommand(_sqlSelect, _oraconn))
cmd.CommandType = CommandType.Text;
using (OracleDataAdapter da = new OracleDataAdapter(cmd))
da.ReturnProviderSpecificTypes = _returnProviderSpecificTypes;
//da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
if (_includeSchema == true)
ds = new DataSet("SCHEMASUPPLIED");
da.FillSchema(ds, SchemaType.Source);
if (_fillTable == true)
da.Fill(ds.Tables[0]);
else
ds = new DataSet("SCHEMANOTSUPPLIED");
if (_fillTable == true)
da.Fill(ds);
ds.Tables[0].TableName = "Table";
}//using da
} //using cmd
catch (OracleException _oraEx)
throw (_oraEx); // Actually rethrow
catch (System.Exception _sysEx)
throw (_sysEx); // Actually rethrow
finally
if (_oraconn.State == ConnectionState.Broken || _oraconn.State == ConnectionState.Open)
_oraconn.Close();
}//using oraconn
if (ds != null)
if (ds.Tables != null && ds.Tables[0] != null)
return ds;
else
return null;
else
return null;
}r,
dennis -
How do I remove my name from an ipod prior to donating it to someone?
I would like to donate my ipod touch to someone as I just bought another one. How do I remove my name from the device prior to donating it? I was able to remove all of my apps, music and videos but not the name.
Go into your settings>general>reset, then select Erase All Content and Settings.
-
How to check my job name from the database...
I have written one job scheduler which is as follows :
SQL> ED
Wrote file afiedt.buf
1 DECLARE
2 X NUMBER;
3 JobNumber NUMBER;
4 BEGIN
5 SYS.DBMS_JOB.SUBMIT
6 (
7 job => X
8 ,what => 'scott.SPLITSMS;'
9 ,next_date => SYSDATE+1/1440
10 ,interval => 'SYSDATE+1/1440 '
11 ,no_parse => FALSE
12 );
13 JobNumber := to_char(X);
14* END;
15 /
PL/SQL procedure successfully completed.
Now I want to check whether the job has been really created or not?
so for that I have used the following command line:
SQL> SELECT JOB_NAME FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME = 'SCOTT.SPLITSMS';
SELECT JOB_NAME FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME = 'SCOTT.SPLITSMS'
ERROR at line 1:
ORA-00942: table or view does not exist
how to check my job name from the database...
what is the command used to check the job_name ????
and how can i ensure that my job scheduler is running properly...???
please help ........my dear friends.....!957029 wrote:
Now I want to check whether the job has been really created or not?
so for that I have used the following command line:
SQL> SELECT JOB_NAME FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME = 'SCOTT.SPLITSMS';
SELECT JOB_NAME FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME = 'SCOTT.SPLITSMS'
ERROR at line 1:
ORA-00942: table or view does not existYou can use DBA_* views only if the User has been Granted a DBA Privilege.
how to check my job name from the database...
what is the command used to check the job_name ????You can use USER_JOBS view to check. But, is it not that you have just created the Job, so you must be knowing it?
and how can i ensure that my job scheduler is running properly...???If USER_JOBS.FAILURES is Non Zero, that means the Job has encountered a problem that needs to be Investigated. Similarly, the LAST_DATE, LAST_SEC, NEXT_DAY, NEXT_SEC can be used to determine if the Job has been running successfully.
if you are on 11g, you should consider using DBMS_SCHEDULER. -
How to find the form name from VA02 T.code
how to find the form name from VA02 T.code
Hi Rajyam,
I guess you are looking out for the formname which prints sales related documents.
If this is what you want,then go to the T-code NACE and select the option K1Sales activities and click on the Output Types button on the top.The new window has all the types of Output types listed.Select the most appropriate and double click on the Processing routines button in the left side screen.
The new window lists the program names and the forms associated with that output type.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari. -
How to generate power point slides from web forms?
Hello,
Anybody know how to generate power point slides from the web forms. the data will in the database just like how we generate a report, just like that is there any way we can generate power point slides? if so could you please provide information please. Any examples are appreciated...
Thanks so much....Hi,
i have never tried it but in
this link you can see the it should be possible with the
powerpoint viewer.
Regards,
Markus -
How to find the dsn name from an *.rpd file provided?
How to find the dsn name from an *.rpd file provided? All the ODBC details which would require to run your dashboard.
Hi
DSN name is not a part of .rpd file. So There is no information about DSN name in .rpd file.
Thanks
Siddhartha P -
Nokia 6300: How do I remove a name from a dictiona...
Hi
I was hoping someone knows how to remove a word/name from the word prompter on my phone. That is when I type the keys on word prompt how do I remove a name I do not want to come up
Thanks
LeeHi,
Try this. Messaging> Message> Options> Prediction Off. -
How to find a metachain name from local process chain id or name
how to find a metachain name from local process chain id or name
Hi Dwarakanath,
Please post your query in the correct topic space in SCN. For help, see this document:
Find Topic Spaces on SCN (Forums)
Thanks,
Kristen
Maybe you are looking for
-
[Success] Dual Booting Arch and Windows 7 [Advice / Confirmation]
So I have been trying to get Starcraft II to work with wine and no luck. I have decided to install windows back on my computer, besides it might come in handy since I'm heading back to school soon. Anyways I have tried dual booting arch and windows i
-
What is RECALL functionality in SRM 7.0 ?
Hello Forum, What is the meaning of RECALLING a ordered shopping cart in SRM 7.0. How to do this? The issue we are facing is exactly same as mentioned in the below thread [Delete Button is disabled in Check status |Re: Delete Button is disabled in Ch
-
We just bought this TV last week and it has that "flashlight effect" in the upper left hand corner and I was told it will go away in a couple weeks? Does it really go away or do I need to get a new TV?
-
JNI - Passing an object containing an array field
I need to pass an object to a native method. The object contains several int fields and a field that is an int array (contains 32 int). I have no problem with the int fields, but do not know how to access the int array field in the C code. What appro
-
How can I control Updates? (i.e Display Name, First Name, etc)
Hello, I've noticed that if a user is revoked in resource object A, when one of his properties changes (i.e Display Name), the form of that application isn't updated. However, if he is in "Provisioned", "Manually cancelled",... then the form gets upd