Idea for this code pls

Hi,
In the below code, I have certain doubts.
1.Do I need to go for inner join statements in fetching data for parameters?..
2. How can I group by document type and print the total of net value...for this do i need to move the datas to another internal table ?..How to ?
tables : vbak,vbap.
data : begin of itab occurs 0,
        vbeln like vbak-vbeln,
        auart like vbak-auart,
        netwr like vbak-netwr,
        waerk like vbak-waerk,
        zmeng like vbap-zmeng,
        zieme like vbap-zieme,
        posnr like vbap-posnr,
        matnr like vbap-matnr,
        end of itab.
select-options : s_vbeln for vbak-vbeln.
Parameters     : s_vkorg(10) type c,
                 s_vtweg(10) type c,
                 s_spart(10) type c.
start-of-selection.
select avbeln aauart anetwr awaerk bzmeng bzieme bposnr bmatnr
into table itab from vbak as a inner join vbap as b on b~vbeln =
avbeln where avbeln in s_vbeln .
loop at itab.
write : /5 itab-vbeln,15 itab-posnr,25 itab-auart,
30 itab-matnr,35 itab-zmeng,40 itab-zieme,45 itab-netwr,50 itab-waerk..
endloop.
Initialization.
at selection-screen.
IF   s_vbeln is initial and
     s_vkorg is initial and
     s_vtweg is initial and
     s_spart is initial.
    MESSAGE e000(zam).
  ENDIF.
  IF not s_vbeln is initial.
   select vbeln  auart netwr waerk from vbak into table itab where vbeln
                                                             in s_vbeln.
    IF sy-subrc NE 0.
         MESSAGE e001(zam).
             ENDIF.
    else.
    if not  s_vkorg is initial.
     select vbeln auart netwr waerk from vbak into table itab
                                     where vkorg = s_vkorg.
         if sy-subrc NE 0.
             message e002(zam).
                     endif.
                      endif.
    If not s_vtweg is initial.
     select vbeln auart netwr waerk from vbak into table itab
                                      where vtweg = s_vtweg.
       If sy-subrc NE 0.
            message e003(zam).
                  endif.
                   endif.
     if not s_spart is initial.
        select posnr matnr zmeng zieme from vbap into table itab
                                           where spart = s_spart.
        if sy-subrc NE 0.
             message e004(zam).
                 endif.
                   endif.
   ENDIF.

The JOIN looks OK.
You can move the document type to the beginning of the internal table and sort on it when the data is collected.Then:
  LOOP AT itab.
    AT NEW auart.
* Totals
    ENDAT.
    WRITE :  /5 itab-vbeln,15 itab-posnr,25 itab-auart,
             30 itab-matnr,35 itab-zmeng,40 itab-zieme,
             45 itab-netwr,50 itab-waerk..
  ENDLOOP.
Rob

Similar Messages

  • Equivalent for this code

    Hi, Could you please let me know what is the EQUIVALENT for this code. This code replace 2 number of  0s or 1s to Just one 0 or 1. The code is very very slow when the input string is very big. Is there any way to replace it with something faster.
    Thanks 
    Attachments:
    Untitled 1.vi ‏7 KB

    This code takes 1ms to run on a string of 60,000 characters (one continuous string of 0's and 1's).  Whereas using your code, it takes about 900ms for the same string.

  • User exit for  this code

    Hi ..
    my requirement  is the program should prompt for 3 parameters (all check marks) with the follwoing text; all check marks enabled by default
    - Variables
    - Key Figures
    - Structures
    So when users select variables then do this part in main program
    test_for = 'STR'.
    perform dowork using test_for.
    for key figures
    test_for = 'CKF'.
    perform dowork using test_for.
    test_for = 'SEL'.
    perform dowork using test_for.
    for variables
    test_for = 'VAR'.
    perform dowork using test_for.
    please give  the code how to write that one.
    thanks in advance
    Madhavi

    Hi Maik,
    am using this quode for one tool .this tool is used for copy queries from one system another instead of transporting.its easy method.so i want to do some modifications for this code.please elaborate ur answer .will assign points.
    Cheers,
    Madhavi

  • HT204003 I can't get passbook to accept my loyalty cards. It keeps saying no pass available for this code. What am I doing wrong?

    I can't get passbook to accept my loyalty cards. It keeps saying no pass available for this code. What am I doing wrong?

    You may have installed your TextWrangler application without administrator privileges. In this you'll have to look for the twdiff file in the Local Applications Support Folder (refer to TextWrangler User Manual).
    To fix your problem with Dreamweaver, while selecting your File Compare tool, try looking for the twdiff file in the following location :
    Macintosh HD:usr:local:bin:twdiff
    That should definitely work. It did for me
    Cheers!

  • Alternate for this code(joins)

    CREATE TABLE [Store](
    [StoreId] [int] IDENTITY(1,1) NOT NULL,
    [LOC_Name] [varchar](50) NULL,
    CONSTRAINT [PK_Store] PRIMARY KEY CLUSTERED
    [StoreId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Insert into [dbo].[Store]
    [LOC_Name]
    select 'virginia'
    union all
    select 'chicago'
    CREATE TABLE [Employee](
    [StoreId] [int] NOT NULL,
    [Emp_NAME] [nvarchar](70) NULL,
    ) ON [PRIMARY]
    Insert into [dbo].[Employee]
    [StoreId]
    ,[Emp_NAME]
    select 1,'daniel'
    union all
    select 1,'jack'
    union all
    select 1,'roger'
    union all
    select 1,'matt'
    union all
    select 2,'sam'
    union all
    select 2,'henry'
    union all
    select 2,'eston'
    union all
    select 2,'robert'
    union all
    select 2,'nadal'
    CREATE TABLE [Customer](
    [CustomerId] [int] IDENTITY(1,1) NOT NULL,
    [StoreId] [int] NOT NULL,
    [CUST_NO] [nvarchar](11) NULL,
    CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
    [CustomerId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    set identity_insert [CCC_STAGE].[dbo].[Customer_test] on
    Insert into [CCC_STAGE].[dbo].[Customer_test]
    [CustomerId]
    ,[StoreId]
    ,[CUST_NO]
    select 201,1,897456
    union all
    select 202,1,974652
    union all
    select 203,1,276294
    union all
    select 204,1,612348
    union all
    select 205,2,187906
    union all
    select 206,2,289123
    union all
    select 207,2,427403
    union all
    select 208,2,591654
    union all
    select 209,2,904563
    -------------- Query to retrieve In each location each employee is working on how many customers--
    select [LOC_NAME],
    B.[Emp_NAME],
    COUNT(distinct C.[CUST_NO]) TOTAL_CUSTOMERS
    FROM [CCC_STAGE].[dbo].[Store] A
    join [CCC_STAGE].[dbo].[Employee] B
    on A.StoreId=B.StoreId
    join [CCC_STAGE].[dbo].[Customer] c
    on B.StoreId=C.StoreId
    --where LOC_NAME='virginia'
    --where LOC_NAME='chicago'
    group by [LOC_NAME]
    ,B.[Emp_NAME]
    ORDER BY [LOC_NAME],B.[Emp_NAME]
    Hi Everyone,
    I inserted the code creating tables and inserting values to tables and also there is a query which retrieves the data from the tables I created.
    In this scenario, what we need to get is.....
    we need to find out in each location, each employee is working on how many customers, but with the query I wrote I get the data like, all the employee's are working on all the customers. Below is the output I should get
    loc_name emp_name  total_customers
    chiacgo    eston             1
    Chicago    henry             2
    Chicago    nadal             2
    Chicago    Robert          1
    but I am getting the below output which is in correct
    loc_name emp_name  total_customers
    chiacgo    eston            5
    Chicago      henry         5
    Chicago    nadal           5
    Chicago    Robert         5
    Why I am getting this out put can any one tell me please.... I am getting an out put like all the employees are working on all the customers.
    Thanks
    vishu

    Thank you for trying to post DDL; unfortunately, you got it wrong. You also writer really bad SQL code. Only one store and one Personnel? And Personnel is not an attribute of store! We do not use IDENTITY in RDBMS, etc. 
    CREATE TABLE Stores
    (store_duns CHAR(9) NOT NULL PRIMARY KEY, -- wrong!
     store_location VARCHAR(50) NOT NULL);
    The DUNS is the industry standard for a business identifier, but let's keep your INTEGER for now. A location should be on the same scale – that means a city-state location name. 
    Do you really have only one employee, as you said? Why do you think a store is an attribute of this one guy? You have a relationship table here. Tables must have keys. 
    Why did you use a emp_name NVARCHAR(70) as a key?? 
    CREATE TABLE Store_Assignments 
    (emp_id CHAR(10) NOT NULL 
      REFERENCES Personnel (emp_id)
      PRIMARY KEY, 
     store_duns CHAR(9) NOT NULL
      REFERENCES Stores(store_duns));
    Customers also do not have a store as an attribute! They have a relationship. Is it 1:1, 1:m, n:m or what?? I will guess 1:1. D ou know what that means? You seem to have no idea how to write a basic schema. 
    CREATE TABLE Customer_Assignments 
    (customer_id CHAR(16) NOT NULL PRIMARY KEY
      REFERENCES Customers(customer_id)
     ON DELETE CASCADE , 
     store_duns CHAR(9) NOT NULL
      REFERENCES Stores(store_duns)
     ON DELETE CASCADE);
    >> we need to find out in each location, each employee is working on how many customers, but with the query I wrote I get the data like, all the employee’s are working on all the customers. <<
    Your design is garbage. Where did you assign a customer to an employee? (“Hello, my name is Joe and I will be your salesman/waiter!”). The location of a store is unimportant for this.  You need:
    CREATE TABLE Customer_Agent
    (customer_id CHAR(16) NOT NULL PRIMARY KEY
      REFERENCES Customers(customer_id)
     ON DELETE CASCADE, 
     emp_id CHAR(9) NOT NULL
      REFERENCES Personnel(emp_id)
     ON DELETE CASCADE);
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Ple give me ur idea for this scenerio

    hi frids
    i created view for BSEG and BKPF bec in both tables i have common key comp_code is there.
    now i created datasource for this
    now i need to add another 3 fields.
    ECC field table
    BKLAS MBEW
    STPRS MBEW
    MEINS     EINA
    can i create another datasource with table for this 2 fields and add meins using datasource enhancements
    or can i add 3 fields for view datasource
    which is best
    if ur idea is to add ple let me know coading how to take primary keys to write code
    regards
    suneel.

    Hi
    I dont have any common filed to create view for this 2 tables mbew and meins. can i create table datasource and add meins field using datasource enhancements
    why cant add that 3 fields for view datasource
    now 2 choices
    1 already view data source is there
    2nd i need use table datasource for mbew and add meins field
    or i need create mbew datasource and meins datasource
    total will be 3 datasources.
    let me know which one will be goood according performance wise also

  • Is there any alternative for this code to increase performance

    hi, i want alternate code for this to increase performance.
    DATA : BEGIN OF itab OCCURS 0,
                  matnr LIKE zcst-zmatnr,
                 checked TYPE i,
                 defected TYPE i,
               end of itab.
    SELECT DISTINCT zmatnr FROM zcst INTO TABLE itab WHERE
       zmatnr IN s_matnr AND
          zwerks EQ p_plant AND
          zcastpd IN s_castpd AND
          zcatg IN s_categ.
    LOOP AT itab.
        ind = sy-tabix.
    SELECT COUNT( DISTINCT zcst~zcastn )
           FROM zcst INNER JOIN zvtrans
           ON ( zcstzcastn = zvtranszcastn AND
                zcstzmatnr = zvtranszmatnr AND
                zcstzwerks = zvtranszwerks AND
                zcstgjahr  = zvtransgjahr )
           INTO itab-checked
           WHERE
               zcst~zmatnr = itab-matnr AND
               zcst~zwerks EQ p_plant AND
               zcastpd IN s_castpd AND
               zcatg IN s_categ.
    SELECT COUNT( DISTINCT zcst~zcastn )
          FROM zcst INNER JOIN zvtrans
          ON ( zcstzcastn = zvtranszcastn AND
               zcstzmatnr = zvtranszmatnr AND
               zcstzwerks = zvtranszwerks AND
               zcstgjahr  = zvtransgjahr )
          INTO itab-defected
          WHERE
              zcst~zmatnr = itab-matnr AND
              zcst~zwerks EQ p_plant AND
              zcastpd IN s_castpd AND
              zcatg IN s_categ AND
              zvtrans~zdcode <> '   '.
      MODIFY itab INDEX ind.
      ENDLOOP.
    i think, select within loop is reducing the performance
    pls reply

    Hi,
    types : BEGIN OF t_itab ,
        matnr LIKE zcst-zmatnr,
       checked TYPE i,
       defected TYPE i,
    end of t_itab.
    data : itab type table of t_itab,
             wa_itab type t_itab.
    and instead of looping as in ur code try to use for all entries and
    use nested loop.

  • Please give me flowchart for this code...

    Writing a Java applet to communicate with a serial device attached to the Device
    Server is very straightforward. However, familiarity with Java programming and a
    Java compiler are required.
    As with any network application, open a communication channel to the remote
    device. In our example, a socket is opened and and two data streams are created to
    perform the actual sending and receiving of data.
    The following example uses a new Java Class called tcpip. Copy the following code
    into a file called tcpip.java.
    import java.*;
    import java.lang.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    * This class opens a TCP connection, and allows reading and writing of byte
    arrays.
    public class tcpip
    protected Socket s = null;
    public DataInputStream dis = null;
    protected DataOutputStream dos = null;
    public tcpip(InetAddress ipa, int port)
    Socket s1 = null;
    try { // Open the socket
    s1 = new Socket(ipa.getHostAddress(), port);
    catch (IOException e) {
    System.out.println("Error opening socket");
    return;
    s = s1;
    try { // Create an input stream
    dis = new DataInputStream(new
    BufferedInputStream(s.getInputStream()));
    catch(Exception ex) {
    System.out.println("Error creating input stream");
    try { // Create an output stream
    dos = new DataOutputStream(new
    BufferedOutputStream(s.getOutputStream()));
    catch(Exception ex) {
    System.out.println("Error creating output stream");
    public synchronized void disconnect()
    if (s != null) {
    try {
    s.close();
    catch (IOException e){}
    public synchronized void send(byte[] temp)
    try {
    dos.write(temp, 0, temp.length);
    dos.flush();
    catch(Exception ex) {
    System.out.println("Error sending data : " + ex.toString());
    public synchronized void send(byte[] temp, int len)
    try {
    dos.write(temp, 0, len);
    dos.flush();
    catch(Exception ex) {
    System.out.println("Error sending data : " + ex.toString());
    public synchronized void send(String given)
    // WARNING: this routine may not properly convert Strings to bytes
    int length = given.length();
    byte[] retvalue = new byte[length];
    char[] c = new char[length];
    given.getChars(0, length, c, 0);
    for (int i = 0; i < length; i++) {
    retvalue[i] = (byte)c;
    send(retvalue);
    public synchronized byte[] receive()
    byte[] retval = new byte[0];
    try {
    while(dis.available() == 0); /* Wait for data */
    catch (IOException e){}
    try {
    retval = new byte[dis.available()];
    catch (IOException e){}
    try {
    dis.read(retval);
    catch (IOException e){}
    return(retval);
    public int available()
    int avail;
    avail = 0;
    try {
    avail = dis.available();
    catch (IOException e) {}
    return(avail);
    Next, create the Text_io class as the application. Copy the following code
    into a file called �Text_io.java�.
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    public class Text_io extends Panel implements Runnable,
    TextListener {
    private tcpip gtp;
    String oldmessage = new String("");
    TextArea input_box = new TextArea("", 10, 60, 3);
    TextArea output_box = new TextArea("", 10, 60, 3);
    Thread timer;
    public Text_io(tcpip tp) {
    gtp = tp;
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(5,5,5,5);
    setBackground(java.awt.Color.lightGray);
    setSize(561,380);
    c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight =
    1;
    c.weightx = 0.0; c.weighty = 0.0; c.anchor =
    GridBagConstraints.WEST;
    c.fill = GridBagConstraints.NONE;
    add((new Label("To Device Server: (Type Here--->)")), c);
    //input_box
    input_box.addTextListener(this);
    c.gridx = 1; c.gridy = 2; c.gridwidth = 3; c.gridheight =
    1;
    c.weightx = 0.5; c.weighty = 0.0; c.anchor =
    GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.BOTH;
    add(input_box,c);
    c.gridx = 0; c.gridy = 4; c.gridwidth = 1; c.gridheight =
    1;
    c.weightx = 0.0; c.weighty = 0.0; c.anchor =
    GridBagConstraints.WEST;
    c.fill = GridBagConstraints.NONE;
    add((new Label("From Device Server:")), c);
    c.gridx = 1; c.gridy = 4; c.gridwidth = 3; c.gridheight =
    1;
    c.weightx = 0.5; c.weighty = 0.0; c.anchor =
    GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.BOTH;
    add(output_box,c);
    output_box.setEditable(false);
    timer = new Thread(this);
    timer.start();
    public void run() {
    int i;
    byte[] in;
    Thread me = Thread.currentThread();
    while (timer == me) {
    try {
    Thread.currentThread().sleep(200);
    catch (InterruptedException e) { }
    if ( (gtp != null) && ((i = gtp.available()) > 0) ) {
    in = gtp.receive();
    /* remove non-printing bytes */
    for (i = 0; i < in.length; i++) {
    if (in[i] < 0x20)
    in[i] = 0x20;
    output_box.append((new String(in)));
    public void textValueChanged(TextEvent e) {
    int len, i;
    String str = new String("");
    String message = input_box.getText();
    len = message.length() - oldmessage.length();
    if (len < 0) {
    for (i = 0; i < -len; i++)
    str += "\b";
    //System.out.println("Backspace");
    else if (len > 0) {
    str = message.substring(oldmessage.length());
    //System.out.println("len = "+str.length()+" str =
    "+str);
    oldmessage = message;
    if ( (len != 0) && (gtp != null) )
    gtp.send(str);
    Next, create the actual applet that uses the tcpip and Text_io classes. Copy
    the following code into a file called �Test.java�.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import java.net.*;
    import java.io.*;
    import java.lang.*;
    import java.text.*;
    import java.util.*;
    public class Test extends Applet {
    static private boolean isapplet = true;
    static private InetAddress arg_ip = null;
    static private int arg_port = 0;
    public tcpip gtp = null;;
    InetAddress reader_ip = null;
    int port = 10001;
    public void init()
    gtp = null;
    reader_ip = null;
    port = 10001;
    public void start()
    String st = new String("TCP/IP connection status: ");
    setFont(new Font("Dialog",Font.BOLD,16));
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight
    = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(5,5,5,5);
    setBackground(Color.yellow);
    setSize(600,500);
    /* Either get the IP address from the HTTP server if
    we're an applet, or from the commandline (if passed).
    if (isapplet) {
    try{
    reader_ip = InetAddress.getByName(getCodeBase().getHost());
    catch (UnknownHostException e){}
    else {
    reader_ip = arg_ip;
    if (arg_port != 0) {
    port = arg_port;
    /* Open a socket to the Device Server's serial port
    if (reader_ip != null) {
    if (gtp == null) {
    gtp = new tcpip(reader_ip, port);
    if (gtp.s == null) {
    st += "Connection FAILED! ";
    gtp = null;
    if (gtp == null) {
    st += "Not Connected";
    add((new Label(st)), c);
    return;
    st += "Connected";
    add((new Label(st)), c);
    /* You may now perform IO with the Device Server via
    * gtp.send(byte[] data_out);
    * byte[] data_in = gtp.receive();
    * functions.
    * In our example we'll use two TextBoxes which have
    * been extended to handle IO to the Device Server.
    *Data typed in the upper text box will be sent to
    * the Device Server, and data received will be
    *displayed in the lower text box.
    /* Start of custom application code */
    /* ADD YOUR CODE HERE */
    c.gridx = 0; c.gridy = 2; c.gridwidth = 3; c.gridheight =
    1;
    c.anchor = GridBagConstraints.WEST;
    add((new Text_io(gtp)), c);
    /* End of custom application code */
    public void destroy()
    if (gtp != null)
    gtp.disconnect();
    gtp = null;
    public void stop() {
    public static void main(String[] args) {
    Frame frame = new Frame("TCP/IP Test");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    if (args.length > 0) {
    try{
    arg_ip = InetAddress.getByName(args[0]);
    catch (UnknownHostException e){}
    if (args.length > 1) {
    try {
    arg_port = Integer.valueOf(args[1]).intValue();
    catch (NumberFormatException e) {}
    Test ap = new Test();
    frame.add(ap);
    ap.init();
    isapplet = false;
    ap.start();
    frame.pack();
    frame.show();

    Let's see a decent try by you towards a solution first. I've found that usually the more thought and effort posters put into creating and solving their questions, the better their chances are of a volunteer here taking the time and effort to consider it and give a helpful answer. In other words, show that you are putting effort into doing your own homework first.
    Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom, like so:
    &#91;code]
      // your code block goes here.
      // note the differences between the tag at the top vs the bottom.
    &#91;/code]or
    {&#99;ode}
      // your code block goes here.
      // note here that the tags are the same.
    {&#99;ode}good luck

  • Scroll bars for this code...

    Hai All,
    Here is the problem i am placing .. when ever there are no.of records to display i want to put the scroll bars to view.... and i am adding my code ... can any one please give me the solution how to add vertical scroll bar to this code....
    import java.util.*;
    import java.awt.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.lang.ArithmeticException;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.CallableStatement;
    import java.sql.SQLException;
    import java.awt.BorderLayout;
    import java.awt.event.AdjustmentEvent;
    import java.awt.event.AdjustmentListener;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollBar;
    public class MyExample extends Frame {
    Thread t;
    Frame f ;
    Label bat_result,proc_reply,tot_records,tot_aft_records,dtrs_label,vrs_label1,vrs_label2,vrs_label3,or,dateformat,fileno,fname,fdcode,fdob,fappdate;
    Button b1,dialup,b2,report,b5,vrs,dtrs,dtrs_search,vrs_search;
    ActionListener a;
    TextField value,value1,vrs_fileno,vrs_fdate,vrs_tdate,dtrs_date,fileno_result,fdcode_result,fname_result,fdob_result,fappdate_result;
    Image image,icon;
    Toolkit tool;
    JProgressBar progress;
    JButton button;
    JLabel label1;
    JPanel topPanel;
    Random random;
    MediaTracker mTracker,mTracker1;
    public MyExample()
    setLayout(null);
    setSize(900,600);
         setResizable(true);
         setBackground(new Color(223,224,194));
         setTitle("Menu Window!");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
         tool = Toolkit.getDefaultToolkit();
    image = tool.getImage("");
    mTracker = new MediaTracker(this);
    mTracker.addImage(image,0);
         setSize(900,600);
         a = new MyActionListener();
         add(b1 = new Button(""));
         b1.setBounds(40,180,120,20);
    b1.setBackground(new Color(12632551));
    b1.setActionCommand("");
    b1.addActionListener(a);
    b1.setVisible(true);
         add(dialup = new Button(""));
         dialup.setBounds(40,230,120,20);
    dialup.setBackground(new Color(12632551));
    dialup.setActionCommand("");
    dialup.addActionListener(a);
    dialup.setVisible(true);
         add(b2 = new Button(""));
         b2.setBounds(40,280,120,20);
    b2.setBackground(new Color(12632551));
    b2.setActionCommand("");
    b2.addActionListener(a);
    b2.setVisible(true);
         add(report = new Button(""));
         report.setBounds(40,330,120,20);
    report.setBackground(new Color(12632551));
    report.setActionCommand("");
    report.addActionListener(a);
    report.setVisible(true);
    add(vrs = new Button(" "));
         vrs.setBounds(50,370,120,20);
    vrs.setBackground(new Color(12632551));
    vrs.setActionCommand("");
    vrs.addActionListener(a);
    vrs.setVisible(false);
    add(dtrs = new Button(" "));
         dtrs.setBounds(50,410,120,20);
    dtrs.setBackground(new Color(12632551));
    dtrs.setActionCommand("");
    dtrs.addActionListener(a);
    dtrs.setVisible(false);
    add(dtrs_label = new Label(" "));
    dtrs_label.setBounds(340, 180, 80, 20);
    dtrs_label.setVisible(false);
         add(vrs_label1 = new Label(" "));
    vrs_label1.setBounds(330, 180, 80, 20);
    vrs_label1.setVisible(false);
    add(vrs_label2 = new Label(" "));
    vrs_label2.setBounds(330, 230, 80, 20);
    vrs_label2.setVisible(false);
    add(vrs_label3 = new Label(" "));
    vrs_label3.setBounds(580, 230, 60, 20);
    vrs_label3.setVisible(false);
    add(dateformat = new Label(""));
    dateformat.setBounds(520,180, 80, 20);
    dateformat.setVisible(false);
    add(vrs_search = new Button(""));
         vrs_search.setBounds(250,180,120,20);
    vrs_search.setBackground(new Color(12632551));
    vrs_search.setActionCommand("");
    vrs_search.addActionListener(a);
    vrs_search.setVisible(false);
    add(dtrs_search = new Button(""));
         dtrs_search.setBounds(600,180,120,20);
    dtrs_search.setBackground(new Color(12632551));
    dtrs_search.setActionCommand("");
    dtrs_search.addActionListener(a);
    dtrs_search.setVisible(false);
    add(or = new Label(""));
    or.setBounds(500, 270, 80, 20);
    or.setVisible(false);
         add(b5 = new Button(""));
         b5.setBounds(40,380,120,20);
    b5.setBackground(new Color(12632551));
    b5.setActionCommand("");
    b5.addActionListener(a);
    b5.setVisible(true);
         add(proc_reply=new Label(" "));
         proc_reply.setBounds(350,300,150,20);
    proc_reply.setVisible(false);
    add(tot_records=new Label(" "));
         tot_records.setBounds(350,270,150,20);
    tot_records.setVisible(false);
    add(tot_aft_records=new Label(" "));
    tot_aft_records.setBounds(350,330,180,20);
    tot_aft_records.setVisible(false);
    show();
         addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent w)
              System.exit(0);
    public void paint(Graphics g){
    g.drawImage(image,0,0,null);
    class MyActionListener implements ActionListener {
    public void actionPerformed(ActionEvent ae) {
    String s = ae.getActionCommand();
    if( ae.getSource() == button )
    button.setEnabled( false );
         if (s.equals("")) {
    int x=JOptionPane.showConfirmDialog(f,"Do You Want To Close");
         if(x==0){
         System.exit(0);
         else if (s.equals("")) {
         batch b=new batch();
              else if (s.equals("")) {
         dialcall dc=new dialcall();
              else if (s.equals("")){
    procedure proc=new procedure();
    else if (s.equals("")){
    reportcall rc=new reportcall();
    else if (s.equals("")) {
         verification vs=new verification();
              vs.verification1();
    else if (s.equals("")) {
         datatransfer dts=new datatransfer();
         dts.datatransfer1();
                   else if (s.equals("")) {
         datatransfer dts=new datatransfer();
         dts.display(dtrs_date.getText());
    else if (s.equals("")) {
         verification vs=new verification();
         vs.ver_display(vrs_fileno.getText(),vrs_fdate.getText(),vrs_tdate.getText());
    public class batch extends MyExample{
    public batch()
    setTitle("");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
         Process p1;
         try{
         b1.removeActionListener(a);
         p1 = Runtime.getRuntime().exec("");
    p1.waitFor();
    t.sleep(8000);
         batchResult br=new batchResult();
    catch(Exception bat)
              JOptionPane.showMessageDialog(batch.this, "Error: "+bat.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    public class batchResult extends MyExample{
    public batchResult(){
    String conCount="";
         Connection conresult = null;
         PreparedStatement totalrecords;
         ResultSet resultset = null;
         Statement constmt = null;
         int hh=0;
         try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conresult = DriverManager.getConnection( "thindriver");
    constmt = conresult.createStatement();
    conCount = "query";
    totalrecords = conresult.prepareStatement(conCount);
    resultset = totalrecords.executeQuery(conCount);
                   try{
    if(resultset.next()){
                   hh = resultset.getInt("rec");
                   }catch(Exception we)
                        JOptionPane.showMessageDialog(batchResult.this, "Error: "+we.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
                   if(hh!=0){
    JOptionPane.showMessageDialog(f,"No.of records Imported: "+hh);
    else {
                   JOptionPane.showMessageDialog(f,"No Records Found to Transfer");
                   }catch(Exception ew)
                        JOptionPane.showMessageDialog(batchResult.this, "Error: "+ew.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    public class dialcall extends MyExample{
    public dialcall()
    b1.removeActionListener(a);
    setTitle("");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
         Process p2;
         try{
         b1.removeActionListener(a);
         p2 = Runtime.getRuntime().exec("");
    p2.waitFor();
    catch(InterruptedException dl)
              JOptionPane.showMessageDialog(dialcall.this, "Error: "+dl.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    catch(Exception dl)
              JOptionPane.showMessageDialog(dialcall.this, "Error: "+dl.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    public class procedure extends MyExample{
    public procedure()
    setSize(900,600);
         setTitle("");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
    b1.removeActionListener(a);
         dialup.removeActionListener(a);
         //b2.removeActionListener(a);
    Statement stmt = null;
         // DB Connection Variables
    final String driverClass = "oracle.jdbc.driver.OracleDriver";
    final String connectionURL = "";
    final String userID = "";
    final String userPassword = "";
    String beforeCount="";
         String afterCount="";
         Connection con = null;
         Connection con1 = null;
         PreparedStatement bCountRecords;
    PreparedStatement aCountRecords;
    int a=0,b=0;
    ResultSet rset2 = null;
         ResultSet rset1 = null;
         String cnt="";
         String cnt1="";
         String bb=null;
         //CallableStatement cstmt1 = null;
         //CallableStatement cstmt2 = null;
         ProgressBarExample pbe=new ProgressBarExample();
         pbe.setVisible( true );
         try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection( "thindriver");
    stmt = con.createStatement ();
    beforeCount = "";
              afterCount = "";
    bCountRecords = con.prepareStatement(beforeCount);
    aCountRecords = con.prepareStatement(afterCount);
              rset1 = bCountRecords.executeQuery(beforeCount);
                   try{
                   Runtime.getRuntime().exec(" ");
              Runtime.getRuntime().exec(" ");
    catch (Exception proc1) {
    proc1.printStackTrace();
         rset2 = aCountRecords.executeQuery(afterCount);
    if(rset1.next()){
                   a = rset1.getInt("bcnt");
                   String aa = Integer.toString(a);
              display1(aa);
    if(rset2.next())
         b=rset2.getInt("acnt");
         while(true){
                   rset2 = aCountRecords.executeQuery(afterCount);
              if (rset2.next()){
                   b=rset2.getInt("acnt");
                        System.out.println(a);
                                            System.out.println(b);
    if(b==a)
         bb = Integer.toString(b);
         display2(bb);
         processbar(a,b);
         button.setVisible( false );
         JOptionPane.showMessageDialog(f,"Records Transfered Successfully");
         break;
    else if (a!=0)
    processbar(a,b);
    else {
         pbe.setVisible(false);
    JOptionPane.showMessageDialog(f,"No Records found to transfer");
    break;
         } catch (ClassNotFoundException proc) {
    // proc.printStackTrace();
              JOptionPane.showMessageDialog(procedure.this, "Error: "+proc.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    } catch (SQLException proc) {
    // proc.printStackTrace();
              JOptionPane.showMessageDialog(procedure.this, "Error: "+proc.toString(), "Warning", JOptionPane.WARNING_MESSAGE);
    // proc_reply.setBounds(240,310,150,20);
    // proc_reply.setVisible(true);
    public void display1(String count)
         tot_records.setBounds(350,250,180,20);
         tot_records.setVisible(true);
         value=new TextField(count);
         value.setBounds(550,250,180,20);
         value.setVisible(true);
         add(value);
         value.setEditable(false);
         public void display2(String count1)
    tot_aft_records.setBounds(350,450,180,20);
         tot_aft_records.setVisible(true);
         value1=new TextField(count1);
         value1.setBounds(550,450,180,20);
         value1.setVisible(true);
         add(value1);
         value1.setEditable(false);
    public void processbar(int a,int b)
    label1.setText( "Record " + b+ " of "+a );
    Rectangle labelRect = label1.getBounds();
    labelRect.x = 0;
    labelRect.y = 0;
    label1.paintImmediately( labelRect );
    progress.setValue( b*100/a );
                                  Rectangle progressRect = progress.getBounds();
    progressRect.x = 0;
    progressRect.y = 0;
                                  progress.paintImmediately( progressRect );
         DoBogusTask(b);
    public void DoBogusTask( int iCtr )
    random = new Random( iCtr );
    for( int iValue = 0; iValue < random.nextFloat() *1; iValue++ )
    public     class ProgressBarExample extends JFrame
    public ProgressBarExample()
                        setTitle( "" );
                        setLocation(450,300);
    setSize( 310, 130 );
         //setBackground( Color. );
    // setBackground(new Color(14672066));
    topPanel = new JPanel();
    topPanel.setPreferredSize( new Dimension( 310, 130 ) );
    getContentPane().add( topPanel);
    label1 = new JLabel( "Waiting to start tasks..." );
    label1.setPreferredSize( new Dimension( 280, 24 ) );
    topPanel.add( label1 );
    progress = new JProgressBar();
    progress.setPreferredSize( new Dimension( 300, 20 ) );
                        progress.setMinimum( 0 );
    progress.setMaximum(100 );
    progress.setValue( 0 );
    progress.setBounds( 20, 35, 260, 20 );
    topPanel.add( progress );
    button = new JButton( "Start Process" );
    topPanel.add( button );
                        button.setVisible(false);
    button.addActionListener( a );
         public class reportcall extends MyExample{
    public reportcall()
    report.setVisible(true);
         b1.removeActionListener(a);
         b2.removeActionListener(a);
         report.removeActionListener(a);
         b5.setVisible(false);
         b5.setBounds(40,440,120,20);
         b5.setVisible(true);
    vrs.setVisible(true);
         dtrs.setVisible(true);
    public class verification extends MyExample{
    public void verification1(){
         setTitle("");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
    vrs_fileno = new TextField("");
    vrs_fileno.setBounds(450, 180, 80, 20);
    add(vrs_fileno);
    vrs_fileno.setVisible(true);
         vrs_label1.setVisible(true);
         or.setBounds(450, 210, 80, 20);
         or.setVisible(true);
         vrs_fdate = new TextField("");
    vrs_fdate.setBounds(450, 230, 120, 20);
    add(vrs_fdate);
    vrs_fdate.setVisible(true);
         vrs_label2.setVisible(true);
         vrs_tdate = new TextField("");
    vrs_tdate.setBounds(650, 230, 120, 20);
    add(vrs_tdate);
    vrs_tdate.setVisible(true);
         vrs_label3.setVisible(true);
    dateformat.setVisible(false);
    dateformat.setBounds(780, 230, 120, 20);
    dateformat.setVisible(true);
         vrs_search.setVisible(false);
         vrs_search.setBounds(500,300, 80, 20);
         vrs_search.setVisible(true);
    public void ver_display(String fno,String fdate,String tdate){
    String FILE_NO1;
    String NAME1;
    String ADDRESS_TYPE1;
    String VER_STATUS1;
    int i1=0,b=0;
    Connection con1 = null;
    Statement stmt1 = null;
    try {
         Class.forName("oracle.jdbc.driver.OracleDriver");
    con1 = DriverManager.getConnection( "thin driver");
    stmt1 = con1.createStatement();
    String qry1 = "";
         String qry2 ="";
              ResultSet rs12 = stmt1.executeQuery(qry2);
                   if(rs12.next())
         b=rs12.getInt("cnt");
    if(b==0){
              JOptionPane.showMessageDialog(f,"No Records Found");}
                   else{
                        ResultSet rs11 = stmt1.executeQuery(qry1);
    while (rs11.next()) {
                   FILE_NO1 = rs11.getString(1);
    NAME1 = rs11.getString(2);
    ADDRESS_TYPE1 = rs11.getString(3);
    VER_STATUS1 = rs11.getString(4);
    show(FILE_NO1, NAME1, ADDRESS_TYPE1, VER_STATUS1, i1++);
    catch (ClassNotFoundException proc) {
    // proc.printStackTrace();
    catch (SQLException proc) {
    //proc.printStackTrace();
    public void show(String a, String b, String c, String d,int i) {
    Label fileno=new Label("File No");
    Label fname=new Label("Name");
    Label faddtype =new Label("Address Type");
    Label fstatus=new Label("Status");
         TextField fileno_result = new TextField(a);
    TextField fname_result = new TextField(b);
    TextField faddtype_result = new TextField(c);
    TextField fstatus_result = new TextField(d);
    fileno.setBounds(340, 180, 100, 20);
    add(fileno);
    fname.setBounds(440, 180, 130, 20);
    add(fname);
    faddtype.setBounds(575, 180, 120, 20);
    add(faddtype);
    fstatus.setBounds(700, 180, 90, 20);
    add(fstatus);
         fileno_result.setBounds(320, 200 + 20 * i, 100, 20);
    add(fileno_result);
    fileno_result.setVisible(true);
    fileno_result.setEditable(false);
    fname_result.setBounds(420, 200 + 20 * i, 150, 20);
    add(fname_result);
    fname_result.setVisible(true);
         fname_result.setEditable(false);
         faddtype_result.setBounds(570, 200 + 20 * i, 120, 20);
    add(faddtype_result);
    faddtype_result.setVisible(true);
         faddtype_result.setEditable(false);
    fstatus_result.setBounds(690, 200 + 20 * i, 120, 20);
    add(fstatus_result);
         fstatus_result.setVisible(true);
    fstatus_result.setEditable(false);
    public class datatransfer extends MyExample{
    public void datatransfer1(){
    setTitle("");
         icon = Toolkit.getDefaultToolkit().getImage("");
         setIconImage(icon);
    setVisible(true);
    dtrs_date = new TextField("");
    dtrs_date.setBounds(420, 180, 80, 20);
    add(dtrs_date);
         dateformat.setVisible(true);
    dtrs_date.setVisible(true);
         dtrs_search.setVisible(true);
         dtrs_label.setVisible(true);
    public void display(String date1){
    String FILE_NO;
    String DIST_CODE;
    String NAME;
    String DOB;
              String APPLN_DATE;
    int i1=0,b=0;
    Connection con1 = null;
    Statement stmt1 = null;
    try {
         Class.forName("oracle.jdbc.driver.OracleDriver");
    con1 = DriverManager.getConnection( "thin driver");
    stmt1 = con1.createStatement();
    String qry1 = "";
    String qry2 = "";
              ResultSet rs12 = stmt1.executeQuery(qry2);
                   if(rs12.next())
         b=rs12.getInt("cnt");
    if(b==0){
              JOptionPane.showMessageDialog(f,"No Records on this date");}
                   else{
                        ResultSet rs11 = stmt1.executeQuery(qry1);
    while (rs11.next()) {
                   FILE_NO = rs11.getString(1);
    DIST_CODE=rs11.getString(2);
                   NAME = rs11.getString(3);
    DOB = rs11.getString(4);
    APPLN_DATE = rs11.getString(5);
    show1(FILE_NO, DIST_CODE, NAME, DOB,APPLN_DATE,i1++);
    catch (ClassNotFoundException proc) {
    //proc.printStackTrace();
    catch (SQLException proc) {
    // proc.printStackTrace();
    public void show1(String a, String b, String c, String d,String e,int i) {
    fileno=new Label("File No");
    fdcode=new Label("District");
    fname =new Label("Name");
    fdob=new Label("Date Of Birth");
         fappdate=new Label("Application Date");
    TextField fileno_result = new TextField(a);
    TextField fdcode_result = new TextField(b);
    TextField fname_result = new TextField(c);
    TextField fdob_result = new TextField(d);
    TextField fappdate_result = new TextField(e);
    fileno.setBounds(323, 180, 80, 20);
    add(fileno);
    fdcode.setBounds(420, 180, 40, 20);
    add(fdcode);
    fname.setBounds(480, 180, 100, 20);
    add(fname);
    fdob.setBounds(590, 180, 120, 20);
    add(fdob);
    fappdate.setBounds(710, 180, 120, 20);
    add(fappdate);
         fileno_result.setBounds(320, 200 + 20 * i, 100, 20);
    add(fileno_result);
    fileno_result.setVisible(true);
    fileno_result.setEditable(false);
    fdcode_result.setBounds(420, 200 + 20 * i, 40, 20);
    add(fdcode_result);
    fdcode_result.setVisible(true);
         fdcode_result.setEditable(false);
         fname_result.setBounds(460, 200 + 20 * i, 120, 20);
    add(fname_result);
    fname_result.setVisible(true);
         fname_result.setEditable(false);
    fdob_result.setBounds(580, 200 + 20 * i, 120, 20);
    add(fdob_result);
         fdob_result.setVisible(true);
    fdob_result.setEditable(false);
    fappdate_result.setBounds(700, 200 + 20 * i, 120, 20);
    add(fappdate_result);
         fappdate_result.setVisible(true);
    fappdate_result.setEditable(false);
    public static void main(String[] args) {
    MyExample bpd = new MyExample();
    bpd.setVisible(true);
    }

    deleted - wrong forum, try the swing posting

  • Problem transferring old iPhone 3GS to new phone 5S using computer.  The iMac which I've been using to back up 3GS for years does not seem to recognize the 5S.  No setup assist is coming on screen so I can't begin the transfer.  Any ideas for this?

    Problem tranferring old iPhone 3GS (ios 6.1.6) to new iPhone 5S (ios 8.1.2) through iTunes on my iMac computer  (OSX 10.5.8) . I have backed up the 3GS this way since purchase of 3GS.  The computer does not seem to recognize the 5S is there -- no setup assist is appearing on screen. Any ideas welcome.

    this may not be your problem my according to the tech specs on apple.com the 5s requires:
    Syncing with iTunes on a Mac or PC requires:
    Mac: OS X v10.6.8 or later
    PC: Windows 8; Windows 7; Windows Vista; or Windows XP Home or Professional with Service Pack 3 or later
    iTunes 11.1 or later (free download

  • I bought my iphone 5 in Houston Texas May 15 2013 IMEI Nr. 013428009645399.The problem is that in the Greece the country which I live the 4G is not working.If you have any solution for this problem pls. let me know.My email is philcoueth@yahoo.gr Thank yo

    I bought my iphone 5 in Houston on May 15 2013.
    IMEI 013428009645399.The problem I have is that in the country
    which I live GREECE the 4G is
    not working.Please if you have any solution for this
    problem let me know.My email is [email protected]
    Thanking you in advance
    Philip Couridis

    iPhones purchased in the US are NOT guaranteed to work with 4G bands outside of North America.
    For what crazy reason did you purchase an iPhone in the US if you live in Greece?  If your phone needs servicing, it will have to be brought back to the US.  You cannot get that phone serviced in Greece.

  • Need Ideas for This Puzzle

    The puzzle relates to displaying check boxes (checkbox or multibox).
    What I have are members who belong to professional groups and sub-groups. E.g.,
    Group A with sub-groups A-1, A-2, A-3, A-4.
    Group B with sub-groups B-1, B-2, B-3
    Group C with sub-groups C-1, C-2, C-3, C-4, C-5, C-6
    etc.
    web site users make multiple selections among groups. And all members in those groups will receive an e-mail message.
    I can display a check box for every single "sub-group". And give each "group" a "select all" check box. All I have to take care are the checked "sub-groups".
    The challege comes as the "roles" of the web site users are introduced. According to the role of the web site user, I have to display certain groups (not all the groups) and certain sub-groups (not all sub-groups within a group) to him/her.
    How do I disply groups and their sub-groups under such a condition?

    well, presuming you still need all values..., something along these lines
    <%
    boolean checked = isChecked("a"); // check if the value should be checked by default
    if(showCheckbox(user, "a")) { // check if, for this user, the checkbox should be visible
    %>
    <input type="checkbox" name="a" value="a" <%= checked ?"checked":"" %>>
    <%
    } else { // show disabled checkbox (or leave that out to show nothing...)
    %>
    <input type="checkbox" name="noname" <%= checked ? "checked" : "" %> disabled="diabled" />
    <%
       if(checked) { // don't need hidden value if default is unchecked
    %>
    <input type="hidden" name="a" value="a">
    <%
    %>

  • Ideas for making code faster?

    OK, I'm tryig to make a random move generator for a chess game. I want the move to be legit. It's kind of a first step to making an AI I guess. It works but unfortunately it brings my system to it's knees, and my system is pretty good. Here's the generator, any help would be appreciated.
    Basically it makes a very large Vector of objects that contain all of the valid moves, then picks one at random.
    import java.util.Vector;
    public class MoveGenerator
         int team, currentX, currentY, r;
         int[] randomMove = new int[4];
         Vector TeamMoves = new Vector();
         // Creates a new MoveGenerator which will play for team tm
         public MoveGenerator(int tm){
              team = tm;
         // Gets all the possible moves for a team during at a given time and places
         // each move into Vector TeamMoves
         public Vector getTeamMoves(){          
              for (int row = 0; row < 8; row++){
                   for (int col = 0; col < 8; col++){
                        // Gets the valid moves for each piece
                        if (ChessBoard.cbLayout[col][row] != null){                         
                             if (ChessBoard.cbLayout[col][row].getTeam() == team){
                                  //set currentX/Y to position of each piece
                                  currentX = ChessBoard.cbLayout[col][row].getPosition()[0];
                                  currentY = ChessBoard.cbLayout[col][row].getPosition()[1];
                                  // Goes through and checks if each square is a valid move
                                  // for this piece and if it is adds it to TeamMoves
                                  for (int y = 0; y < 8; y++){
                                       for (int x = 0; x < 8; x++){                                   
                                            if (ChessBoard.cbLayout[col][row].getValidMoves()[x][y]){
                                                 TeamMoves.addElement(new MoveValues(currentX, currentY, x, y));
              return TeamMoves;
         // Sets new random number
         public int renewSeed()
              r = (int) (Math.random() * getTeamMoves().size());
              return r;
         // Will choose one of the valid moves at random
         public int[] getMove(){          
              System.out.println(r);
              randomMove[0] = ((MoveValues)(getTeamMoves().elementAt(r))).getMoveValues()[0];
              randomMove[1] = ((MoveValues)(getTeamMoves().elementAt(r))).getMoveValues()[1];
              randomMove[2] = ((MoveValues)(getTeamMoves().elementAt(r))).getMoveValues()[2];
              randomMove[3] = ((MoveValues)(getTeamMoves().elementAt(r))).getMoveValues()[3];          
              return randomMove;
         // Used to store movement info, all possible moves are then added to
         // Vector TeamMoves. Of which one will be chosen at random.
         class MoveValues
              int fromX, fromY, toX, toY;
              int[] moveArray = new int[4];
              // Sets up an obfject storing the values for a move
              public MoveValues(int x1, int y1, int x2, int y2){
                   fromX = x1;
                   fromY = y1;
                   toX = x2;
                   toY = y2;
              // Retrieves the values of the move in this object
              public int[] getMoveValues(){
                   moveArray[0] = fromX;
                   moveArray[1] = fromY;
                   moveArray[2] = toX;
                   moveArray[3] = toY;
                   return moveArray;
    }

    Here's a really quick stab at some really simple optimizations...
    public Vector getTeamMoves(){
    List     listMoves = new ArrayList();          // OPTIMIZE -- use ArrayList instead of Vector
              for (int row = 0; row < 8; row++){
                   for (int col = 0; col < 8; col++){
                        // Gets the valid moves for each piece
                   ?ChessBoardLayout? layout = ChessBoard.cbLayout[col][row]; // OPTIMIZE - dereference object once
                        if (layout != null){                         
                             if (layout.getTeam() == team){
                                  //set currentX/Y to position of each piece
                                  int moves[] = layout.getPosition(); // OPTIMIZE- Call method ONCE
                                  currentX = moves[0];
                                  currentY = moves[1];
                                  // Goes through and checks if each square is a valid move
                                  // for this piece and if it is adds it to TeamMoves
                                  int validMoves[][] = layout.getValidMoves(); // OPTIMIZE- Move method call outside loops
                                  for (int y = 0; y < 8; y++){
                                       for (int x = 0; x < 8; x++){                                   
                                            if (validMoves[x][y]){
                                                 listMoves.add(new MoveValues(currentX, currentY, x, y));
              return new Vector(listMoves);
         }

  • Gava SE 1.0, a Java IDE for international code,  released,

    Please go to check http://www.gavasoft.com for more information
    Gava is a Java Integrated Development Environment (IDE), built in pure Java, to develop Java applications and applets. Most part of Gava is developed in Gava itself. As a pure Java application, Gava can run on both Windows and Unix/Linux platforms. It requires JRE 1.4 to execute, but it can debug JDK1.2, 1.3, and 1.4.
    Intuitive, fast, and powerful. Gava is a fast IDE built with many unique and well-thought-out optimizations. Gava users will enjoy a smooth coding feeling throughout the development phases - fast start-up, fast code completion, fast compiling, etc. With a relatively simple but intuitive GUI, Gava provides users powerful functionalities. It suits the needs of all developers, from entry-level to advanced.
    Internationalization. Gava is an IDE designed for developing international Java applications. First, Gava itself is a multilingual Java application. Developers can set Gava to any language, no matter what OS (localized or English version) it is running on. Second, Gava provides many functionalities and tools to easily develop multilingual applications, with either localization or internationalization technologies.
    Write once, develop anywhere. With Gava, you can not only run your projects on multi-platforms, you can also develop your projects on multi-platforms. Gava implements an OS-independent project management architecture. Based on this architecture and other special features in Gava, developers can easily port Gava's projects to different platforms, file systems, or file directories.
    Multiple debugging sessions. Gava can debug multiple debuggees within the same running instance of Gava. This feature makes Client Server debugging much easier, Gava users don't have to switch between running applications.
    Customizable. Gava is configurable. Gava users can customize the GUI look and feel with their favorable fonts and colors to create a work environment suitable for different occasions, either for demonstration or development.
    Now Gava SE 1.0 is available for download. We would appreciate any and all feedback regarding the product. You may download a fully funtional 30 days trial version from our download page, and try it to see how you like it. Thank you.

    As if we don't have enough IDE's already??? And what's this?
    ...Most part of Gava is developed in Gava itself...Huh? is Gava a language too? Like we need yet another language?

  • Any ideas for this Swing application

    i was asked to make a desktop application that takes use-cases as an input and the output should be a generated use-case diagram. the problem is that iam confused how to generate the use-case diagram using swing and awt. so if u have any ideas, it would be appreciated.
    thanks in advance.

    from the google images of what a "use case diagram" is,
    this looks like a perfect job for NetBeans' Visual Library: [http://graph.netbeans.org/|http://graph.netbeans.org/]
    this is a great video on the topic: [netbeans rcp video|http://www.parleys.com/display/PARLEYS/blueMarine?showComments=true]

Maybe you are looking for

  • Query caching at specific time of day ?

    I'm currently using: cachedwithin=#CreateTimeSpan(1,0,0,0)# If I'm happy my data won't change during the day, is it possible to cache a query at a pre-determined time, eg. during the early hours when I know it's unlikely anyone is on the site, say 5a

  • After effects and premier render farm

    Hey Im working on a Mac Pro mid2010 and Mac pro Late 2013. I want to know if and how can I work on one of them but when I render or creating ram previews make them "work together" ? like a render farm ... Thanks

  • Safari start up

    Suddenly I find that when I switch on the computer in the morning it starts up Safari as well. I am concerned that this gives an external access to others. How can I make Safari wait until I wish to connect while still being able to start the compute

  • Problem printing custom size document

    I am trying to print a custom size document (4.4"x7.2") that I created in Microsoft Word.  I have set the Page size in Word, tried to create a custom size page in my Printer, and am unable to select this paper size in the properties of my printer (us

  • Clarification on purchase invoice (F-43) via APP

    Dear All, Need clarification on clearing purchase invoice (F-43) via APP. I have post two purchase invoice (F-43) one is by updating payment terms and with out updating payment terms,while doing APP i was not able to view invoice which i have process