How to create an instance of myClass with a name that is in a variable?
Hey Guys,
How can I create an instance of myClass with a name that is in a variable?
Normally a new instance is defined something like:
myClass myName = new myClass ();
I want to make a method which creates instances of a certain class (ie myClass) with names that are given to the method within its arguments.
So something like:
public void myMethod(String className) {
myClass value of className = new myClass();
So if className = "FirstName" then an instance of myClass should be created with the name "Firstname", like:
myClass Firstname = new Firstname;
Thanks.
Jasper
Thanx for your reply's
If I understand the tutorial correctly I should do
something like this to start the map:
Map<String, myClass> myMAP = new HashMap<String,
MyClass>();
and something like this to add a new instance of the
class every time:
myMAP.put(myString, new myClass());
So this would result a link between the Strings and
the instance of the Class?
Thanks
Message was edited by:
JasperLevinkyep. the String is the key, and the MyClass instance is the value. to get the value out of the map, use map.get(key)
Similar Messages
-
How to create multiple instance of Jboss with different port number
Hi all
Please tell me steps to create multiple instance of Jboss with diffrent port number.
I tried with this steps, but it does not work for me.
In conf/jboss-service you will find the binding manager.
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">../docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>Please help me on this.
Thanks in advanceIt is the name of the website for JBoss. That seems rather obvious to me, and you would have found out for yourself if you had tried it.
Your question is not a Java question and doesn't belong in these forums. It is a JBoss question and you should ask there, or more probably have a look at the JBoss documentation first. -
How to create an instance of midlet with in a midlet
Hi all,
I have 5 midlets in the same project (midlet suite). I need one of the midlets (login midlet) to start and when login is verified i want to display list of the remaining midlets which can be launched as per user's chioce.
My query is, how can i create an instance of the other midlet within the login midlet after login is verified.
Any response is highly appreciated.
BirhanuYou can't do that! You don;t need all those midlets anyway if you only have one application. You'll just have to put the needed code in a non Midlet class.
-
How to create multiple instance on same database
Hi ,
I would like to know how to create multiple instance on same database . I know that some people use database configuration assistant to do this but i could not figure out how they did it.
Any how if some one can help me with this and can give me links of this it would be great help for me.
Thank you for reading my problem and helping me !
Amil
please if possible mail me on [email protected]How to create multiple instance?????Do you mean multiple instances on the same database, or multiple databases on the same machine ?
I m new to this field....
Willin to learn a lot about oracle....Then it wouldn't be bad reading a bit of Database Concepts -
How to create an instance for RemoteSession without using create() method
How to create an instance for RemoteSession without using create() method?
What's RemoteSession? Not in the JDK. And does the question have anything to do with concurrency?
-
How to create an instance of the database
No that won't work. I have to set it up independant from each other because I can't get to Uni until Monday and I want to have this done over the weekend really.
The main issue seems to be now how to create an instance of the databaseTo create a database:
you first connect as internal (user) with the passeword 'oracle'
the syntax is: connect internal/oracle
You type in this script:
STARTUP NOMOUNT PFILE=$PFILE
CREATE DATABASE db01
LOGFILE
GROUP 1 ('c/oracle/oradata/db01/redo_01a.log',
'c/oracle/oradata/db01/redo_01b.log'
) size 100k,
GROUP 2 ('c/oracle/oradata/db01/redo_02a.log',
'c/oracle/oradata/db01/redo_02b.log'
) size 100k
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXLOGHISTORY 1
DATAFILE 'c/oracle/oradata/db01/system01.dbf'
size 7M
MAXDATAFILES 254
MAXINSTANCES 1;
This script could be modified to reflect the features you want for your database.
db01 = the name you can give to your database
Good luck,
Henri -
How to create a custom function module with the records in SAP R/3?
Hi All,
How to create a custom function module with the records in SAP R/3? Using RFC Adapter I have to fetch the custom function module records.
Regards
SaraHi
goto se37...here u need to create a function group... then u need to create a function module. inside assign import/export parameters. assign tables/exceptions. activate the same. now write ur code within the function module
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
Look at the below SAP HELP links, These links will show you the way to create a Function Module
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm -
How to create dom treeof html page with java
hi, all
i met with a problem how to create dom tree of html page wih jave, that is, given a html page, how to create a dom tree of this page with java?
thanks in advance.
regards
richardbut i m using this code to create node in html file
HTMLLIElement li = (HTMLLIElement)appHTML.createElement("LI");
Text txt = appHTML.createTextNode(name);
li.appendChild(txt);
appHTML.getElementById("name").appendChild(li);
this will display all name value which is coming from database,
and i want to assign a hyperlink to it,
I have id with name also so I thought that using id i will
create javascript like
function popup(id)
if(id==1)
var n1 = window.open("../list/name1.html");
if(id==2)
var n1 = window.open("../list/name2.html");
this way i want to popup particular file if i can pass id value in this function
so want hyperlink like
name -
How to create Using Formatted Text Field with multiple Sliders?
Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
// constructor
label1 = new JLabel( "Individuals" );
scroller1 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 10 );
scroller1.setMajorTickSpacing( 10 );
scroller1.setMinorTickSpacing( 1 );
scroller1.setPaintTicks( true );
scroller1.setPaintLabels( true );
scroller1.addChangeListener(this);
java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
NumberFormatter formatter = new NumberFormatter(numberFormat);
formatter.setMinimum(new Integer(0));
formatter.setMaximum(new Integer(100));
textField1 = new JFormattedTextField(formatter);
textField1.setValue(new Integer(10)); //FPS_INIT
textField1.setColumns(1); //get some space
textField1.addPropertyChangeListener(this);
//React when the user presses Enter.
textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
textField1.getActionMap().put("check", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (!textField1.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField1.selectAll();
} else try { //The text is valid,
textField1.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
label2 = new JLabel( "Precision" );
scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
scroller2.setMajorTickSpacing( 10 );
scroller2.setMinorTickSpacing( 1 );
scroller2.setPaintTicks( true );
scroller2.setPaintLabels( true );
scroller2.addChangeListener(this);
textField2 = new JFormattedTextField(formatter);
textField2.setValue(new Integer(10)); //FPS_INIT
textField2.setColumns(1); //get some space
textField2.addPropertyChangeListener(this);
//React when the user presses Enter.
textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
textField2.getActionMap().put("check", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (!textField2.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField2.selectAll();
} else try { //The text is valid,
textField2.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
// State Changed
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
int fps = (int)source.getValue();
if (!source.getValueIsAdjusting()) { //done adjusting
if(source==scroller1) {
System.out.println("source ==scoller1\n");
textField1.setValue(new Integer(fps)); //update ftf value
else if(source==scroller2) {
System.out.println("source ==scoller2\n");
textField2.setValue(new Integer(fps)); //update ftf value
} else { //value is adjusting; just set the text
if(source==scroller1) textField1.setText(String.valueOf(fps));
else if(source==scroller2) textField2.setText(String.valueOf(fps));
// Property Change
public void propertyChange(PropertyChangeEvent e) {
if ("value".equals(e.getPropertyName())) {
Number value = (Number)e.getNewValue();
if (scroller1 != null && value != null) {
scroller1.setValue(value.intValue());
else if (scroller2 != null && value != null) {
scroller2.setValue(value.intValue());
// ACTION PERFORMED
public void actionPerformed(ActionEvent event) {
if (!textField1.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField1.selectAll();
} else try { //The text is valid,
textField1.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
if (!textField2.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField2.selectAll();
} else try { //The text is valid,
textField2.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
...if :p3_note_id is null
then
insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
Another option is that you have a trigger on table NOTES that generates a new note_id even for an update. -
How to create an instance of a protected class outside the enclosing packag
Hi all,
I have a piece of code like this:
package test;
public class A {
protected class B { }
How to create an instance of B outside the package test ? Could you please give me an example ?
Thanks
Ha ChauThank WirajR for your reply, but in your solution,
you have to create an instance of B inside class A
and pass it outside. I would like to know whetherwe
can create an instance of class B outside thepackage
test. That means I want the instance creation
expression of B appears outside the package test.Can
we do that?
If you want to use a class this way then it shouldn't
be marked protected. I can't see why you don't
just declare it public if that's what it is.
Wouldn't be much point to haveing a protected
modifier if it had no effect, would there?I think there is use for it if you use an interface to filter out the parts you want to give public access to, and keep the part you want to keep protected, protected -
How to Create an Input Schedule Comparison with Data Using EVDRE
Hello,
I try implement the scenario described in "How to Create an Input Schedule Comparison with Data Using EVDRE".
Once I am using the "Insert Function" from the panel and selecting the EVTIM function Excel crashes (see page 8 How to paper).
Systems:
BPC 7.0 NW SP02
Office 2007
BPCADminClient and BPCOfficeClient up to date
Have anyone a solution?
Thanks
OktayHi Oktay -
This function works in my BPC70NW SP02 system. Your issue might be that you are trying to access a TIME member that does not exist. Please make sure the offset value is a valid dimension member.
I can confirm that EVTIM does allow the offset for base members (such as 2009.MAY) as well as parent nodes (such as 2009.Q1 or 2008.TOTAL)... BUT...the offset result of the EVTIM function needs to be a valid dimension member!
Regards,
Sheldon -
How to create user editable Crystal Report with dynamic dataset
What I would like to achieve:
A program loads a report in runtime updates list of database fields (possibly includes sample data), open report in "Crystal Reports 2011" (or 2008) where user customizes report and saves it. Later on the program loads the report, fills actualized data and displays it in .net report viewer.
What I do:
CrReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
CrReport.Load(TemplateFilename)
Dim Results As DataTable
DataTable is filled from a database
CrReport.SetDataSource(mResults)
CrReport.SaveAs(NewReportPath, True)
The NewReportPath is opened in the default program.
What are the problems
The report is open in preview mode (not in design).
When the field is added to the report the designer asks for XML datasource on preview.The short answer is that it is not possible. I broke the question to other two: How to save a report that it opens without preview? and How to create user editable Crystal Report with dynamic dataset, where it is possible to find details. Key answer is Re: How to create an editable previewable report?
-
How to creat the Varient for 1099MISC With Holding Tax
How to create the Variant for 1099MISC With Holding Tax ?
HI,
please follow the below steps to create variant at report.
tcode se38
report RFIDYYWT
pass all the parameters
press save icon
give variant name
retrive the variant in report
tcode se38
report name RFIDYYWT
press : shift + F5
or get varinat icon.
I hope above will resolve your issue.
Regards
Madhu M -
How to create new view without interlinking with gantt chart or resource views
ok clear
one another question
In msp how to create new view without interlinking with gantt chart or resource viewsHi Shiv PMC--
I splitted your question above in another thread in order not to have a huge thread with many topics in it.
That being said, I'm not sure to understand. A view is just a manner to display MS Project data with columns. A view can have a table with column (left part) associated with a Gantt chart. It can also just contain a table with no Gantt chart (like the task
table) or a table with a timephased grid (resource and task usage).
Please give us more information, maybe with a concrete example so we can help you.
Hope this helps,
Guillaume Rouyre, MBA, MVP, P-Seller | -
Create POJO instance in fxml with no default constructor
My question is that how to create POJO instance in fxml that has no default constructor. I am creating pie chart data object in fxml like this
*<fx:define>*
*<PieChart.Data fx:id="data" >*
*<name>java</name>*
*<pieValue>20.2</pieValue>*
*</PieChart.Data>*
*</fx:define>*
since there is no default constructor how to create this object fxml?
Edited by: 988476 on Feb 16, 2013 6:21 AMThere must be a "hidden" method
somewhere that allows the Java serialization to create
an object without calling a constructor - where is
it?You are correct, the way in which the Serialization creates Objects is "hidden" deep within the runtime.
If it were not hidden, you would be able to find it, and use it to violate the integrity of the VM.
Maybe you are looking for
-
How to change the Group Sort Order
I'm using Crystal XI version to create a report that has two "Group By" fields. I understand the sequence (Group 1, Group 2) in which the fields are sorted, however I was wondering whether there is a way to sort by ONLY the Group 2 field. If this is
-
Final Cut Pro X problems with effects and grading
I have just finishied cutting my first project in FCPX and I must say I'm amazed over how fun it is to work with it. However, I have some problems that I think is a bug or something related to my hardware, would like some input on this. My machine is
-
when trying to purchase music from the itunes store.. a notice comes up saying "could not purchase. an unknown error occurred (11111)." this has been happening for days and even after i updated my itunes.. please help!
-
I just updated my computer and need to transfer my photoshop cs2. Where can I get the download.
-
What if this happens.....
what if i get a new computer? Is there a way I could get all my videos and music back? And another question...2 ipods one computer, can I do this?