Adding user-created objects to an Array
I would be grateful if anyone can help me. I have created the following class:
import java.util.*;
* Created on 08-Dec-2005
* @author Hussein Patwa
public class room {
public String roomName;
// String to hold the room name
public static void main(String[] args) {
String roomName;
// Temp string to hold room name
LinkedList objectqueue = new LinkedList();
// Queue implementation to hold list of objects in room
LinkedList stack = new LinkedList();
// Stack implementation to hold objects held by user
public void enterRoomName(String roomName) {
// Method to allow entering of the room name
this.roomName = roomName;
// Assignment the room name to the roomName field
public void viewRoomName() {
// Method to allow the viewing of the room name
System.out.println("This is the " + roomName + " ");
// Print the room name
}I also have a main class:
import java.util.*;
* Created on 08-Dec-2005
* @author Hussein Patwa
public class start extends room {
public static void main(String[] args) {
String gameName = "PatwaMaze";
// Field to hold the game name
room[] roomList = new room[6];
// Create a new array to hold the rooms
public void startGame() {
roomList.add["Kitchen"];
roomList.add["Parlour"]
roomList.add["Lounge"]
roomList.add["Stairs"]
roomList.add["Chamber"]
roomList.add["Study"]
}I want to create an array of room objects, or would it be more correct to say object references, and then have their labels as the room name, which would be stored in that room's roonName field. So then I can iterate through the list, and print out each room's roomName field thus giving a list of the rooms. So (and I hope this is making sense), I need to add the rooms to the array, set each room's rromName field and then iterate through it. But I'm not sure of the syntax to add the room's name and the array index.
BTW, I have done quite a bit of searching for this, as well as looked through several texts, so I am posting here because i'm not sure where to go next.
Thanks.
Hussein.
Short answer: There's no add method. That woul be in a Collection.
http://java.sun.com/docs/books/tutorial/collections/
For an array, it's arr[0] = something;
arr[1] = somethingElse;
/ / etc.
Similar Messages
-
Is it possible to serialize a user created object with an oracle.sql.BLOB?
Is this possible? Cause I'm getting a WSDL Exception that the oracle.sql.BLOB is not a java bean. So how do I make it a java bean? What data type should I use?
here is the object that was created.
import java.io.Serializable;
public class DiagramsObj implements Serializable {
private int galleyDiagramId = -1;
oracle.sql.BLOB galleyDiagramBlob = null;
private String galleyName = null;
/** SET THE VALUES TO THE OBJECT */
public void setGalleyDiagramId(int newGalleyDiagramId) {
galleyDiagramId = newGalleyDiagramId;
public int getGalleyDiagramId() {
return galleyDiagramId;
public void setGalleyDiagramBlob(oracle.sql.BLOB newGalleyDiagramBlob) {
galleyDiagramBlob = newGalleyDiagramBlob;
public oracle.sql.BLOB getGalleyDiagramBlob() {
return galleyDiagramBlob;
public void setGalleyName(String newGalleyName) {
galleyName = newGalleyName;
public String getGalleyName() {
return galleyName;
} -
Adding user created templates into Office 2007/2010 using Group Policy
I am trying to show some of our templates that we have created for work within Microsoft Office (work and excel) but I want them to show for everyone and not just 1 or 2 people. Being in a company that employ's 200+ people in multiple locations, the
task to manually go around to each and every machine to point to a different set of templates seems very time consuming. I am wondering if there is a gpo and/or registry edit that can be used. Anybody's assistance is greatly appreciated!
We have a mixture of Office 2007/2010. Server is a Win 2008 r2 standard.Hi,
You can create and deploy custom templates using the steps below:
1. Create your templates.
2. Create thumbnail and preview files.
3. Create an XML configuration file that describes the custom template, thumbnail, and preview files.
4. Deploy a registry key that enables Office to read the XML configuration file.
For more information, please refer to the following article:
http://technet.microsoft.com/en-us/library/cc178976(v=office.14).aspx
In addition, a simple way to achieve the goal is setting the file location for "Workgroup templates" and save the custom templates to the shared location,
then users can select the templates via File > New > My Templates. To change the location, you can modify the
SharedTemplates key under [HKEY_CURRENT_USER\Software\Microsoft\Office\xx.0\Common\General].
Hope this helps.
Regards,
Steve Fan
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
when a person tries to create a new planning area using Transaction BPS0
it is asking for a Object key for a object called
r3tr CLAS /1SEM/CL_FACTORY_100ZPAPK
Is this a SAP Object or a user created object.
Shall i go ahead and create a object key if it is a SAP ObjectHello Balaji,
This is standard SAP object that is the reason why object key is being asked. You can create it in the SAP marketplace using OSS id pertaining to your installation.
Please award points for useful info.
Regards.
Ruchit. -
Creating user's objective through API ot working
I am making use of the HR_OBJECTIVES_API API to create objective for users. to test the API, I run the small script below. It create a new row in the per_objective table but the HRMS interface fail to recognize it. It does not appear in the scorecard of the user. What am I missing?
/* Auto Generation of Script Start */
DECLARE
-- Start of Variable declarations, Initialize Variables with appropriate values to test the script
-- VARCHAR2 size is set to 2000 by default, please enter target table name to retrieve the exact limit
-- Input Variables
V_VALIDATE BOOLEAN:=false;
V_EFFECTIVE_DATE DATE := trunc(sysdate);
V_BUSINESS_GROUP_ID NUMBER:=81;
V_NAME VARCHAR2(2000):='Just a Second test from TOAD';
V_START_DATE DATE:=trunc(sysdate);
V_OWNING_PERSON_ID NUMBER:=264;
V_TARGET_DATE DATE;
V_ACHIEVEMENT_DATE DATE;
V_DETAIL VARCHAR2(2000);
V_COMMENTS VARCHAR2(2000);
V_SUCCESS_CRITERIA VARCHAR2(2000);
V_APPRAISAL_ID NUMBER;
V_ATTRIBUTE_CATEGORY VARCHAR2(2000);
V_ATTRIBUTE1 VARCHAR2(2000);
V_ATTRIBUTE2 VARCHAR2(2000);
V_ATTRIBUTE3 VARCHAR2(2000);
V_ATTRIBUTE4 VARCHAR2(2000);
V_ATTRIBUTE5 VARCHAR2(2000);
V_ATTRIBUTE6 VARCHAR2(2000);
V_ATTRIBUTE7 VARCHAR2(2000);
V_ATTRIBUTE8 VARCHAR2(2000);
V_ATTRIBUTE9 VARCHAR2(2000);
V_ATTRIBUTE10 VARCHAR2(2000);
V_ATTRIBUTE11 VARCHAR2(2000);
V_ATTRIBUTE12 VARCHAR2(2000);
V_ATTRIBUTE13 VARCHAR2(2000);
V_ATTRIBUTE14 VARCHAR2(2000);
V_ATTRIBUTE15 VARCHAR2(2000);
V_ATTRIBUTE16 VARCHAR2(2000);
V_ATTRIBUTE17 VARCHAR2(2000);
V_ATTRIBUTE18 VARCHAR2(2000);
V_ATTRIBUTE19 VARCHAR2(2000);
V_ATTRIBUTE20 VARCHAR2(2000);
V_ATTRIBUTE21 VARCHAR2(2000);
V_ATTRIBUTE22 VARCHAR2(2000);
V_ATTRIBUTE23 VARCHAR2(2000);
V_ATTRIBUTE24 VARCHAR2(2000);
V_ATTRIBUTE25 VARCHAR2(2000);
V_ATTRIBUTE26 VARCHAR2(2000);
V_ATTRIBUTE27 VARCHAR2(2000);
V_ATTRIBUTE28 VARCHAR2(2000);
V_ATTRIBUTE29 VARCHAR2(2000);
V_ATTRIBUTE30 VARCHAR2(2000);
V_SCORECARD_ID NUMBER:=9193;
V_COPIED_FROM_LIBRARY_ID NUMBER;
V_COPIED_FROM_OBJECTIVE_ID NUMBER;
V_ALIGNED_WITH_OBJECTIVE_ID NUMBER;
V_NEXT_REVIEW_DATE DATE;
V_GROUP_CODE VARCHAR2(2000);
V_PRIORITY_CODE VARCHAR2(2000);
V_APPRAISE_FLAG VARCHAR2(2000):='Y';
V_VERIFIED_FLAG VARCHAR2(2000);
V_TARGET_VALUE NUMBER;
V_ACTUAL_VALUE NUMBER;
V_WEIGHTING_PERCENT NUMBER;
V_COMPLETE_PERCENT NUMBER;
V_UOM_CODE VARCHAR2(2000);
V_MEASUREMENT_STYLE_CODE VARCHAR2(2000):='N_M';
V_MEASURE_NAME VARCHAR2(2000);
V_MEASURE_TYPE_CODE VARCHAR2(2000);
V_MEASURE_COMMENTS VARCHAR2(2000);
V_SHARING_ACCESS_CODE VARCHAR2(2000);
-- Output Variables
V_WEIGHTING_OVER_100_WARNING BOOLEAN;
V_WEIGHTING_APPRAISAL_WARNING BOOLEAN;
V_OBJECTIVE_ID NUMBER;
V_OBJECT_VERSION_NUMBER NUMBER;
BEGIN
DBMS_output.enable(800000);
-- Calling API HR_OBJECTIVES_API.CREATE_OBJECTIVE
HR_OBJECTIVES_API.CREATE_OBJECTIVE(P_VALIDATE => V_VALIDATE
,P_EFFECTIVE_DATE => V_EFFECTIVE_DATE
,P_BUSINESS_GROUP_ID => V_BUSINESS_GROUP_ID
,P_NAME => V_NAME
,P_START_DATE => V_START_DATE
,P_OWNING_PERSON_ID => V_OWNING_PERSON_ID
,P_TARGET_DATE => V_TARGET_DATE
,P_ACHIEVEMENT_DATE => V_ACHIEVEMENT_DATE
,P_DETAIL => V_DETAIL
,P_COMMENTS => V_COMMENTS
,P_SUCCESS_CRITERIA => V_SUCCESS_CRITERIA
,P_APPRAISAL_ID => V_APPRAISAL_ID
,P_ATTRIBUTE_CATEGORY => V_ATTRIBUTE_CATEGORY
,P_ATTRIBUTE1 => V_ATTRIBUTE1
,P_ATTRIBUTE2 => V_ATTRIBUTE2
,P_ATTRIBUTE3 => V_ATTRIBUTE3
,P_ATTRIBUTE4 => V_ATTRIBUTE4
,P_ATTRIBUTE5 => V_ATTRIBUTE5
,P_ATTRIBUTE6 => V_ATTRIBUTE6
,P_ATTRIBUTE7 => V_ATTRIBUTE7
,P_ATTRIBUTE8 => V_ATTRIBUTE8
,P_ATTRIBUTE9 => V_ATTRIBUTE9
,P_ATTRIBUTE10 => V_ATTRIBUTE10
,P_ATTRIBUTE11 => V_ATTRIBUTE11
,P_ATTRIBUTE12 => V_ATTRIBUTE12
,P_ATTRIBUTE13 => V_ATTRIBUTE13
,P_ATTRIBUTE14 => V_ATTRIBUTE14
,P_ATTRIBUTE15 => V_ATTRIBUTE15
,P_ATTRIBUTE16 => V_ATTRIBUTE16
,P_ATTRIBUTE17 => V_ATTRIBUTE17
,P_ATTRIBUTE18 => V_ATTRIBUTE18
,P_ATTRIBUTE19 => V_ATTRIBUTE19
,P_ATTRIBUTE20 => V_ATTRIBUTE20
,P_ATTRIBUTE21 => V_ATTRIBUTE21
,P_ATTRIBUTE22 => V_ATTRIBUTE22
,P_ATTRIBUTE23 => V_ATTRIBUTE23
,P_ATTRIBUTE24 => V_ATTRIBUTE24
,P_ATTRIBUTE25 => V_ATTRIBUTE25
,P_ATTRIBUTE26 => V_ATTRIBUTE26
,P_ATTRIBUTE27 => V_ATTRIBUTE27
,P_ATTRIBUTE28 => V_ATTRIBUTE28
,P_ATTRIBUTE29 => V_ATTRIBUTE29
,P_ATTRIBUTE30 => V_ATTRIBUTE30
,P_SCORECARD_ID => V_SCORECARD_ID
,P_COPIED_FROM_LIBRARY_ID => V_COPIED_FROM_LIBRARY_ID
,P_COPIED_FROM_OBJECTIVE_ID => V_COPIED_FROM_OBJECTIVE_ID
,P_ALIGNED_WITH_OBJECTIVE_ID => V_ALIGNED_WITH_OBJECTIVE_ID
,P_NEXT_REVIEW_DATE => V_NEXT_REVIEW_DATE
,P_GROUP_CODE => V_GROUP_CODE
,P_PRIORITY_CODE => V_PRIORITY_CODE
,P_APPRAISE_FLAG => V_APPRAISE_FLAG
,P_VERIFIED_FLAG => V_VERIFIED_FLAG
,P_TARGET_VALUE => V_TARGET_VALUE
,P_ACTUAL_VALUE => V_ACTUAL_VALUE
,P_WEIGHTING_PERCENT => V_WEIGHTING_PERCENT
,P_COMPLETE_PERCENT => V_COMPLETE_PERCENT
,P_UOM_CODE => V_UOM_CODE
,P_MEASUREMENT_STYLE_CODE => V_MEASUREMENT_STYLE_CODE
,P_MEASURE_NAME => V_MEASURE_NAME
,P_MEASURE_TYPE_CODE => V_MEASURE_TYPE_CODE
,P_MEASURE_COMMENTS => V_MEASURE_COMMENTS
,P_SHARING_ACCESS_CODE => V_SHARING_ACCESS_CODE
,P_WEIGHTING_OVER_100_WARNING => V_WEIGHTING_OVER_100_WARNING
,P_WEIGHTING_APPRAISAL_WARNING => V_WEIGHTING_APPRAISAL_WARNING
,P_OBJECTIVE_ID => V_OBJECTIVE_ID
,P_OBJECT_VERSION_NUMBER => V_OBJECT_VERSION_NUMBER
dbms_output.put_line('Successfully created objective: ' || v_objective_id ||
' for TARGET PERSON_ID: ' || v_owning_person_id );
exception when others then
dbms_output.put_line('error : ' || sqlerrm);
END;Hi,
Can you just try by giving effective date and start date as some previous date rather than sysdate?
Regards,
Vinod -
Permission to create objects under different USER
Hi there,
I´d like to know what privileges are used to allow a user to create objects (tables, indexes, triggers, procedures) under another user.
Example: I´m logged with user TOM and want to be able to run the following DDL:
CREATE TABLE MAT.TEST_TABLE (
FIELD1 NUMBER,
FIELD2 VARCHAR2(50)
Thanks a lot,
BrunoWith user SYS
Grant connect,resource to tom;With user TOM
CREATE tom.TEST_TABLE (
FIELD1 NUMBER,
FIELD2 VARCHAR2(50)
);Edited by: Salim Chelabi on 2009-01-15 10:31 -
Create object on user's default tablespace only
Hi all,
Is there anyway I can limit a user to create tables NOT on system tablespace , besides alter user quota 0M on system ?
Can I limit a user to create objects only on his own default tablespace ?
alter user quota 0M on < all other tablespaces except user's default> ?
Thanks.Hi,
I have really no idea why oracle is behaving like this. How can you create a table without a quota.
1) Write here the oracle version for your database software
2) Can you try connecting to the database with same user id but from a remote client using TNS method instead of logging in locally, and they try creating the table.
3) Can you give only CREATE SESSION privilege (not create table) and then perform the same task again.
PS: Please paster your code/output enclosed withing code tag. Write **, then your code/output and then again *{code*
Salmam -
I am mac user and want to create Object in VBA macro. when i write "set objwrd=createObject("Word.Application")"… it returns "runtime error "492" can't create object". now what it alternative to create object for word in excel macro???
Any help here...
http://support.microsoft.com/kb/288117
http://www.macworld.com/article/1154785/welcomebackvisualbasic.html -
I developed our own Authentication, Identity Assertion & Authorization providers
for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
user defined object as a argument and returns a user defined object. i am able
to call all the methods which takes java objects(for example: String, int, ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when i user
any user defined object then it gives exception. if in the argument i used user
defined object then it is not able to call that method telling NoSuchMethodException.
Is there any way to use user defined object as an argument to MBean method?
can anyone please help us as we r in the final stage of the project?
Thanks
Lakshmi"Lakshmi Padhy" <[email protected]> wrote in message
news:3fc2f50c$[email protected]..
>
I developed our own Authentication, Identity Assertion & Authorizationproviders
for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
user defined object as a argument and returns a user defined object. i amable
to call all the methods which takes java objects(for example: String, int,ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when iuser
any user defined object then it gives exception. if in the argument i useduser
defined object then it is not able to call that method tellingNoSuchMethodException.
>
Is there any way to use user defined object as an argument to MBeanmethod?
>
I seem to remember that jmx only supports scalar datatypes. Ask in the
weblogic.developer.interest.management newsgroup. -
Adding user-defined number of text fields.
Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
Feel free to run the program, the problem lies in the method setTextFields(). Help please!
import javax.swing.*; //FOR SWING COMPONENT CLASSES
import java.awt.*; //FOR CONTAINER CLASS
import java.awt.event.*; //FOR EVENT HANDLING
public class RegressInput extends JFrame
private JComboBox listJComboBox; //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
private JButton answerButton; //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
private JPanel textFieldTopPanel; //TEXT FIELD TOP PANEL
private JPanel textFieldBottomPanel; //TEXT FIELD BOTTOM PANEL
private JPanel textFieldPanel; //TEXT FIELD PANEL
private CardLayout cardSelector; //DECLARE CARD LAYOUT OBJECT
private JPanel cardDeck; //DECLARE CARD PANEL OBJECT
public RegressInput(String title)
super(title); //CALL SUPERCLASS CONSTRUCTOR
//CREATE A CONTAINER
Container container = getContentPane();
//INSTANTIATE CARD LAYOUT OBJECT
cardSelector = new CardLayout();
//INSTANTIATE PANEL OBJECT
cardDeck = new JPanel();
//SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
cardDeck.setLayout(cardSelector);
//DEFINE LABEL FOR FIRST CARD
Label question = new Label("How many PAIRS of data would you like to enter?");
//BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
answerButton = new JButton("OK");
listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
listJComboBox.setMaximumRowCount(10); //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
Label xValues = new Label("X Values"); //LABEL FOR X values
Label yValues = new Label("Y Values"); //LABEL FOR Y values
//BUILD CARD DECK
JPanel comboBoxCard = new JPanel(); //CREATE FIRST CARD
comboBoxCard.add(question); //ADD question LABEL TO FIRST CARD
comboBoxCard.add(listJComboBox); //ADD listJComboBox TO FIRST CARD
comboBoxCard.add(answerButton); //ADD answerButton TO FIRST CARD
textFieldTopPanel = new JPanel(); //CREATE TOP PANEL OF SECOND CARD
textFieldTopPanel.add(xValues); //ADD xValues Label TO SECOND CARD
textFieldTopPanel.add(yValues); //ADD yValues Label TO SECOND CARD
textFieldBottomPanel = new JPanel(); //CREATE BOTTOM PANEL OF SECOND CARD
textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10)); //SET LAYOUT FOR BOTTOM PANEL
textFieldPanel = new JPanel(); //CREATE PANEL FOR SECOND CARD
textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
textFieldPanel.add(textFieldBottomPanel, "South"); //ADD textFieldBottomPanel TO SOUTH
cardDeck.add(comboBoxCard, "Step 1"); //ADD FIRST CARD TO DECK
cardDeck.add(textFieldPanel, "Step 2"); //ADD SECOND CARD TO DECK
container.add(cardDeck); //ADD CARD DECK TO CONTAINER
//DEFINE BUTTON HANDLER OBJECT
ButtonHandler buttonHandler = new ButtonHandler();
//ADD ACTION LISTENER FOR BUTTONS
answerButton.addActionListener(new ButtonHandler());
}//END RegressInput() CONSTRUCTOR
//METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
private String[] getArray()
//CREATE ARRAY TO HOLD 30 VALUES
int numbers[] = new int[29];
//CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
int number = 2;
//ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
for(int count=0; count < 29; ++count)
numbers[count] = number; //SETS EACH INDEX TO number
number++; //INCREMENTS number
}//END for LOOP
//CREATE pairs[] ARRAY TO HOLD 30 STRINGS
String pairs[] = new String[29];
//ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
for(int count = 0; count < 29; ++count)
pairs[count] = "" + numbers[count];
}//END for LOOP
return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
}//END getArray() METHOD8
//RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
private int getValue()
//ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
Integer v = new Integer((String) listJComboBox.getSelectedItem());
//ASSIGNS WRAPPER VALUE TO int
int value = v.intValue();
//RETURN VALUE OF SELECTED ITEM
return value;
}//END getValue()
private void setTextFields()
{//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
for(int count = 0; count < (2 * getValue()); ++count)
}//END setTextFields()
//BUTTON EVENT HANDLER CLASS
private class ButtonHandler implements ActionListener
//PROCESS EVENT
public void actionPerformed(ActionEvent e)
//WHICH BUTTON CAUSED THE EVENT?
if(e.getSource() == answerButton)
cardSelector.last(cardDeck);
cardDeck.setSize(600,600);
}//END if STATEMENT
}//END actionPerformed()
}//END ButtonHandler CLASS
}//END RegressInput CLASSHere is main:
import javax.swing.JFrame;
public class TestSharpStats
public static void main(String[] args)
//DEFINE FRAME OBJECT
RegressInput window = new RegressInput("Hi"); //SETS TITLE BAR
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //CLOSES WINDOW
window.setSize(400, 600); //SET FRAME SIZE
window.setResizable(true); //PREVENTS USER FROM RESIZING WINDOW
window.setVisible(true); //SETS window TO VISIBLE
}//END main()
}//END TestSharpStats CLASSmuit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652
-
Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 30 and then okay in the first window.
The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
Feel free to run the program, the problem lies in the method setTextFields(). Help please!
import javax.swing.*; //FOR SWING COMPONENT CLASSES
import java.awt.*; //FOR CONTAINER CLASS
import java.awt.event.*; //FOR EVENT HANDLING
public class RegressInput extends JFrame
private JComboBox listJComboBox; //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
private JButton answerButton; //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
private JPanel textFieldTopPanel; //TEXT FIELD TOP PANEL
private JPanel textFieldBottomPanel; //TEXT FIELD BOTTOM PANEL
private JPanel textFieldPanel; //TEXT FIELD PANEL
private CardLayout cardSelector; //DECLARE CARD LAYOUT OBJECT
private JPanel cardDeck; //DECLARE CARD PANEL OBJECT
public RegressInput(String title)
super(title); //CALL SUPERCLASS CONSTRUCTOR
//CREATE A CONTAINER
Container container = getContentPane();
//INSTANTIATE CARD LAYOUT OBJECT
cardSelector = new CardLayout();
//INSTANTIATE PANEL OBJECT
cardDeck = new JPanel();
//SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
cardDeck.setLayout(cardSelector);
//DEFINE LABEL FOR FIRST CARD
Label question = new Label("How many PAIRS of data would you like to enter?");
//BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
answerButton = new JButton("OK");
listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
listJComboBox.setMaximumRowCount(10); //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
Label xValues = new Label("X Values"); //LABEL FOR X values
Label yValues = new Label("Y Values"); //LABEL FOR Y values
//BUILD CARD DECK
JPanel comboBoxCard = new JPanel(); //CREATE FIRST CARD
comboBoxCard.add(question); //ADD question LABEL TO FIRST CARD
comboBoxCard.add(listJComboBox); //ADD listJComboBox TO FIRST CARD
comboBoxCard.add(answerButton); //ADD answerButton TO FIRST CARD
textFieldTopPanel = new JPanel(); //CREATE TOP PANEL OF SECOND CARD
textFieldTopPanel.add(xValues); //ADD xValues Label TO SECOND CARD
textFieldTopPanel.add(yValues); //ADD yValues Label TO SECOND CARD
textFieldBottomPanel = new JPanel(); //CREATE BOTTOM PANEL OF SECOND CARD
textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10)); //SET LAYOUT FOR BOTTOM PANEL
textFieldPanel = new JPanel(); //CREATE PANEL FOR SECOND CARD
textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
textFieldPanel.add(textFieldBottomPanel, "South"); //ADD textFieldBottomPanel TO SOUTH
cardDeck.add(comboBoxCard, "Step 1"); //ADD FIRST CARD TO DECK
cardDeck.add(textFieldPanel, "Step 2"); //ADD SECOND CARD TO DECK
container.add(cardDeck); //ADD CARD DECK TO CONTAINER
//DEFINE BUTTON HANDLER OBJECT
ButtonHandler buttonHandler = new ButtonHandler();
//ADD ACTION LISTENER FOR BUTTONS
answerButton.addActionListener(new ButtonHandler());
}//END RegressInput() CONSTRUCTOR
//METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
private String[] getArray()
//CREATE ARRAY TO HOLD 30 VALUES
int numbers[] = new int[29];
//CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
int number = 2;
//ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
for(int count=0; count < 29; ++count)
numbers[count] = number; //SETS EACH INDEX TO number
number++; //INCREMENTS number
}//END for LOOP
//CREATE pairs[] ARRAY TO HOLD 30 STRINGS
String pairs[] = new String[29];
//ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
for(int count = 0; count < 29; ++count)
pairs[count] = "" + numbers[count];
}//END for LOOP
return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
}//END getArray() METHOD8
//RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
private int getValue()
//ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
Integer v = new Integer((String) listJComboBox.getSelectedItem());
//ASSIGNS WRAPPER VALUE TO int
int value = v.intValue();
//RETURN VALUE OF SELECTED ITEM
return value;
}//END getValue()
private void setTextFields()
{//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
for(int count = 0; count < (2 * getValue()); ++count)
}//END setTextFields()
//BUTTON EVENT HANDLER CLASS
private class ButtonHandler implements ActionListener
//PROCESS EVENT
public void actionPerformed(ActionEvent e)
//WHICH BUTTON CAUSED THE EVENT?
if(e.getSource() == answerButton)
cardSelector.last(cardDeck);
cardDeck.setSize(600,600);
}//END if STATEMENT
}//END actionPerformed()
}//END ButtonHandler CLASS
}//END RegressInput CLASS
Here is main:
import javax.swing.JFrame;
public class TestSharpStats
public static void main(String[] args)
//DEFINE FRAME OBJECT
RegressInput window = new RegressInput("Hi"); //SETS TITLE BAR
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //CLOSES WINDOW
window.setSize(400, 600); //SET FRAME SIZE
window.setResizable(true); //PREVENTS USER FROM RESIZING WINDOW
window.setVisible(true); //SETS window TO VISIBLE
}//END main()
}//END TestSharpStats CLASSIf your teacher taught you to program like this they should be shot. There is no need to comment every single line (especially in upper case). The comments stand out more that the code does and doesn't add any usefull information. Obviously comments are important, but you need to pick and choose when to use them.
Swing related questions should be posted in the Swing forum.
Also, don't use AWT components in a Swing application. Label is AWT. JLabel is Swing.
I would use a JTable to input the matching pairs of data. Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Table to get started. -
Error while Adding user to 'SunAccessManager' Resource
Hi,
I configured SAM Resource adapter in SIM 6.0. When I create a user and assign SAM Resource getting the following Error,
com.waveset.util.WavesetException: An error occurred adding user 'uid=SIMUser2,ou=People,o=Employee,dc=nl,dc=dap,dc=com' to resource 'SunAccessManager'. com.waveset.util.WavesetException: An error occurred creating user. java.lang.IllegalArgumentException: Invalid parameters
Pls help me to resolve this issue
Thanks,
DevaHi Satish,
The problem is that you added the table and the objetc that you used to add the table is not freed properly. You need to free the object and then the reference count to that table will be 0 - which will enable you to add the fields
e.g
Dim pUTables As SAPbobsCOM.UserTablesMD
'Do your stuff
Set pUTables = Nothing
Dim pUFields As SAPbobsCOM.UserFieldsMD
'Do your stuff
Set pUFields = Nothing -
Problen in ChooseFromList & User Defined Object
Hello.
I'm trying to use a [ChooseFromList] that calls info from one User Table called @LABS this table is MasterData type.
I add a User Defined Object in runtime, called UO_Labs
Then, I add one ChooseFromList to my form (This form was made in ScreenPainter)
The user object was created fine, the ChooseFromList is added fine, the form loads fine, but, when I press tab or the button of the ChooseFromList I get this error: "Internal error (-1003) ocurred [Message 131-183]"
I try to use my ChooseFromList in one Matrix and in one EditText objects. And gives me the same error in both objects.
I'm using SAP 2007 PL 35
This is my code:
Adding the User Defined Object -
Dim UO As SAPbobsCOM.UserObjectsMD
UO = CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
UO.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
UO.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
UO.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO
UO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
UO.Code = "UO_Labs"
UO.Name = "Laboratory Info."
UO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
UO.TableName = "LABS"
If UO.FormColumns.Count = 0 Then UO.FormColumns.Add()
UO.FormColumns.SonNumber = 0
UO.FormColumns.FormColumnAlias = "Code"
UO.FormColumns.FormColumnDescription = "Code"
UO.FormColumns.Add()
UO.FormColumns.SonNumber = 0
UO.FormColumns.FormColumnAlias = "Name"
UO.FormColumns.FormColumnDescription = "Name"
If UO.Add() <> 0 Then
Application.MessageBox(CompanyObj.GetLastErrorDescription)
End If
END Adding the User Defined Object -
This code adds my UDO and it works fine, has data and do the work.
Adding the [ChooseFromList] Object -
'// form object is send in parameters.
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = f.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFL_CP As SAPbouiCOM.ChooseFromListCreationParams
Dim matrix As SAPbouiCOM.Matrix = form.Items.Item("matrix").Specific
oCFL_CP = App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
oCFL_CP.MultiSelection = False
oCFL_CP.ObjectType = "UO_Labs"
oCFL_CP.UniqueID = "cfl_Labs"
oCFL = oCFLs.Add(oCFL_CP)
matrix.Columns.Item("labCode").ChooseFromListUID = "cfl_Labs"
matris.Columns.Item("labCode").ChooseFromListAlias = "Code"
form.Refresh()
END Adding the [ChooseFromList] Object -
Thanks for your time...
Greetings
Gabriel Vasquez.Hi Gabriel,
Please check in B1 if the UDO is created correctly, specifically the CanFind option. I got that error once, with one of my addons, that somehow was created with CanFind=tNo, despite my code indication CanFind=tYes...
Also, try adding the CFL directly in the XML form.
<column uid="C_labCod" type="116" title="Lab. Code" description="Laboratory Code" visible="1" AffectsFormMode="1" width="70" disp_desc="1" editable="1" right_just="0" val_on="Y" val_off="N" backcolor="-1" forecolor="-1" text_style="0" font_size="-1" ChooseFromListUID="cfl_Labs" ChooseFromListAlias="Code">
<databind databound="1" table="@LABS" alias="U_labCode"></databind>
<ExtendedObject linkedObject="" LinkedObjectType=""></ExtendedObject>
</column>
<ChooseFromListCollection>
<action type="add">
<ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"></ChooseFromList>
<ChooseFromList UniqueID="cfl_Labs" ObjectType="UO_Labs" MultiSelection="0" IsSystem="0"></ChooseFromList>
</action>
</ChooseFromListCollection>
Also, it's a good practice to your SAP partner's NameSpace as prefix to UDOs, UDTs, UDFs and UDKeys, in order to avoid conflicts with other partner's add-ons.
Regards,
Vítor Vieira -
User Defined Object Default Form - Can't add record
Hi,
I have created a user defined object on a Master Data Table with acccompanying Rows table.
For some reason I can't get any records in the Master table. SBO claims the operation (save) was succesfull however the table remains empty and the line I entered gets cleared!
I'm running SBO2005ASP01PL07 so I don't think I'm missing any updates.
Anyone have an idea as to what''s wrong?
Regards,
Ivo VinkFor those that encounter the same problem.
A tool from a third party had made a small change in the SBO_SP_TransactionNoticfication stored-procedure,
This change produced an error when a transaction was done on a UDO becuase the object type of an UDO is NOT numeric but contains the name of the UDO.
The adjustment made assumed Object_Type was allways numeric wich it is NOT.
An error occured, resulting in SBO rolling back the entire transaction.
Simple adjustment:
If isnumeric(@object_type) = 1
BEGIN
-- third party added code
END
Regards,
Ivo Vink -
Email notification for user created through reconciliation in OIM
Hi..
I have done the following configurations for email notification when user is created through reconciliation in OIM
Configuring IT Resource
Name Email Server
Type Mail Server
Authentication FALSE
Server Name *.*.*.*
Username
Password
Creating email definition with the following values
Name Create User Email Notification
Type Provisioning Related
Language en
Region US
Object Name Xellerate User
Process name Xellerate User
From User
User Login Xelsysadm
Subject User Created
Add Email notification in a new process task with name Notify
Process definition Xellerate User
Task Notify
Disable Manual Insert Enable
Required for Completion Enable
Allow Cancellation while Pending Enable
Handler Name tcComplete Task
Assignment Rule Default
Target Type User
User Xelsysadm
Email name Create User Email Notification
Send Email Enable
Notification Assignee Enable
Email Create User Email Notification
Status Completed
Xelsysadm has a valid email id. Now when I am reconciling any user, two mail notifications are being sent. Not able to know from where these two notifications are being triggered.
Am i suppose to make any changes in the configurations?
Edited by: Amruta Agarwal on Sep 28, 2011 4:21 AMSorry re-read your issue again. I believe there are two notifications because you have added your notify task in the process definition and OIM OOTB sends a notification when a user is recon'd. Thus remove your task or disable the OOTB notification. The property is Recon.SEND_NOTIFICATION
HTH,
BB
Edited by: bbagaria on Oct 7, 2011 9:13 AM
Maybe you are looking for
-
Sharing clipboard and pasteboard between Wireshark(X11) and Mac OSX
I installed latest Wireshark for Mac version. However, it is interesting that I cannot copy what I have copied in Wireshark and the paste it in my Mac any editor. The reverse direction is also the same. If I have any wireshark filter I would like to
-
PR05 shows data for anyone in org.
We are upgrading from 4.5b to ECC 6.0 and if I or anyone else goes into PR05 and enters a personal number for someone higher up in the orginazation you can see all of their trips. I have checked table T77S0 against our 4.5B box and all the settings a
-
Spinning objects effect "Youtube look"
Hello I'm trying to create that circling objects effect look. See attached picture & link.. Click to watch it in motion. See the following link to see it in motion: http://www.sratim.co.il/ I'm trying to create that look in after effects - and I woul
-
Backlight out after dropping 3Gs on hard surface
I dropped my iPhone 3Gs the other day in my kitchen, its a pretty hard floor. I picked my phone back up and noticed instantly that i could barely see the screen; the backlight had gone out. I looked up online what the issue could be, and its either m
-
Hi, 1-how can I see the objects of a tablespace ? 2-does TEMP tablespace contain any object ? How to see ? Thanks.