Repaint Problem in JInternalFrame!!!! help plz.

hi,
I have a question I have an application that has internal frames, Basically it is a MDI Application. I am using JDK 1.2.2 and windows 2000. The following example shows that when I drag my JInternalFrames only the border is shown and the contents are not shown as being dragged that's fine, but the application I am running have lot of components in my JInternalFrames. And when I drag the JInternalFrame my contents are not being dragged and that's what I want but when I let go the internalFrame it takes time to repaint all the components in the internalFrame. Is there any way I can make the repaint goes faster after I am done dragging the internalFrame. It takes lot of time to bring up the internalframe and it's components at a new location after dragging. Is there a way to speed up the repainting. The following example just shows how the outline border is shown when you drag the internalFrame. As there are not enough components in the internal frame so shows up quickly. But when there are lots of components specially gif images inside the internalframe it takes time.
/*************** MDITest ************/
import javax.swing.*;
* An application that displays a frame that
* contains internal frames in an MDI type
* interface.
* @author Mike Foley
public class MDITest extends Object {
* Application entry point.
* Create the frame, and display it.
* @param args Command line parameter. Not used.
public static void main( String args[] ) {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
} catch( Exception ex ) {
System.err.println( "Exception: " +
ex.getLocalizedMessage() );
JFrame frame = new MDIFrame( "MDI Test" );
frame.pack();
frame.setVisible( true );
} // main
} // MDITest
/*********** MDIFrame.java ************/
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
* A top-level frame. The frame configures itself
* with a JDesktopPane in its content pane.
* @author Mike Foley
public class MDIFrame extends JFrame implements Serializable {
* The desktop pane in our content pane.
private JDesktopPane desktopPane;
* MDIFrame, null constructor.
public MDIFrame() {
this( null );
* MDIFrame, constructor.
* @param title The title for the frame.
public MDIFrame( String title ) {
super( title );
* Customize the frame for our application.
protected void frameInit() {
// Let the super create the panes.
super.frameInit();
JMenuBar menuBar = createMenu();
setJMenuBar( menuBar );
JToolBar toolBar = createToolBar();
Container content = getContentPane();
content.add( toolBar, BorderLayout.NORTH );
desktopPane = new JDesktopPane();
desktopPane.putClientProperty("JDesktopPane.dragMode", "outline");
desktopPane.setPreferredSize( new Dimension( 400, 300 ) );
content.add( desktopPane, BorderLayout.CENTER );
} // frameInit
* Create the menu for the frame.
* <p>
* @return The menu for the frame.
protected JMenuBar createMenu() {
JMenuBar menuBar = new JMenuBar();
JMenu file = new JMenu( "File" );
file.setMnemonic( KeyEvent.VK_F );
JMenuItem item;
file.add( new NewInternalFrameAction() );
// file.add( new ExitAction() );
menuBar.add( file );
return( menuBar );
} // createMenuBar
* Create the toolbar for this frame.
* <p>
* @return The newly created toolbar.
protected JToolBar createToolBar() {
final JToolBar toolBar = new JToolBar();
toolBar.setFloatable( false );
toolBar.add( new NewInternalFrameAction() );
// toolBar.add( new ExitAction() );
return( toolBar );
* Create an internal frame.
* A JLabel is added to its content pane for an example
* of content in the internal frame. However, any
* JComponent may be used for content.
* <p>
* @return The newly created internal frame.
public JInternalFrame createInternalFrame() {
JInternalFrame internalFrame =
new JInternalFrame( "Internal JLabel" );
internalFrame.getContentPane().add(
new JLabel( "Internal Frame Content" ) );
internalFrame.setResizable( true );
internalFrame.setClosable( true );
internalFrame.setIconifiable( true );
internalFrame.setMaximizable( true );
internalFrame.pack();
return( internalFrame );
* An Action that creates a new internal frame and
* adds it to this frame's desktop pane.
public class NewInternalFrameAction extends AbstractAction {
* NewInternalFrameAction, constructor.
* Set the name and icon for this action.
public NewInternalFrameAction() {
super( "New", new ImageIcon( "new.gif" ) );
* Perform the action, create an internal frame and
* add it to the desktop pane.
* <p>
* @param e The event causing us to be called.
public void actionPerformed( ActionEvent e ) {
JInternalFrame internalFrame = createInternalFrame();
desktopPane.add( internalFrame,
JLayeredPane.DEFAULT_LAYER );
} // NewInternalFrameAction
} // MDIFrame
I'll really appreciate for any help.
Thank you

Hi
if you fill the ranges
r_rundate-sign = 'I'.
r_rundate-option = 'EQ'.
r_rundate-low = '20080613'.
r_rundate-high = '20080613'.
APPEND r_rundate.
EQ = 'equal', the select check the record with data EQ r_rundate-low.
change EQ with BT  
BT = between
r_rundate-sign = 'I'.
r_rundate-option = 'BT'.
r_rundate-low = '20080613'.
r_rundate-high = '20080613'.
APPEND r_rundate.
reward if useful, bye

Similar Messages

  • Problem with printing help plz

    Hi Folks,
    Got a problem with printing hope you can help. I have just got back from an online printers some 40 prints. There is a big difference between the brightness of the print (it being a lot darker) and the elements screen. The company I used comes highly reccomended by many different sources. What am I doing wrong and how do I fix?
    Thanks

    which online service provider are you using?

  • Not enough memory problem nokia 2700 help plz

    I have nokia 2700c and today i updated using pc suite to the latest v09.98
    i had an error telling Not enough memory  when im playing music or video or fm..
    i updated and also did twice even i made restore but still problem is same..
    how to recover from this problem?
    few days ago by mistake user certificate was deleted//
    how I recover my deleted certificates?
    Can this bcm an occur for this issues?
    Attachments:
    Photo0189.jpg ‏9 KB

    hi mate,
    have you tried re-installing your current firmware? if you are still receiving errors, then you will need to take your phone to your local Nokia care for inspection: http://nokia.com/support
    Only do this after you have checked that you have moved all possible files to a PC or external memory card on the device.

  • Hello. I have problem here can someone plz help. I have usb of 32 gb but i have problem with it while i was trying to partition of it and it fails and my usb disappear from finder and desktop i have tried every possible thing but nothing  works .

    Hello. I have problem here can someone plz help. I have usb of 32 gb but i have problem with it while i was trying to partition of it and it fails and my usb disappear from finder and desktop i have tried every possible thing but nothing  works .

    Yea i tried in disk utility and its got faiiled and the partitation has deleted and when i tried  to replug the  usb  msg show up by saying  usb not compaitnle. With this mac  and  take me to disk utility  and thanks for replying

  • Displaying problem Help Plz !!!

    Hi all
    For some reason i cant seem to get any applets to run on my computer, they just wont show up, if any one could help, sorry now if i am in the wrong room for this
    Thanks

    Go tp this Sun website http://java.com and click on Verify Installation. If it does not verify that Java is installed, try clicking on the install arrow, and start an install. If you have any problems, review the help pages there.

  • MDI JTable Overlap Area Repaint Problem

    Hi all,
    I have a problem for my application in MDI mode.
    I open many windows (JInternalFrame contain JTable) under JDesktopPane. Some of the windows are overlapping and when they receive update in the table, it seems repaint all of the overlapping windows, not only itself. This make my application performance become poor, slow respond for drap & drop an existing window or open a new window.
    To prove this, i make a simple example for open many simple table and have a thread to update the table's value for every 200 mill second. After i open about 20 windows, the performance become poor again.
    If anyone face the same problem with me and any suggestions to solve the problem ?
    Please help !!!!!
    Following are my sources:
    public class TestMDI extends JFrame {
        private static final long serialVersionUID = 1L;
        private JPanel contentPanel;
        private JDesktopPane desktopPane;
        private JMenuBar menuBar;
        private List<TestPanel> allScreens = new ArrayList<TestPanel>();
        private List<JDialog> freeFloatDialogs = new ArrayList<JDialog>();
        private List<JInternalFrame> mdiInternalFrm = new ArrayList<JInternalFrame>();
        int x = 0;
        int y = 0;
        int index = 0;
        private static int MDI_MODE = 0;
        private static int FREE_FLOAT_MODE = 1;
        private int windowMode = MDI_MODE;
        public TestMDI() {
            init();
        public static void main(String[] args) {
            new TestMDI().show();
        public void init() {
            contentPanel = new JPanel();
            desktopPane = new JDesktopPane();
            desktopPane.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
            desktopPane.setFocusTraversalKeysEnabled(false);
            desktopPane.setFocusTraversalPolicyProvider(false);
            desktopPane.setBorder(null);
            desktopPane.setIgnoreRepaint(true);
            desktopPane.setPreferredSize(new Dimension(1000, 800));
            this.setSize(new Dimension(1000, 800));
            menuBar = new JMenuBar();
            JMenu menu1 = new JMenu("Test");
            JMenuItem menuItem1 = new JMenuItem("Open Lable Screen");
            menuItem1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    for (int i = 1; i < 4; i++) {
                        final TestJLableScreen screen = new TestJLableScreen("Screen  " + (allScreens.size() + 1));
                        screen.startTime();
                        if (windowMode == MDI_MODE) {
                            JInternalFrame frame = createInternalFram(screen);
                            desktopPane.add(frame);
                            mdiInternalFrm.add(frame);
                            if (allScreens.size() * 60 + 100 < 1000) {
                                x = allScreens.size() * 60;
                                y = 60;
                            } else {
                                x = 60 * index;
                                y = 120;
                                index++;
                            frame.setLocation(x, y);
                            frame.setVisible(true);
                        } else {
                            JDialog dialog = createJDialog(screen);
                            freeFloatDialogs.add(dialog);
                            if (i * 60 + 100 < 1000) {
                                x = i * 60;
                                y = 60;
                            } else {
                                x = 60 * index;
                                y = 120;
                                index++;
                            dialog.setLocation(x, y);
                            dialog.setVisible(true);
                        allScreens.add(screen);
            JMenuItem menuItem2 = new JMenuItem("Open Table Screen");
            menuItem2.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    for (int i = 1; i < 4; i++) {
                        TestTableScreen screen = new TestTableScreen("Screen  " + (allScreens.size() + 1));
                        screen.startTime();
                        if (windowMode == MDI_MODE) {
                            JInternalFrame frame = createInternalFram(screen);
                            desktopPane.add(frame);
                            mdiInternalFrm.add(frame);
                            if (allScreens.size() * 60 + 100 < 1000) {
                                x = allScreens.size() * 60;
                                y = 60;
                            } else {
                                x = 60 * index;
                                y = 120;
                                index++;
                            frame.setLocation(x, y);
                            frame.setVisible(true);
                        } else {
                            JDialog dialog = createJDialog(screen);
                            freeFloatDialogs.add(dialog);
                            if (i * 60 + 100 < 1000) {
                                x = i * 60;
                                y = 60;
                            } else {
                                x = 60 * index;
                                y = 120;
                                index++;
                            dialog.setLocation(x, y);
                            dialog.setVisible(true);
                        allScreens.add(screen);
            menu1.add(menuItem1);
            menu1.add(menuItem2);
            this.setJMenuBar(menuBar);
            this.getJMenuBar().add(menu1);
            this.getJMenuBar().add(createSwitchMenu());
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.add(desktopPane);
            desktopPane.setDesktopManager(null);
        public JInternalFrame createInternalFram(final TestPanel panel) {
            final CustomeInternalFrame internalFrame = new CustomeInternalFrame(panel.getTitle(), true, true, true, true) {
                public void doDefaultCloseAction() {
                    super.doDefaultCloseAction();
                    allScreens.remove(panel);
            internalFrame.setPanel(panel);
            // internalFrame.setOpaque(false);
            internalFrame.setSize(new Dimension(1010, 445));
            internalFrame.add(panel);
            internalFrame.setFocusTraversalKeysEnabled(false);
            internalFrame.setFocusTraversalPolicyProvider(false);
            desktopPane.getDesktopManager();
            // internalFrame.setFocusTraversalKeysEnabled(false);
            internalFrame.setIgnoreRepaint(true);
            return internalFrame;
        public JDialog createJDialog(final TestPanel panel) {
            JDialog dialog = new JDialog(this, panel.getTitle());
            dialog.setSize(new Dimension(1010, 445));
            dialog.add(panel);
            dialog.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    allScreens.remove(panel);
            return dialog;
        public JMenu createSwitchMenu() {
            JMenu menu = new JMenu("Test2");
            JMenuItem menuItem1 = new JMenuItem("Switch FreeFloat");
            menuItem1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    windowMode = FREE_FLOAT_MODE;
                    for (JInternalFrame frm : mdiInternalFrm) {
                        frm.setVisible(false);
                        frm.dispose();
                        frm = null;
                    mdiInternalFrm.clear();
                    remove(desktopPane);
                    desktopPane.removeAll();
    //                revalidate();
                    repaint();
                    add(contentPanel);
                    index = 0;
                    for (JDialog dialog : freeFloatDialogs) {
                        dialog.setVisible(false);
                        dialog.dispose();
                        dialog = null;
                    freeFloatDialogs.clear();
                    for (int i = 0; i < allScreens.size(); i++) {
                        JDialog dialog = createJDialog(allScreens.get(i));
                        freeFloatDialogs.add(dialog);
                        if (i * 60 + 100 < 1000) {
                            x = i * 60;
                            y = 60;
                        } else {
                            x = 60 * index;
                            y = 120;
                            index++;
                        dialog.setLocation(x, y);
                        dialog.setVisible(true);
            JMenuItem menuItem2 = new JMenuItem("Switch MDI");
            menuItem2.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    windowMode = MDI_MODE;
                    remove(contentPanel);
                    add(desktopPane);
                    for (int i = 0; i < freeFloatDialogs.size(); i++) {
                        freeFloatDialogs.get(i).setVisible(false);
                        freeFloatDialogs.get(i).dispose();
                    freeFloatDialogs.clear();
    //                revalidate();
                    repaint();
                    for (JInternalFrame frm : mdiInternalFrm) {
                        frm.setVisible(false);
                        frm.dispose();
                        frm = null;
                    mdiInternalFrm.clear();
                    index = 0;
                    for (int i = 0; i < allScreens.size(); i++) {
                        JInternalFrame frame = createInternalFram(allScreens.get(i));
                        desktopPane.add(frame);
                        mdiInternalFrm.add(frame);
                        if (i * 60 + 100 < 1000) {
                            x = i * 60;
                            y = 60;
                        } else {
                            x = 60 * index;
                            y = 120;
                            index++;
                        frame.setLocation(x, y);
                        frame.setVisible(true);
            menu.add(menuItem1);
            menu.add(menuItem2);
            return menu;
    public class TestTableScreen extends TestPanel {
        private static final long serialVersionUID = 1L;
        JTable testTable = new JTable();
        MyTableModel tableModel1 = new MyTableModel(1);
        private boolean notRepaint = false;
        int start = 0;
        JScrollPane scrollPane = new JScrollPane();
        private Timer timmer = new Timer(200, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Random indexRandom = new Random();
                final int index = indexRandom.nextInt(50);
                Random valRandom = new Random();
                final int val = valRandom.nextInt(600);
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        notRepaint = false;
                        TestTableScreen.this.update(index + "|" + val);
        public TestTableScreen(String title) {
            this.title = title;
            init();
            tableModel1.setTabelName(title);
        public void startTime() {
            timmer.start();
        public String getTitle() {
            return title;
        public void update(String updateStr) {
            String[] val = updateStr.split("\\|");
            if (val.length == 2) {
                int index = Integer.valueOf(val[0]);
                List vals = tableModel1.getVector();
                if (vals.size() > index) {
                    vals.set(index, val[1]);
    //                 tableModel1.fireTableRowsUpdated(index, index);
                } else {
                    vals.add(val[1]);
    //                 tableModel1.fireTableRowsUpdated(vals.size() - 1, vals.size() - 1);
                tableModel1.fireTableDataChanged();
        public TableModel getTableModel() {
            return tableModel1;
        public void init() {
            testTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            testTable.setRowSelectionAllowed(true);
            this.testTable.setModel(tableModel1);
            int[] width = { 160, 80, 45, 98, 60, 88, 87, 88, 80, 70, 88, 80, 75, 87, 87, 41, 88, 82, 75, 68, 69 };
            TableColumnModel columnModel = testTable.getColumnModel();
            for (int i = 0; i < width.length; i++) {
                columnModel.getColumn(i).setPreferredWidth(width[i]);
            testTable.setRowHeight(20);
            tableModel1.fireTableDataChanged();
            this.setLayout(new BorderLayout());
            TableColumnModel columnMode2 = testTable.getColumnModel();
            int[] width2 = { 200 };
            for (int i = 0; i < width2.length; i++) {
                columnMode2.getColumn(i).setPreferredWidth(width2[i]);
            scrollPane.getViewport().add(testTable);
            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            this.add(scrollPane, BorderLayout.CENTER);
        class MyTableModel extends DefaultTableModel {
            public List list = new ArrayList();
            String titles[] = new String[] { "袨怓1", "袨怓2", "袨怓3", "袨怓4", "袨怓5", "袨怓6", "袨怓7", "袨怓8", "袨怓9", "袨怓10", "袨怓11",
                    "袨怓12", "袨怓13", "袨怓14", "袨怓15", "袨怓16", "袨怓17", "袨怓18", "袨怓19", "袨怓20", "袨怓21" };
            String tabelName = "";
            int type_head = 0;
            int type_data = 1;
            int type = 1;
            public MyTableModel(int type) {
                super();
                this.type = type;
                for (int i = 0; i < 50; i++) {
                    list.add(i);
            public void setTabelName(String name) {
                this.tabelName = name;
            public int getRowCount() {
                if (list != null) {
                    return list.size();
                return 0;
            public List getVector() {
                return list;
            public int getColumnCount() {
                if (type == 0) {
                    return 1;
                } else {
                    return titles.length;
            public String getColumnName(int c) {
                if (type == 0) {
                    return "head";
                } else {
                    return titles[c];
            public boolean isCellEditable(int nRow, int nCol) {
                return false;
            public Object getValueAt(int r, int c) {
                if (list.size() == 0) {
                    return null;
                switch (c) {
                default:
                    if (type == 0) {
                        return r + " " + c + "  test ";
                    } else {
                        return list.get(r) + "   " + c;
        public boolean isNotRepaint() {
            return notRepaint;
        public void setNotRepaint(boolean notRepaint) {
            this.notRepaint = notRepaint;
    public class TestPanel extends JPanel {
        protected String title = "";
        protected boolean needRepaint = false;
        protected boolean isFirstOpen = true;
        public String getTitle() {
            return title;
        public void setNeedRepaint(boolean flag) {
            this.needRepaint = flag;
        public boolean isNeedRepaint() {
            return needRepaint;
        public boolean isFirstOpen() {
            return isFirstOpen;
        public void setFirstOpen(boolean isFirstOpen) {
            this.isFirstOpen = isFirstOpen;
    public class TestJLableScreen extends TestPanel {
        private static final long serialVersionUID = 1L;
        private JLabel[] allLables = new JLabel[20];
        private Timer timmer = new Timer(20, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Random indexRandom = new Random();
                final int index = indexRandom.nextInt(10);
                Random valRandom = new Random();
                final int val = valRandom.nextInt(600);
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        TestJLableScreen.this.setNeedRepaint(true);
                        TestJLableScreen.this.update(index + "|" + val);
        public TestJLableScreen(String title) {
            this.title = title;
            init();
        public void startTime() {
            timmer.start();
        public String getTitle() {
            return title;
        public void update(String updateStr) {
            String[] val = updateStr.split("\\|");
            if (val.length == 2) {
                int index = Integer.valueOf(val[0]);
                allLables[index * 2 + 1].setText(val[1]);
        public void init() {
            this.setLayout(new GridLayout(10, 2));
            boolean flag = true;
            for (int i = 0; i < allLables.length; i++) {
                allLables[i] = new JLabel() {
                    // public void setText(String text) {
                    // super.setText(text);
                    // // System.out.println("  setText " + getTitle() + "   ; " + this.getName());
                    public void paint(Graphics g) {
                        super.paint(g);
                        // System.out.println("  paint " + getTitle() + "   ; " + this.getName());
                    // public void repaint() {
                    // super.repaint();
                    // System.out.println("  repaint " + getTitle() + "   ; " + this.getName());
                allLables[i].setName("" + i);
                if (i % 2 == 0) {
                    allLables[i].setText("Name " + i + "  : ");
                } else {
                    allLables[i].setOpaque(true);
                    if (flag) {
                        allLables[i].setBackground(Color.YELLOW);
                        flag = false;
                    } else {
                        allLables[i].setBackground(Color.CYAN);
                        flag = true;
                    allLables[i].setText(i * 8 + "");
            for (int i = 0; i < allLables.length; i++) {
                this.add(allLables[i]);
    public class CustomeInternalFrame extends JInternalFrame {
        protected TestPanel panel;
        public CustomeInternalFrame() {
            this("", false, false, false, false);
        public CustomeInternalFrame(String title) {
            this(title, false, false, false, false);
        public CustomeInternalFrame(String title, boolean resizable) {
            this(title, resizable, false, false, false);
        public CustomeInternalFrame(String title, boolean resizable, boolean closable) {
            this(title, resizable, closable, false, false);
        public CustomeInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable) {
            this(title, resizable, closable, maximizable, false);
        public CustomeInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable,
                boolean iconifiable) {
            super(title, resizable, closable, maximizable, iconifiable);
        public TestPanel getPanel() {
            return panel;
        public void setPanel(TestPanel panel) {
            this.panel = panel;

    i had the same problem with buttons and it seemed that i overlayed my button with something else...
    so check that out first do you put something on that excact place???
    other problem i had was the VAJ one --> VisualAge for Java (terrible program)
    it does strange tricks even when you don't use the drawing tool...
    dunno 2 thoughts i had... check it out...
    SeJo

  • Problem with JInternalFrame

    Hii there,
    I'm having a problem with JInternalFrame, that is, when I'm trying to open multiple frames, it is overlapping one another and sometimes one of them disappears, I did something like this,
    dpane=new JDesktopPane();                                                 
                            dpane.setDesktopManager(new DefaultDesktopManager());
                            dpane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
                            iframe=new JInternalFrame("Title" ,true,true,true,true);  
                            //iframe.setPreferredSize(new Dimension(1010,800));
                            iframe.setResizable(false);
                            vScrollPane = new JScrollPane(viewPanel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                       
                            iframe.setPreferredSize(new Dimension(1010,800));
                            iframe.setLocation(0,1);
                            iframe.setVisible(true);
                            iframe.show();
                            iframe.getContentPane().add(vScrollPane,BorderLayout.EAST);                      
                            iframe.getContentPane().add(hScrollBar,BorderLayout.SOUTH);
                            iframe.moveToFront();
                            iframe.setFocusable(true);
                            iframe.pack();
                            dpane.add(iframe);                                      
                            getContentPane().add(dpane);could u someone plz help me !
    Dev

    [How to Use Internal Frames|http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html]

  • Repaint problem while clicking the popup menuitem

    Hi all,
    iam facing repainting problem in my application. User can initiate a single action from different options such as JButton, double-click of mouse and clicking the menu item form the JPopupMenu.
    All these will execute the same code. But when iam using the first two ways, the repainting is properly working and aim getting the required UI and opening the JInternalFrame.
    When the last case is being used(ie., clicking the menu item form the JPopupMenu), then the repaint is not working and the window being opened is coming in pieces and then finally i could see the window after some time, which is not the case with the first two cases.
    Please help me how to solve and get the window at once. Iam attaching the code.
    MainFrame.java
    package com.swing;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.event.MouseWheelEvent;
    import java.awt.event.MouseWheelListener;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    public class MainFrame extends JFrame implements ActionListener{
         static final long serialVersionUID = 3345648L;
         public MainFrame() {
              setSize(1000,750);
              setLayout(null);
              setVisible(true);
              addMenuBar();
              invalidate();
         public void actionPerformed(ActionEvent actionEvent) {
              Object source = actionEvent.getSource();
              if( source == s_mnuItmFirstFrame ) {
                   FirstFrame s_frameFirst = new FirstFrame(this);
                   this.add(s_frameFirst);
          * @param args
         public static void main(String[] args) {
              MainFrame mFrame = new MainFrame();
         JMenuBar s_menuBar = null;
         JMenuItem s_mnuItmFirstFrame = new JMenuItem("Add Internal Frame");
         void addMenuBar(){
              Font fontNormal = new Font("Dialog", Font.PLAIN, 11);
              s_menuBar = new JMenuBar();
              s_menuBar.setDoubleBuffered(true);
              getRootPane().setJMenuBar(s_menuBar);
              s_mnuItmFirstFrame.setFont(fontNormal);
              s_mnuItmFirstFrame.addActionListener(this);
              JMenu s_menuFrames = new JMenu("Frames");
              s_menuFrames.setFont(fontNormal);
              s_menuFrames.add(s_mnuItmFirstFrame);
              s_menuBar.add(s_menuFrames);
    FirstFrame.java
    package com.swing;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.event.MouseWheelEvent;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JMenuItem;
    import javax.swing.JPopupMenu;
    import javax.swing.JTable;
    import javax.swing.event.InternalFrameAdapter;
    import javax.swing.event.InternalFrameEvent;
    import javax.swing.table.DefaultTableModel;
    public class FirstFrame extends JInternalFrame implements ActionListener
         static final long serialVersionUID = 2345657L;
         public FirstFrame(JFrame parentFrame) {
              super(" First Frame ", true, true, true, true);
              mainFrame = parentFrame;
              setSize(400, 400);
              setVisible(true);
              setLayout(new FlowLayout());
              try {
                   setMaximum(false);
              } catch (Exception e) {
                   e.printStackTrace();
              DefaultTableModel s_modelFirstTable = new DefaultTableModel();
              Vector tableData = new Vector();
              Vector namesVector = new Vector();
              namesVector.add("OneFirst");
              namesVector.add("OneMiddle");
              namesVector.add("OneLast");
              tableData.add(namesVector);
              namesVector = new Vector();
              namesVector.add("TwoFirst");
              namesVector.add("TwoMiddle");
              namesVector.add("TwoLast");
              tableData.add(namesVector);
              namesVector = new Vector();
              namesVector.add("ThreeFirst");
              namesVector.add("ThreeMiddle");
              namesVector.add("ThreeLast");
              tableData.add(namesVector);
              namesVector = new Vector();
              namesVector.add("FourFirst");
              namesVector.add("FourMiddle");
              namesVector.add("FourLast");
              tableData.add(namesVector);
              namesVector = new Vector();
              namesVector.add("FiveFirst");
              namesVector.add("FiveMiddle");
              namesVector.add("FiveLast");
              tableData.add(namesVector);
              Vector tableHeader = new Vector();
              tableHeader.add("First Name");
              tableHeader.add("Middle Name");
              tableHeader.add("Last Name");
              s_modelFirstTable.setDataVector(tableData, tableHeader);
              s_tblFirst.setModel(s_modelFirstTable);
              add(s_tblFirst);
              add(s_btnSecondButton);
              s_mnuPopupMenu.add(s_mnuItmSecondButton);
              s_mnuPopupMenu.add(s_mnuItmSecondButton1);
              s_mnuPopupMenu.add(s_mnuItmSecondButton2);
              s_mnuPopupMenu.add(s_mnuItmSecondButton3);
              s_mnuPopupMenu.add(s_mnuItmSecondButton4);
              s_tblFirst.addMouseListener(new MouseAdapter() {
                   public void mouseReleased(MouseEvent mouseEvent) {
                        s_mnuPopupMenu.setVisible(true);
                        // if (mouseEvent.isPopupTrigger()) {
                        s_mnuPopupMenu.show(mouseEvent.getComponent(), mouseEvent
                                  .getX(), mouseEvent.getY());
              s_btnSecondButton.addActionListener(this);
              s_mnuItmSecondButton.addActionListener(this);
              this.addInternalFrameListener(new InternalFrameAdapter() {
                   public void internalFrameClosing(InternalFrameEvent ifEvent) {
                        Object object = ifEvent.getSource();
                        if (object == FirstFrame.this) {
                             try {
                                  if (s_frameSecond != null)
                                       s_frameSecond.setClosed(true);
                             } catch (Exception e) {
                                  e.printStackTrace();
         public void actionPerformed(ActionEvent actionEvent) {
              if (s_frameSecond != null) {
                   try {
                        s_frameSecond.setClosed(true);
                   } catch (Exception e) {
                        e.printStackTrace();
              s_frameSecond = new SecondFrame();
              mainFrame.add(s_frameSecond);
              s_frameSecond.moveToFront();
              s_frameSecond.setVisible(true);
         JFrame mainFrame ;
         JTable s_tblFirst = new JTable();
         JButton s_btnSecondButton = new JButton("Second Frame");
         JMenuItem s_mnuItmSecondButton = new JMenuItem("Second Frame");
         JMenuItem s_mnuItmSecondButton1 = new JMenuItem("Second Frame1");
         JMenuItem s_mnuItmSecondButton2 = new JMenuItem("Second Frame2");
         JMenuItem s_mnuItmSecondButton3 = new JMenuItem("Second Frame3");
         JMenuItem s_mnuItmSecondButton4 = new JMenuItem("Second Frame4");
         JPopupMenu s_mnuPopupMenu = new JPopupMenu();
         SecondFrame s_frameSecond;
    SecondFrame.java
    package com.swing;
    import java.awt.GridLayout;
    import javax.swing.JButton;
    import javax.swing.JInternalFrame;
    public class SecondFrame extends JInternalFrame {
         static final long serialVersionUID = 1345648L;
         public SecondFrame() {
              super(" Second Frame ", true, true, true, true);
              try {
              setLayout(new GridLayout(4, 4));
              setSize(400,400);
              //setVisible(true);
              setMaximizable(true);
              for(int i=0; i<4; i++){
                   for(int j=0; j<4; j++){
                        add(new JButton(""+(i+1)+", "+(j+1)));
              catch(Exception e){
                   e.printStackTrace();
    }

    Don't post an IDE generated code as is. It's a torture for human eye. At least, you should rename
    all the identifiers to some meaningful names.
    You MUST use JDesktopPane when you use JInternalFrames.
    Here's a working code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    import java.util.*;
    public class MainFrame extends JFrame implements ActionListener{
      static final long serialVersionUID = 3345648;
      JFrame frame;
      JDesktopPane jdp;
      public MainFrame() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(1000,750);
        // setLayout(null); //you MUST use a real LayoutManager
        addMenuBar();
        frame = this;
        jdp = new JDesktopPane();
        frame.add(jdp);
        setVisible(true);
      public void actionPerformed(ActionEvent actionEvent) {
        Object source = actionEvent.getSource();
        if( source == s_mnuItmFirstFrame ) {
          FirstFrame s_frameFirst = new FirstFrame(this);
          jdp.add(s_frameFirst);
          s_frameFirst.setVisible(true);
      public static void main(String[] args) {
        MainFrame mFrame = new MainFrame();
      JMenuBar s_menuBar = null;
      JMenuItem s_mnuItmFirstFrame = new JMenuItem("Add Internal Frame");
      void addMenuBar(){
        Font fontNormal = new Font("Dialog", Font.PLAIN, 11);
        s_menuBar = new JMenuBar();
        s_menuBar.setDoubleBuffered(true);
        getRootPane().setJMenuBar(s_menuBar);
        s_mnuItmFirstFrame.setFont(fontNormal);
        s_mnuItmFirstFrame.addActionListener(this);
        JMenu s_menuFrames = new JMenu("Frames");
        s_menuFrames.setFont(fontNormal);
        s_menuFrames.add(s_mnuItmFirstFrame);
        s_menuBar.add(s_menuFrames);
        setJMenuBar(s_menuBar);
    class FirstFrame extends JInternalFrame implements ActionListener{
      static final long serialVersionUID = 2345657;
      public FirstFrame(MainFrame parentFrame) {
        super(" First Frame ", true, true, true, true);
        mainFrame = parentFrame;
        setSize(400, 400);
        setVisible(true);
        setLayout(new FlowLayout());
        try {
          setMaximum(false);
        } catch (Exception e) {
          e.printStackTrace();
        DefaultTableModel s_modelFirstTable = new DefaultTableModel();
        Vector<Vector> tableData = new Vector<Vector>();
        Vector<String> namesVector = new Vector<String>();
        namesVector.add("OneFirst");
        namesVector.add("OneMiddle");
        namesVector.add("OneLast");
        tableData.add(namesVector);
        namesVector = new Vector<String>();
        namesVector.add("TwoFirst");
        namesVector.add("TwoMiddle");
        namesVector.add("TwoLast");
        tableData.add(namesVector);
        namesVector = new Vector<String>();
        namesVector.add("ThreeFirst");
        namesVector.add("ThreeMiddle");
        namesVector.add("ThreeLast");
        tableData.add(namesVector);
        namesVector = new Vector<String>();
        namesVector.add("FourFirst");
        namesVector.add("FourMiddle");
        namesVector.add("FourLast");
        tableData.add(namesVector);
        namesVector = new Vector<String>();
        namesVector.add("FiveFirst");
        namesVector.add("FiveMiddle");
        namesVector.add("FiveLast");
        tableData.add(namesVector);
        Vector<String> tableHeader = new Vector<String>();
        tableHeader.add("First Name");
        tableHeader.add("Middle Name");
        tableHeader.add("Last Name");
        s_modelFirstTable.setDataVector(tableData, tableHeader);
        s_tblFirst.setModel(s_modelFirstTable);
        add(s_tblFirst);
        add(s_btnSecondButton);
        s_mnuPopupMenu.add(s_mnuItmSecondButton);
        s_mnuPopupMenu.add(s_mnuItmSecondButton1);
        s_mnuPopupMenu.add(s_mnuItmSecondButton2);
        s_mnuPopupMenu.add(s_mnuItmSecondButton3);
        s_mnuPopupMenu.add(s_mnuItmSecondButton4);
        s_tblFirst.addMouseListener(new MouseAdapter() {
          public void mousePressed(MouseEvent mouseEvent){
            if (mouseEvent.isPopupTrigger()) {
              s_mnuPopupMenu.show(mouseEvent.getComponent(),
               mouseEvent.getX(), mouseEvent.getY());
          public void mouseReleased(MouseEvent mouseEvent) {
            if (mouseEvent.isPopupTrigger()) {
              s_mnuPopupMenu.show(mouseEvent.getComponent(),
               mouseEvent.getX(), mouseEvent.getY());
        s_btnSecondButton.addActionListener(this);
        s_mnuItmSecondButton.addActionListener(this);
        addInternalFrameListener(new InternalFrameAdapter() {
          public void internalFrameClosing(InternalFrameEvent ifEvent) {
            Object object = ifEvent.getSource();
            if (object == this) {
              try {
                if (s_frameSecond != null){
                  s_frameSecond.setClosed(true);
              } catch (Exception e) {
                e.printStackTrace();
      } // FirstFrame constructor
      public void actionPerformed(ActionEvent actionEvent) {
        if (s_frameSecond != null) {
          try {
            s_frameSecond.setClosed(true);
          } catch (Exception e) {
            e.printStackTrace();
        s_frameSecond = new SecondFrame();
        mainFrame.jdp.add(s_frameSecond);
        s_frameSecond.moveToFront();
        s_frameSecond.setVisible(true);
      MainFrame mainFrame ;
      JTable s_tblFirst = new JTable();
      JButton s_btnSecondButton = new JButton("Second Frame");
      JMenuItem s_mnuItmSecondButton = new JMenuItem("Second Frame");
      JMenuItem s_mnuItmSecondButton1 = new JMenuItem("Second Frame1");
      JMenuItem s_mnuItmSecondButton2 = new JMenuItem("Second Frame2");
      JMenuItem s_mnuItmSecondButton3 = new JMenuItem("Second Frame3");
      JMenuItem s_mnuItmSecondButton4 = new JMenuItem("Second Frame4");
      JPopupMenu s_mnuPopupMenu = new JPopupMenu();
      SecondFrame s_frameSecond;
    class SecondFrame extends JInternalFrame {
      static final long serialVersionUID = 1345648;
      public SecondFrame() {
        super(" Second Frame ", true, true, true, true);
        try {
          setLayout(new GridLayout(4, 4));
          setSize(400, 400);
          setMaximizable(true);
          for(int i=0; i<4; i++){
            for(int j = 0; j < 4; ++j){
              add(new JButton("" + (i + 1) + ", " + (j + 1)));
        catch(Exception e){
          e.printStackTrace();
    }

  • I cant get voice over to work on my 4G shuffle it clicks off every time help plz

    i need help plz it wont work

    Hello,
    Welcome to Adobe Forums.
    Try uninstalling Adobe Flash Player from Flash Player uninstaller : http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html#main_uninstall
    Try a clean installation using this KB : http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player- mac.html
    Thanks,
    Vikram

  • Help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked  a

    help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked 

    The proper way to close Firefox is through the File menu "Exit" or the equivalent with the Firefox button.
    More detail in item '''#38 Firefox already running '''
    of
    [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 look like 3.6) (#fx4interface)]
    Firefox already running, to properly shutdown Firefox when closing the last window use File → Exit/Quit (or Firefox button → Exit). Closing Firefox with the [X] in the upper right corner closes the window ("Ctrl+W") but that does not necessarily close Firefox if it has subtasks running. If you want to close and reopen Firefox use the "Restart" within Add-ons if you made a change requiring a restart, or install "[https://addons.mozilla.org/firefox/addon/restartless-restart/ Restartless Restart]" ("Ctrl+Alt+R") which will allow you to take Firefox down and restart without having to check the Windows Task Manager to see if Firefox first actually ended. [http://kb.mozillazine.org/Firefox_hangs Firefox hangs]

  • Help plz, i need back up my phone

    Help plz, i have iphone 4 i still have icloud  on my itunes and i need to update it to the new one but i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks

    jennyspeedy* wrote:
    i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks
    Then use the device as designed.  Copy the pictures off the device to the computer.  For any pictures that you desire to keep on the device, simply sync them via iTunes.
    Failure to copy the pictures off the device is only asking for problems.  If the device is ever lost/stolen or simply fails to work, without a backup they would be gone as well.

  • Help Plz i've blank LCD in Lenovo G530

    Help Plz i've blank LCD in Lenovo G530
    the unit is working and the power & wireless indicators is  on but the LCD is blank
    i've allready unpluged the battery and powered the unit with the charger only and plug the battery again but still have the same problem.
    so plz advice what to do ?????

    Try to plug in external monitor and look if anything shows. Then try to check monitor configuration. Maybe it is switched off...
    Regards,
    Publius
    Lenovo 3000 V200

  • Oracle to Mysql character set conversion problem!!! PLZ IGNORE

    Hi Experts,
    I have created a database link from Oracle 10g to Mysql 5.
    I have installed Oracle Gateway 11g for this purpose.
    When i retreive the data from sql plus the text is displayed as question marks.
    Oracle 10g Database character set is WE8MSWIN1252
    Mysql character set --->latin1
    Character set of ODBC connector for mysql is  latin7
    Character set in the parameter file of HS folder is WE8MSWIN1252When i retrieve data from sql developer the text is fine(as i think it directly takes the character set of target) but
    when i login from sqlplus i get question marks!
    I have another post in Heterogeneous Connectivity forum
    Re: Oracle to Mysql character set conversion problem!!! PLZ HELP
    Kindly update your comments there,
    @@@@@@@@@@@@@@2
    Appreciate your help,
    regards
    Edited by: user10243788 on Apr 21, 2010 3:25 AM

    It is OK to post a globalization-related question in this forum in addition to the forum pertaining to the main technology. Not all experts follow all possible forums on OTN. Of course, you should cross-link the posts to let people merge the answers.
    Regarding the problem itself, make sure that SQL*Plus has the right NLS_LANG setting in the environment. On Windows, in the Command Prompt:
    C:\> set NLS_LANG=.WE8PC850
    C:\> sqlplus ...On Unix:
    $ setenv NLS_LANG .WE8ISO8859P1   (or NLS_LANG=.WE8ISO8859P1; export NLS_LANG)
    $ sqlplus ...-- Sergiusz

  • LASERJET M1217 nfw MFP urgent help plz

    HAY GUYS, NEED URGENT HELP!!!!!!!!!
    My printer M1217 nfw MFP had a problem with the scanner and it was fixed bu updating the firmware and the scanner works fine and offcourse i printed the config. report  befor updating the firmware , the problem is that i lost the report and i cant config. the fax or the wirless connection . any help plz guys  

    kelsaeed wrote:
    HAY GUYS, NEED URGENT HELP!!!!!!!!!
    My printer M1217 nfw MFP had a problem with the scanner and it was fixed bu updating the firmware and the scanner works fine and offcourse i printed the config. report  befor updating the firmware , the problem is that i lost the report and i cant config. the fax or the wirless connection . any help plz guys  

  • Initial repaint problem

    Hello all,
    Iam facing a repaint problem when i start my pgm. the display is distorted but when i minimize & maximize the window display is proper after that everything works fine. my pgm contains JApplet which in turn contains toobar, menubar scrollpane & a panel. the panel contaisn one more panel on which i'm drawing some data. when the pgm starts up the drawing is no in it's proper position i tried calling repaint, revalidate, paintAll .. all these commands in various places in various combination. i couldn't still solvemy problem. can anybody help me with this. the problem comes only when the window opens at first.
    Thanks in advance

    I also want to add one more thing if i run this as an application this problem doesn't comes. but i want to run this as an applet. is there anything special with the applet's paint method. please help me.

Maybe you are looking for

  • Can I transfer seats from one Creative Cloud team account to another?

    I originally set up my Creative Cloud Teams account through a reseller, but I have been having a bad experience with the reseller. So I set up a new Creative Cloud Teams account directly through Adobe. Is it possible to transfer the seats from the ol

  • Can I use parted magic to secure erase Apple SSD?

    Recently, I have bought Apple SSD128GB (Toshiba HG3 serie) to upgrade my MBP 15" early 2011. It's a second hand drive of my friend so I want to do secure erase by using Parted Magic for improving the performance as factory reset. I have heard about P

  • While making vendor clearing through F-44, service tax is also coming

    Hi Expert, I have an issue related to vendor clearing, 1.  I have make an advance payment following transaction took place : 29  Vishal Ltd                     10000 40  Service tax input               100 40  Excess on service tax        20 40  HSec

  • IPhoto 2 to iPhoto 4.0.3?

    Does anyone know how I can upgrade my Panther iPhoto 2 to at least iPhoto 4.0.3 so I can use my newly acquired iPod photo?? Seems bizarre that you need 4.0.3 and can't get it anywhere! N

  • How do i open EPS file with "rasterize generic EPS format" options in photoshop CS?

    Hi please can someone help!? I'm using Photoshop CS on mac- when i open EPS format files i usually get the "rasterize generic EPS format" option so that i can select the size i want the file to be etc without losing quality. However on one file i've