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

Similar Messages

  • Printing JTable after turning off double buffering causing repaint problems

    I've followed all the instructions to speed up a print job in java by turning off double buffering temporarily by using the following call before calling paint() on the component...
    RepaintManager.currentManager(printTable).setDoubleBufferingEnabled(false);
    ... and then turning it back on afterwards...
    RepaintManager.currentManager(printTable).setDoubleBufferingEnabled(true);
    but the problem is that if it is a long print job, then the rest of the application (including other JTables) isn't repainting properly at all. I have the printing going on in a separate thread since I don't think it's acceptable UI practices to force the user to wait until a print job finishes before they can proceed with using their application. I've tried controlling the double buffering at the JPanel level as well, but it always affects the entire application until the print spooling is complete.
    Does anyone have any suggestions to solve this annoying SWING printing problem?
    Thanks,
    - Tony

    When you post code, make sure and put it between code
    tags, so it looks good:
    public static void main(String[] args) {
    System.out.println("Doesn't this look great?");
        public int print(Graphics g, PageFormat pf, int pageIndex) {
            System.out.println( "Calling print(g,pf,pageIndex) method" );
            int response = NO_SUCH_PAGE;
            Graphics2D g2 = (Graphics2D) g;
    // for faster printing, turn off double buffering
            disableDoubleBuffering(componentToBePrinted);
            Dimension d = componentToBePrinted.getSize(); //get size of document
            double panelWidth = d.width; //width in pixels
            double panelHeight = d.height; //height in pixels
            double pageHeight = pf.getImageableHeight(); //height of printer page
            double pageWidth = pf.getImageableWidth(); //width of printer page
            double scale = pageWidth / panelWidth;
            int totalNumPages = (int) Math.ceil(scale * panelHeight / pageHeight);
    // make sure not print empty pages
            if (pageIndex >= totalNumPages) {
                response = NO_SUCH_PAGE;
            } else {
    // shift Graphic to line up with beginning of print-imageable region
                g2.translate(pf.getImageableX(), pf.getImageableY());
    // shift Graphic to line up with beginning of next page to print
                g2.translate(0f, -pageIndex * pageHeight);
    // scale the page so the width fits...
                g2.scale(scale, scale);
                componentToBePrinted.paint(g2); //repaint the page for printing
                enableDoubleBuffering(componentToBePrinted);
                response = Printable.PAGE_EXISTS;
            return response;
        }

  • 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();
    }

  • OHJ4.1.16 Repainting Problems and 100%CPU on java 1.4

    Hi
    We are considering using OHJ4.1.16 as our application help, I have it working such that when the help is invoked either from the toolbar or the menu OHJ is displayed, but there are major repainting problems when the OHJ window is closed by clicking on the X button and then the help is invoked again from the toolbar or the menu item.
    Please note that the first time it displays and paints fine only when the OHJ frame is closed and invoked again the problem occurs
    The problems encountered are repainting(really whacky), 100% CPU utilization
    Please have a look at the code below and tell me if i am not doing it right, Also is there anyway i can trap events on the OHJ frame so that i can dispose it everytime the window is closed by the user??
    The following code is executed when the help is invoked
         public void startHelp()
         helpObject.showNavigatorWindow();     
         helpObject.setVisible(true);
         public static void launchApplication()
              String helpset1 = "/resources/help/Test.hs";
              Vector booksVector = new Vector();
              booksVector.add(helpset1);
                   if(m_instance == null)
                        m_instance = new ApplicationHelp(booksVector);
                   else
                        m_instance.startHelp();                    
    we are using java 1.4, the above problem makes OHJ unusable!!

    Hi, John. We're trying to reproduce your problem. If you run any of the OHJ 4.1.16 demos in the bin directory of the installation, do you run into the 100% CPU utilization problem? If so, how? The cshDemo.bat file creates a dummy application that has an OHJ deployment, so please test that one in particular.
    Thanks,
    Ryan

  • Cannot open your default e-mail folder. Microsoft Exchange is not available. Either there are network problems or the Exchange computer is down for maintenance

    Windows Server 2012 R1 with Exchange 2013 SP1
    Windows XP SP3 with Outlook 2010 (14.0.4760.1000) computer is on the same network, but not a part of the domain. 
    When I try to configure Outlook profile for the user, I manually enter exchange server name and user name. 
    Check User button underlines server name and user name and profile gets created successfully.
    Once I try to open outlook for the user I get
    Cannot open your default e-mail folder. Microsoft Exchange is not available. Either there are network problems or the Exchange computer is down for maintenance
    If I search the content of the log files under
    X:\Program Files\Microsoft\Exchange Server\V15\Logging\RPC Client Access
    I can’t find any records indicating a connection attempt from the client’s IP or references to the version of the outlook used, however I can see a 3 way handshake followed by a 4 RCP packets and then 4 nspi bind requests and responses when outlook opens
    up and then connection is torn down.

    Windows Server 2012 R1 with Exchange 2013 SP1
    Windows XP SP3 with Outlook 2010 (14.0.4760.1000) computer is on the same network, but not a part of the domain. 
    Hi,
    That version of Outlook 2010 (14.0.4760.1000) is not supported with Exchange 2013 and will not be able to connect. It need to be on at least SP1 +
    Outlook 2010 November 2012 update (14.0.6126.5000)
    See: Exchange 2013 System Requirements -
    Client Support
    Martina Miskovic

  • I have an Ipad 2 and are having problems sending out emails in one of my email address. I always get a message reading the email was not sent because the server does not allow relaying. This is an email account POP3. I have no such problem with gmail.

    I have an Ipad 2 and are having problems sending out emails in one of my email address. This is a POP3 email Account? I always get a message reading that the email was not sent because the server does not allow relaying. I have no such problem with gmail. What could be the problem and how do I resolve this. Is it about settings?
    Richard.

    Welcome to the Apple community.
    If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact Apple ID Support, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
    The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
    The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
    Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
    Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
    Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do.

  • Performance with repaint problem

    Hi,
    I have a performance and repaint problem.
    My problem is than I have a layer pane with about 500 JScrollPane, each JScrollPane has a JLabel, and each JLabel has an Icon. I can have to maintain this hierarchy.
    I have a thread that makes the icon change from a color state to a grey state; in fact it makes them all blink.
    My problem is that is takes 50% of the CPU when the blink thread is running. As well, they do not all blink at the same time. The thread changes the icon color and calls a repaint. They seem to repaint independently.
    What I would like is to collapse the paint calls into one without having to call repaint on the whole JFrame which does solve my problem but it is a hack.
    Swing should collapse all the repaints into one call to the parent but I think because of the JScrollPanes it is not. Can anyone shed any light into why it does not paint all in one call instead of 500 repaint calls.
    Thanks,
    Pat

    Well, I'd change the design first, but if you must play around with paint() then you can try using this setIgnoreRepaint(true) in the Component class.
    You could do the grouping yourself and then when you really want things repainted, flag all your components again with setIgnoreRepaint(false), and then call revlaidate() to the parent, and it should repaint everything at once. That is what's I'd try, anyway.

  • Hi, my iphone is disabled now and it says connect to itunes but there are some problems to fix it .

    Hi, my iphone is disabled now and it says connect to itunes but there are some problems to fix it .
    Firstly, i reset my computer few days ago and never used itunes after that .
    Secondly, the power button on the iphone is broken so i can't set the recovery mode on the phone.
    I Tried connect the itunes with the iphone but the all itunes says 'To allow access , please respond on your iphone' but there's nothing i can do,
    iphone doesn't respond at all .
    I need some help .... i tried everything i could do ..

    Hey jinyoung_20,
    Based on the information you have provided, it appears your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, and express replacement service:
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Welcome to Apple Support Communities!
    Sincerely,
    Delgadoh

  • Indesign CS6 on MACs with OS 10.8 are having problems with links

    Hi
    Indesign CS6 on MACs with 10.8 are having problems with links. All links to other files have to be updated when opening a file although definitely nothing has changed to the linked files.
    We can rule out our company's networking and the system hosting the files (HELIOS software on RedHat Linux VM). This happens with newly created Indesign files and with old ones. E.g. we create a file on Tuesday, save it and open it again on the exact same MAC on Wednesday and all links to other fiels (.indd, .png, .bmp, etc. nothing uncommon) have to be updated as they all show the yellow triangle + black exclamation mark symbol next to them. Has anybody else experienced this, What can we do? We have tried absolutley everything and updated all software from MAC OS to CS6 itself but nothing seems to help on the long run.
    Any further information required?
    M. Miller

    Thanks for your quick reply.
    We actually noticed that there also seems to be something wrong with the timestamps:
    If we open the infos via the MAC finder to a file (.psd e.g.) which is linked in one of our indesign files, it states a certain date of creation.
    If we then switch to the Indesign file we just opened in which we had to update all links and open the infos to exactly the same file we looked at in the finder, a different date of creation is stated. So there also seems to be a mistake here (hope it's clear what I mean).
    We are ruling out our network as the error cannot be "re-enacted". We have created numerous test files in Indesign (simple white page containing one link to a .psd file which is also used in one of the supposedly defective files) and have opened them on various MACs with various OS versions over the past days/weeks but unfortunately the files open without any notifications or errors.
    Just as a background: a few months ago, the problem seemed to occur between MACs with differing OS, 10.6 - 10.8 at first. A file which was created on a 10.6 MAC could not be opened without updating all links on a 10.8 MAC. That is why we updated everything to 10.8. The error did not occur for about 2-3 weeks but then reoccured again.?
    Have you heard anything similar?

  • What are the problems in Nokia N95 8G ??

    what are the problems in Nokia N95 8G other than cover of camera lens?? thanks very much.

    *** daisy7330 please do not post an off-topic response in a topic not relating to the subject.
    Please post a new topic regarding your problem. ***
    Generally the views I have been seeing about the N95-8GB is its a whole lot better build, and generally better than its baby brother the N95.
    Maybe these links might help?
    http://www.allaboutsymbian.com/reviews/item/Nokia_N95_8GB.php
    http://www.trustedreviews.com/mobile-phones/review/2007/12/16/Nokia-N95-8GB/p1
    http://reviews.cnet.co.uk/mobiles/0,39030107,49294472,00.htm
    Owned: Nokia 3510i, Nokia 3120, Nokia 6230i, Nokia 6233, Nokia N73, Nokia N82.
    Current: Nokia N900!

  • TS2516 an error occurred uploading my iPhoto Book order. It puts the book together and starts to send but at the very last moment comes up with an error message. but checking the book in iPhoto there are no problems to be found.

    an error occurred uploading my iPhoto Book order. It puts the book together and starts to send but at the very last moment comes up with an error message. but checking the book in iPhoto there are no problems to be found.

    This user talked to Apple Support personnel and confirms what Larry is suggesting:
    crowland1066
    Re: book upload fails
    Nov 30, 2013 3:02 PM (in response to pablo123)
    Just got off the phone with apple support.  If the photo book completes the assembly process but fails during the upload process the problem is in their overloaded servers.They just started a free shipping promotion for the holidays which has increased the traffic dramatically. I bought a calendar a week ago and it went right through. I'm going to try again during less peak times.
    Happy Holidays

  • What are the problems associated with Minecraft game and Apple computers

    What are the problems with Minecraft game and Apple computers.  I've read that the two are incompatible.

    You have a very limited amount of time before night falls and the monsters might come out. You have to HOLD DOWN the mouse button to hit things to change them. Hit the earth to dig a cave. Hit a tree repeatedly to get wood.
    A two button mouse is superior, because a lot of actions require a left click. <-- OH That is why they say it is not compatible!
    It is compatible, you just need to left click sometimes!

  • What are the problems in processing batch input sessions?

    hi,
    What are the problems in processing batch input sessions? How is batch input process different from processing on line?
    regards.

    sorry, question resolved.

  • What are the problems in N95 software update V20?...

    what are the problems in N95 software update V20?
    and is the mean of UPnP and USB Mass Storage and what are thier uses?
    THANKS EVERYBODY FOR YOUR ANSWERS..

    19-Dec-2007 11:15 PM
    tito_6646 wrote:
    what are the problems in N95 software update V20?
    and is the mean of UPnP and USB Mass Storage and what are thier uses?
    THANKS EVERYBODY FOR YOUR ANSWERS..
    Read this topic its about them: /discussions/board/message?board.id=swupdate&message.id=24327#M24327
    USB Mass Storage is the possibility to use your phone as a simple flash memory without the need of any additional drivers and apps, just plug it to you PC and write/read/copy the data.
    UPnP is a something like a Wi-Fi protocol which allows u to view you images or listen to music on a compatible devices (PC, TV, music centers etc) over the air.

  • Adobe aftereffects is not working on os x maverics all updates...... is dis soft. will work on the new os x yosemite.??  y apple is nt working on dis problem wen users are facing problems with new os x .....

    Adobe aftereffects is not working on os x maverics all updates...... is dis soft. will work on the new os x yosemite.??  y apple is nt working on dis problem wen users are facing problems with new os x .....

    I suggest you contact Adobe tech support or their Mac forums for assistance.

Maybe you are looking for