Why my JInternalFrame show two times?

/* I want to Draw a cycle on JPanel in JInternalFrame, but it Draw two times, and when I klick the JInternalFrame, it will show right.
There are two Class, one ist TestDrawingJPanel, another ist DrawingJPanel.
import java.awt.*;
public class TestDrawingJPanel extends javax.swing.JFrame {
/** Creates new form TestDrawingJPanel */
public TestDrawingJPanel() {
initComponents();
DrawingJPanel drawingJPanel=new DrawingJPanel();
jInternalFrame1.getContentPane().add(drawingJPanel,java.awt.BorderLayout.CENTER);
drawingJPanel.start();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
jInternalFrame1 = new javax.swing.JInternalFrame();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
jInternalFrame1.setBackground(java.awt.Color.white);
jInternalFrame1.setPreferredSize(new java.awt.Dimension(300, 260));
try {
jInternalFrame1.setSelected(true);
} catch (java.beans.PropertyVetoException e1) {
e1.printStackTrace();
jInternalFrame1.setVisible(true);
getContentPane().add(jInternalFrame1, java.awt.BorderLayout.CENTER);
pack();
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
* @param args the command line arguments
public static void main(String args[]) {
new TestDrawingJPanel().show();
// Variables declaration - do not modify
private javax.swing.JInternalFrame jInternalFrame1;
// End of variables declaration
import java.awt.*;
public class DrawingJPanel extends javax.swing.JPanel implements Runnable {
/** Creates a new instance of DrawingJPanel */
Graphics g;
Thread thisThread;
public void start(){
thisThread=new Thread(this);
thisThread.start();
public void paint(Graphics g){
g.setColor(Color.black);
g.drawArc((this.getWidth()/2)-100,(this.getHeight()/2)-100,200,200,0,360);
public void run() {
try{
thisThread.sleep(100);
}catch(Exception e){};
repaint();

Q1
2 internalframes
ANS
remove any one of these
jInternalFrame1.setVisible(true);
new TestDrawingJPanel().show();

Similar Messages

  • Why JRC executes query two times? (reports.queryengine(?:?) - Executing query: ...)

    Hello! Using JRC. While creating the report for viewing, I noticed one interesting thing. Why JRC executes query two times AND first time is executed with default parameters AND if default parameters are NULL the query can be invalid (even if it is marked to convert all database NULLs to defaults in Report Options).
    <!break>
    1. Why do you need to execute query the first time with these default parameters, which are later set to the others? We need to make some valid default parameters to make everything work. Also it is not efficient to execute unnecessary query.
    2. If I'm wrong could you explain please? If I'm right, is it a bug and when do you fix it?
    Waiting for answer,
    Anton Stalnuhhin
    Java-developer, Webmedia AS

    .

  • Why my mac shows year time as R.O.C.101?

    why my mac shows year time as R.O.C.101?

    why my mac shows year time as R.O.C.101?

  • While exporting the Report to Excel Records are showing two times

    Hello Gurus
    When im trying to export a report from NW Portal to Excel,  data is showing double times, even variable selections screen, records are  showing two tmes.
    What would be the problem, does we need any SP.
    Thanks in advance.
    Regd
    Lajwanth

    GURU'S ANY REPLIES........

  • Show two time zones, show two time zones

    is there a way to show two zimes ones up on the top bar, instead of just the one. or at least hover over it like Windows and see a second time zone of your choice?

    You can set up multiple clock widgets in Dashboard.

  • Why windowClosing is called two times?

    Hi,
    I'm saving my project in JFrame windowClosing event. But it is called two times...
    How to prevent it?
    this.addWindowListener(new java.awt.event.WindowAdapter() {
         public void windowClosing(java.awt.event.WindowEvent e) {
         saveCurrentProject();
    Thanks,
    Andr�

    Thanks, problem solved.
    this.addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent e) {
    saveCurrentProject();
    System.exit(0); // <-- new line
    Andre

  • Why do I have two time zones in my calendar?

    With a recent move to a new time zone I now have two time zone in my calendar.  My area code is in a central time zone but have moved to the east coast.
    I have checked my icloud calendar, iPhone settings and each is set to eastern time.

    Hi beachbouy,
    If you need to change the time zone for your calendars in iCloud, use the steps in this article -
    iCloud: Change your calendar’s time zone
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • TS1347 on my calander (iphone4) on march 2014 i have the 27th showing two times. why is that ?

    on my calendar, march 27th shows twice ... why ?

    It's a special leap year.
    Try resetting the device.

  • Alerts for events showing two time zones? Alerts happening at odd times.

    I just set a new event for later today using the calender app. I set two alerts, one for 30 mins before, and one for 15 minutes before. It is currently TWO hours until the appointment, but my phone just gave me the alert saying "*event name* in 30 minues (6:30, 5:30 ADT)"
    Why is my phone suddently telling me when my events are happening in ADT? (That means Atlantic Daylight Time... I think!) And why is it giving me the alert 2 hours before, rather than the set 30 mins?
    Message was edited by: Sarah CMac

    It just happened again! I wrote down exactly what it said.
    the current time is 5:00
    the message said:
    " Table Viewers
    Today at 5:30pm (6:30pm ADT)"
    The event is set to happen at 6:30.
    What the heck is going on??
    (Table Viewers: I am selling a table set. People are coming to view it)

  • Why the data inserted two times into the DB?

    Hai all,
    When I press the submit button in my form the data will be inserted two timesinto DB. Please help me.
    import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.vguss.bean.RegisterInfoBean; import com.vguss.helper.Out; public class InsertRegInfo { public static Connection connection = DBConnection.getDBConnection(); public static void insertRegData(RegisterInfoBean bean) { Connection connection = DBConnection.getDBConnection(); String loginID = bean.getLoginId(); try { PreparedStatement pst = connection .prepareStatement("SELECT login_id FROM login_details WHERE login_id = ?"); pst.setString(1, loginID); ResultSet set = pst.executeQuery(); if (!set.next()) { insertData(bean); } } catch (SQLException e1) { e1.printStackTrace(); } } private static void insertData(RegisterInfoBean bean) { try { PreparedStatement ps = connection .prepareStatement("INSERT INTO login_details (login_id, password, profile_created_by, security_question, answer, full_name, receive_sms, show_details, agree_terms, register_on) VALUES (?,?,?,?,?,?,?,?,?,now())"); ps.setString(1, bean.getLoginId()); ps.setString(2, bean.getPassword()); ps.setString(3, bean.getProf_created_by()); ps.setString(4, bean.getSecurity_Question()); ps.setString(5, bean.getAnswer()); ps.setString(6, bean.getFullName()); ps.setString(7, bean.getLikeSMS()); ps.setString(8, bean.getShowDetails()); ps.setString(9, bean.getAgreeToTerms()); ps.executeUpdate(); PreparedStatement pstmt = connection .prepareStatement("INSERT INTO user_profile (login_id, gender, email, date_of_birth) VALUES (?, ?, ?, ?)"); pstmt.setString(1, bean.getLoginId()); pstmt.setString(2, bean.getGender()); pstmt.setString(3, bean.getEmailID()); pstmt.setString(4, bean.getDateOfBirth()); pstmt.executeUpdate(); /* insert login id to preferred_partner table */ PreparedStatement pStmt = connection .prepareStatement("INSERT INTO preferred_partner (login_id) VALUES(?)"); pStmt.setString(1, bean.getLoginId()); pStmt.executeUpdate(); } catch (SQLException e) { Out.err(e); } } }

    The most obvious thought is that you have a duplicate login id.
    You're trying, but I would not consider this to be well written code, for these reasons:
    1. You don't close any JDBC resources in finally blocks - no connections, no statements, no result sets. Search the forum for people with "max open cursors exceeded" to see why this is a bad idea.
    2. You create a static Connection in this class, but nobody closes it. Classes that execute SQL should not be responsible for obtaining connections; a Connection should be provided to them. Transactions are the reason: a class executing SQL can't know if it's involved in a unit of work with other classes. Somebody who knows the use case and the transaction boundaries ought to be getting the Connection, handling commit/rollback, and closing the Connection.
    3. Refactor that INSERT into three methods. You'll be glad you did someday.
    4. Your INSERT method looks like it's doing a security check, too. Isn't it a little late for that? If you must, move that code into a separate method that returns a boolean. A well-designed method does one thing well. Yours is doing two.
    5. The common JDBC idiom isn't "if (!set.next())", it's "while (set.next())". It's good to use common idioms, because it makes it easier for other people to understand your code.
    But see if you have a repeated login ID.
    And step through in a debugger to see what's going on.
    %

  • Why does Vista shows two different processors on my SP A200?

    Hi everyone.
    Im new here but have a very important question about my new laptop that I just bought. Ok here goes if anyone can help?
    Just bought my new Satellite Pro A200GE-26Q Intel centrino core 2 duo t7500 2.2ghz laptop that came with 2GB of RAM that Ive already upgraded to 4GB of RAM straight away and wow this is such a nice machine tosh build great laptops!!!
    The problem Ive got is that when I go into device manager and to the processor link it shows both processors one a T7300 @2.0ghz and one T7500 @2.2ghz... now I know the speed can be slowed down due to power saving etc but surely it should show BOTH processers the SAME ie [email protected] and [email protected] instead of the above T7300 @2.0ghz.
    Have I been sold a laptop with wrong/different processors in? perhaps by mistake and one other thing is the RAM shows 3070MB (3GB) and I know some systems use the rest but I thought vista premium home was meant to show it all... I do know upgrading to vista x64 will make better use of it but as Ive read on lots of forums when you run on x64 you get lots of driver problems and the hassle is not worth it. So please help me sort out this processor problem.
    Do I have a matched pair? Thanks again.
    Newbie Paul

    thanks for your reply and i do understand about the ram but i am unable to find anything about the two different processors... pls help or could you send me a link to where this is answered pls..?? or email me it..?? [email protected]
    thanks again
    paul

  • Does anybody know why I can see two times on my lock screen? The right time then a wrong one in the background behind it?

    Can anyone help please?

    The only thing behind my lock screen clock is my lock screen wall-paper. Do you have a different wall-paper set for your lock screen than what you have set for your home screen?

  • When i type the https URL in my FireFox browser version 3.6 to 5.0, i get login pop up window two times. But in IE browser i get only once. Please tell me why FireFox is showing pop up screen two times to enter my uid/pwd. Thanks!

    We have our company internal application which is protected by SiteMinder. When we type https://appname.domain.com in IE i get popup window asking me to enter uid/pwd and works fine. However same URL when i login in FireFox, i get pop up window two times. So i wonder why FF is asking two times instead of just only once.
    Thanks for your help.

    Do you have that problem when running in the Firefox SafeMode?
    [http://support.mozilla.com/en-US/kb/Safe+Mode]
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this:
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • 'dbms_xplan.display_awr' is showing two plan for single query

    Hi,
    I am trying to fetch sql plan from awr, but it's showing two different plans for a single query:
    PLAN_TABLE_OUTPUT
    SQL_ID 2pxv33cr271sb
    SELECT P_DEP_BNK_CODE,P_DEP_BRN_CODE,P_DEP_DATE,
                                   P_DEP_DAY_SL,P_DEP_INST_SL,P_INST_AMT                                       
                             FROM P WHERE
                                        P_DEP_BNK_CODE = :1 AND
                                    P_DEP_BRN_CODE = :2 AND
                                P_DEP_DATE     = :3 AND
                            P_DEP_LCC_UCC  = :4 AND
                        P_DEP_DAY_SL   = :5 AND
                    (P_REALISED_ON IS NULL AND
                    P_RTN_DATE IS NULL)
    Plan hash value: 3064382432
    | Id  | Operation                          | Name      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                   |           |       |       |     5 (100)|          |       |       |
    |   1 |  TABLE ACCESS BY GLOBAL INDEX ROWID| P         |     1 |    40 |     5   (0)| 00:00:01 | ROWID | ROWID |
    |   2 |   INDEX RANGE SCAN                 | P_PK      |     1 |       |     4   (0)| 00:00:01 |       |       |
    Note
       - dynamic sampling used for this statement (level=5)
    SQL_ID 2pxv33cr271sb
    SELECT P_DEP_BNK_CODE,P_DEP_BRN_CODE,P_DEP_DATE,
                                   P_DEP_DAY_SL,P_DEP_INST_SL,P_INST_AMT                                       
                             FROM P WHERE
                                        P_DEP_BNK_CODE = :1 AND
                                    P_DEP_BRN_CODE = :2 AND
                                P_DEP_DATE     = :3 AND
                            P_DEP_LCC_UCC  = :4 AND
                        P_DEP_DAY_SL   = :5 AND
                    (P_REALISED_ON IS NULL AND
                    P_RTN_DATE IS NULL)
    Plan hash value: 3447007225
    | Id  | Operation            | Name     | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT     |          |       |       |     7 (100)|          |       |       |        |      |            |
    |   1 |  PX COORDINATOR      |          |       |       |            |          |       |       |        |      |            |
    |   2 |   PX SEND QC (RANDOM)| :TQ10000 |     1 |    38 |     7  (43)| 00:00:01 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    PX BLOCK ITERATOR |          |     1 |    38 |     7  (43)| 00:00:01 |   KEY |   KEY |  Q1,00 | PCWC |            |
    |   4 |     TABLE ACCESS FULL| P        |     1 |    38 |     7  (43)| 00:00:01 |   KEY |   KEY |  Q1,00 | PCWP |            |
    ------------------------------------------------------------------------------------------------------------------------------The database version is 11.2.0.1 and the underlying table is partitioned. Why this is showing two plans? Although the plan doesn't look expensive but this is causing maximum gets and enq: row lock contention
    Regards,
    Regards

    SQL> set autot on
    SQL> SELECT
      2  SUM(NVL(P_INST_AMT, 0))
      3  FROM
      4  AXISCMS.P
      5  WHERE
      6  P_DEP_BNK_CODE = '211'
      7  AND
      8  P_DEP_BRN_CODE = '005'
      9  AND
    10  P_DEP_DATE = to_date('11-NOV-2010')
    11  AND
    12  P_DEP_LCC_UCC = 'L'
    13  AND
    P_DEP_DAY_SL = 15001
    14   15  AND
    16  (P_REALISED_ON IS NOT NULL OR P_RTN_DATE IS NOT NULL );
    SUM(NVL(P_INST_AMT,0))
    Execution Plan
    | Id  | Operation                           | Name      | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                    |           |     1 |    38 |     8 |       |       |
    |   1 |  SORT AGGREGATE                     |           |     1 |    38 |       |       |       |
    |   2 |   TABLE ACCESS BY GLOBAL INDEX ROWID| P          |     1 |    38 |     8 |    72 |    72 |
    |   3 |    INDEX RANGE SCAN                 | P_PK      |     1 |       |     4 |       |       |
    Note
       - 'PLAN_TABLE' is old version
    Statistics
              5  recursive calls
              0  db block gets
            370  consistent gets
             31  physical reads
              0  redo size
            543  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedThe above query seems to be having cheapest cost but causing a lot of slowness in the database.
    Column Description:
    COLUMN_NAME                    DATA_TYPE                      NUM_DISTINCT  NUM_NULLS    DENSITY HISTOGRAM
    P_AC_NAME                 VARCHAR2                             244672   49251591 4.0871E-06 NONE
    P_AC_NO                   VARCHAR2                             413792   48713721 2.4167E-06 NONE
    P_ARNGMNT_CREDIT_DATE     DATE                                   1708   39366743 .001724138 HEIGHT BALANCED
    P_AUTOLIQ_ACT_DATE        DATE                                    358   50356077 .003003003 HEIGHT BALANCED
    P_AUTOLIQ_DUE_DATE        DATE                                    337   50427426 .002967359 NONE
    P_AUTOLIQ_FLAG            CHAR                                      1   44746714          1 NONE
    P_CLG_DNLD_FLAG           NUMBER                                    1   50481119 .035714286 FREQUENCY
    P_CORR_BANK_REAL_DATE     DATE                                      0   50481133          0 NONE
    P_DEP_BNK_CODE            VARCHAR2                                 16          0 9.9454E-09 FREQUENCY
    P_DEP_BRN_CODE            VARCHAR2                                671          0 .002531646 HEIGHT BALANCEDIndex Details
    INDEX_NAME                     COLUMN_NAME                    COLUMN_POSITION
        P_IDX_FULL                P_INST_NO                               1
        P_IDX_FULL                P_DRAWN_ON_BANK                         2
        P_IDX_FULL                P_DRAWN_ON_BRN                          3
        P_IDX_FULL                P_INST_TYPE                             4
        P_IDX_FULL                P_DRAWN_ON_LOC                          5
        P_IDX_FULL                P_RTN_DATE                              6
        P_INDX1                   P_INST_NO                               1
        P_INDX2                   P_RTN_DATE                              1
        P_INDX2                   P_RTN_DAY_SL                            2
        P_INDX2                   P_RTN_INS_SL                            3
        P_INDX3                   P_REALISED_ON                           1
        P_INDX3                   P_REALISED_DAY_SL                       2
        P_INDX3                   P_REALISED_INS_SL                       3
        P_INDX4                   P_REV_TO_COL_DUE_DATE                   1
        P_INDX4                   P_REV_TO_COL_DONE_ON                    2
        P_INDX5                   P_ARNGMNT_CREDIT_DATE                   1
        P_INDX6                   P_POOL_POST_DATE                        1
        P_INDX6                   P_POOL_POST_DAYSL                       2
        P_PK                      P_DEP_BNK_CODE                          1
        P_PK                      P_DEP_BRN_CODE                          2
        P_PK                      P_DEP_DATE                              3
        P_PK                      P_DEP_LCC_UCC                           4
        P_PK                      P_DEP_DAY_SL                            5
        P_PK                      P_DEP_INST_SL                           6
    Top 5 Timed Foreground Events
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                               Avg
                                                              wait   % DB
    Event                                 Waits     Time(s)   (ms)   time Wait Class
    DB CPU                                           58,454          13.1
    enq: TX - row lock contention         1,095      17,691  16156    4.0 Applicatio
    read by other session             1,719,661      11,392      7    2.6 User I/O
    latch: cache buffers chains         264,753      10,758     41    2.4 Concurrenc
    latch free                           78,456       8,215    105    1.8 Other
    The query comes on top in every section in AWR.Regards,

  • SAP Script need to display main window two times on single page.

    Hello Guru's,
    So here is my requirement, we need to print check. We are using F110_PRENUM_CHCK and linked with driver prog RFFOUS_C. We have Letter size paper with three sections,
    1. Check
    2. Voucher Section (containing table of element 515, 525 and 530) 515: Heading, 525 : Regup-Belnr, Regup-XBLNR, Regud-Wrbtr.
                                                                                    530: Regup-SGTXT
    3. Voucher Section (As a receipt for bank itself) : contains same data as 2nd section.
    I tried several things reading all the previous post over here in SDN.
    1. Created Z form created two instances of main window it results just single display of table (voucher section) in section two and not in third.
    2. I also tried pasting two times same code in single main window which gives only last item line for the table.
    3. Created z driver program made changes in Write_form added control form for element 515 that does results in showing element 515 on both the location.
                CALL FUNCTION 'CONTROL_FORM'
                  EXPORTING
                    command   = 'NEW-WINDOW'
                  EXCEPTIONS
                    unopened  = 1
                    unstarted = 2
                    OTHERS    = 3.
                CALL FUNCTION 'WRITE_FORM'
                  EXPORTING
                    element = '515'
                  EXCEPTIONS
                    window  = 1
                    element = 2.
    3. For Element 525 and element 530 is not acting same. In the prog 525 = hlp_ep_element. And there are many write_form for this. I tried pasting each and every place same kind of code. It doesnt work. what it do it gives me three pages of output repeating every thing twice and weirdly.
    I am need this to be done as I already took so much time solving nothing is working.
    Please give me the exact location where to paste this code so I can have two times data of main window.
    Or is there any other way to do this....Any way will be good for me as long as it shows two times data in the form.
    The data is table.

    Hi Manju,
    I create a new window (no main) but does not run, please can you tell me what should I do to make it work.
    Best regards.
    Robert.

Maybe you are looking for

  • IPod Universal Updater has encountered a problem and needs to close.

    My daughter dropped her mini yesterday. After resetting I get the file folder with exclamation. So I was going to the next step to try to restore. When I start the updater, I get the message "iPod Universal Updater has encountered a problem and needs

  • Playlist items are greyed out

    I have synced my ipod to itunes. When i play it thru my auto audio system the playlist are greyed out and don't play. Any helpp is appreciated, Frank

  • Safari not connected to internet

    Hi! I have a usb modem to connect to internet with my iMac and MacBook Pro. Since yesterday no problem; but yesterday morning the iMac never connects to the internet while no problem with MacBookPro. As usually i execute the software to connect, it s

  • Since upgrading to OS 10.10, photos are mot being sent.

    After upgrading my late 2013 iMac to OS X 10.10, I have problems with sending messages with photos.  They show before sending the message but after they are sent the receiver and the sent file gets a square with a ? where the image should be.  I have

  • HELP : Productive system down

    Hello Our Productive server suddenly stopped functionning. In Management Console the Disp+Work was jellow in status"running but Dialog Queue standstil" What should I look at? Thank you very much in advance