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.

Similar Messages

  • 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.

  • 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

  • JTextpane positioning repaint problems

    Hello all,
    I have encountered a bug with JTextpane which I haven't found a solution for. I am new to Java and am revising previously written code, but I think this is a Java-related issue and not particular to my source code.
    I am writing html into a JTextPane-based class, yet on occasion, not keen to any particular scenarios, my text loses its position and drops one line. This is fixed by closing the window, hiding it or doing other things which I assume forces a repaint.
    This is very hard to debug. Is there a way to force all events to be called whenever I display the html textpane (like a VB6 DoEvents)? Has anyone encountered these repaint problems with JTextPane?
    Thanks in advance
    Eyal

    Thanks for the reply
    Could you please xplain what you mean by "subbing"?
    Anyhow I tried adding your suggestion but I am still encountering similar problems, and I can't debug because the symptoms don't appear in a consistent fashion.
    If anyone has any suggestions I'd love to know.
    Best regards
    Eyal

  • 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

  • T500 Vista buying experience and initial setup problems

    This a long post but I felt the information could be used by others buying a notebook and trying to set it up.
    I have used a Thinkpad T40 (1 GB, XP Pro) at work since 2003  and just love the rock-solid keyboard, screen, and hinges. The IT department has offered me the most recent Dell computer as an upgrade but I much prefer to keep my old reliable T40.
    When my daughter needed a notebook for university in September, it was only natural to consider Lenovo, having heard about too many quality problems with other manufacturers. I wanted this notebook to last through the 4 years without any hardware problems.
    I did a lot of research on the Web and read numerous Thinkpad forums. The information gathered was invaluable for deciding which configuration to buy. Note that I have never used VISTA before, nor have I ever opened a notebook to replace parts.
    Buying experience:
    - On my first contact with the Lenovo Sales desk in Canada, they mentioned there was a special 25% coupon sale, if my configuration was over $1500 (discounted price). These specials come back often, so it is best to check the Lenovo site. At the time, there was a free integrated camera, free upgrade to 250 MB HDD and free shipping. Since these promotions can be removed at any time, I decided to place an online order for a Thinkpad T500, before having completed all my research. It is easy to place an order online. You just have to remember that not all items contribute to making up the $1500, such as MS Office software.
    - Lenovo Sales telephone support for answering any questions about online ordering was outstanding and very helpful.
    - Note that if a particular online configuration is there one week, it might not be there the next week. It depends on parts availability at Lenovo.
    - In order to get the 25% coupon discount, I had to add some items to my configuration to reach $1500, such as Bluetooth, Wifi 5100, which I did not really need, but the saving on the overall cost was worthwhile.
    - I had ordered a WXGA (1280 x 800) High Brightness LED Backlit screen and 3 GB of RAM. After reading about the poor display quality of these screens, I was able to cancel my order by phone the next day (after making sure the same deal was still available), and place a new revised order for a WSXGA+ TFT (1680 x 1050) screen. Since the configuration price for an additional 2 GB RAM was $110 CDN, I decided to buy the extra 2 GB RAM (only $43 CDN) as an accessory, on the same order, separate from the T500 configuration. I could then install the RAM myself to save $67 ! Just make sure you pay the extra to get the base 2 GB RAM on one DIMM, since there are only 2 slots available. I know I will only be using 3.5 GB with my 32-bit Windows, but at least, if one of the DIMMs goes bad, I can still operate on 2 GB.
    - as for choosing which CPU to buy, I chose in the middle range, starting with the first CPU having 3 MB L2 cache.
    - I did not buy MS Office or McAfee Antivirus with the configuration. Since my daughter attends a post-secondary institution, she was able to order MS Office Ultimate 2007 for $64 CDN + $13 for the DVD. Microsoft has had this promotion on their site
     (http://www.microsoft.com/student/discounts/theultimatesteal-ca/default.aspx)
    for a while, but it is not well known. You get 8 MS products for one low price and it is completely legal for numerous countries ! I downloaded the software since it took 5 weeks to get the DVD delivered ! At the end of 4 weeks, I contacted Microsoft to tell them I had still not received the DVD. So I received the first DVD and a few weeks later, I received a second copy. So much for quick shipping !
    Initial impressions:
    - I received 3 separate shipments: 1 free Thinkpad privacy filter to install on the screen, the 2 GB RAM, and finally the T500 (which took about 2 weeks).
    -The stainless steel hinges are rock-solid. When trying to raise the lid in the first weeks, you have to hold down the keyboard. Not at all like the hinges I see on the Dell notebooks at work.
    - The 3 USB port connections are very tight, which means they should last through repeated plugging and unplugging.
    - The T500 is surprisingly quiet, more than my T40. You can hardly hear the fan.
    - I am extremely satisfied with the screen resolution, colours, and quality.
    - The only disappointment was the keyboard ! Typing on the left-hand side (Q,W keys) produced an annoying "clunk". This was the worst keyboard I had ever used, being accustomed to the legendary quality of my T40. Even my daughter complained about the keyboard. I had read on the forums about the "flex" in the keyboard. Before ordering, when I asked the Sales Rep if these known problems had been solved, I was told that yes, the keyboard flex was no longer an issue. Too bad this was not true !
    Initial Setup:
    - Setup was easy. Just follow the on-screen instructions.
    - I was not very happy to see a trial version of MS-Office and McAfee Antivirus on my notebook. I had not ordered it on the online configuration and did not want it. I had read on the forums that other users had all sorts of problems trying to get their own version of MS Office working (activation keys not being recognized), when the pre-loaded software was still there. And I knew how difficult it could be to erase all traces of McAfee by myself.
    Hardware problems:
    - after I burned my very first DVD, I pressed the Eject button. To my surprise, there was a thin grey foam ring (about 3 cm diameter) sitting on top of my DVD media. I assumed that this came from the roof of the DVD drive and the manufacturing process had missed the glue to keep it there. I contacted Lenovo and they immediately sent out a replacement (received the next day), which was easy to install. I then returned the defective part to Lenovo. My only complaint is that this was a refurbished unit. I was expecting a new unit since the part was defective out of the box and not a few months later.
    - for the defective keyboard, I contacted Lenovo and mentioned the numerous complaints on the forums, and they sent me a new keyboard (FRU 42T3938). Unlike the DVD drive, I did not have to send back the original keyboard. However, the replacement keyboard was exactly the same as the original, with a thin flexible backing full of holes. I contacted Lenovo again in the morning and the agent mentioned I should contact Sales, since there was nothing more he could do. That afternoon, the agent called me to say that after further research, he had found a replacement keyboard that would correct the flex. When I received the second replacement keyboard (FRU 42T3210), I knew it was the right one, since there were far less holes in the more solid backing plate. I followed the instructions for replacing the keyboard and added my additional 2 GB RAM at the same time, since it is in the same area, under the palm rest. Now the keyboard is almost like my solid T40, and I am no longer ashamed of the T500 keyboard. For those of you wondering what an ACNOR or CSA keyboard is, it is one where the 5 most common French accented characters (and not only the é) are used with one keystroke. I have been using such a keyboard disposition since 1994 and it is invaluable when typing in French.
    For pictures comparing the defective and replacement keyboards, see
    http://forums.lenovo.com/t5/T400-T500-and-newer-T-series/T500-keyboard-replacement/m-p/158451#M15525
    My immediate goals:
    - out of the box, there are 3 partitions: partitions Q (10 GB)  and S (1 GB) are Lenovo partitions to recover the operating system, C partition is a single partition over 200 GB on my 250 GB DD. I wanted to partition the C: drive in multiple partitions.
    - I also wanted to eliminate MS Office and McAfee so I could install my own software (MS Office 2007 Ultimate and free Avast Antivirus). When I contacted Lenovo to ask how I could do this, they said I could use the recovery partition and "customize" it so that this software would not be installed. Turns out that this option was removed by Lenovo. I guess pressure from Microsoft and McAfee was too great ! The only other option was to use Add/Remove.
    Partitioning problems.
    - I ran Diskmgmt.msc (also available on XP) to see the layout of my HDD. Unfortunately, it did not seem to be powerful enough to partition like I wanted. But it is great to see the layout of the disk and do basic partitioning. (http://www.theeldergeek.com/hard_drives.htm)
    - I installed the free EASUS Partition Manager (http://www.partition-tool.com/); the non-free Pro version works on 64-bit.  I wanted to partition: C 35GB (Operating System and Office), D 20GB (other applications), E 25GB (Data), F 100GB (Music and Pictures). I also installed the free EASUS Todo Backup (http://www.todo-backup.com/) to do regular image backups as I was proceeding.
    - while trying to partition the C drive, I must have made an error somewhere (I think I accidentally declared another partition as the active partition). Whenever I rebooted, I would get the message "Boot MGR is missing". I could not even use the recovery partition (Q and S) on the HDD. So my notebook was totally unusable. Fortunately, I had burned 4 Recovery DVD's, as soon as the OS was operational. The first recovery DVD booted OK. However, the system would not recognize any of the 3 other recovery DVD, displaying a message such as wrong disk inserted or something similar. Imagine if in a few months I had needed to use these recovery DVD that I had burned; they were completely useless and I would have nothing to recover with. Very scary !
    - I explained the problem to Lenovo Support and they sent me within 3 days a set of 4 Rescue & Recovery DVD. By following the instructions, it took 2 hours to recover to a working system. The good: no Office or McAfee trial software came with this recovery. The bad: there was a 2 GB empty partition at the beginning of the HDD and 10 GB of unallocated space at the end of the disk. Why Lenovo would do this, I don't know; seems a bit sloppy to me. Also, I had to manually reconfigure everything, since there is no "just follow the instructions" as when configuring the "out-of-the-box" system. I had to install my own PDF viewer
    (free open source PDF X-viewer http://www.docu-track.com/home/prod_user/PDF-XChange_Tools/pdfx_viewer), Adobe Flash, etc...
    - the major problem in partitioning is the inability to shrink a partition (such as C) in order to free up space after to add extended partitions
    (http://www.howtogeek.com/howto/windows-vista/working-around-windows-vistas-shrink-volume-inadequacy-...). There always seems to be VISTA unmovable files, MBR or something else. After reading numerous posts, I installed the trial version (30 days) of Raxco PerfectDisk Home edition in order to consolidate all the files to the front of the C: drive. A few iterations were required since the MBR seems to be placed in the middle of the partition. I was finally able to partition my HDD exactly as I wanted. I was so pleased with the efficiency and ease of use of PerfectDisk that I bought the Pro 10 version. Just wait for when the software is occasionally discounted. (http://www.perfectdisk.com/home)
    VISTA User account setup:
    I had created my E partition to store all user data of all accounts, since I would have multiple accounts on the computer. I also wanted to store all music and pictures in the Public folder on F partition. There are numerous methods described on the Internet, most of which seem too complicated. See http://joshmouch.wordpress.com/2007/04/07/change-user-profile-folder-location-in-vista/ and
    http://www.vista4beginners.com/Move-user-files-folders-to-another-partition?page=1. I finally decided to do just 2 simple registry modifications described in the last post here
    (http://superuser.com/questions/6391/moving-users-folder-on-windows-vista-seven-to-another-partition).
    It worked for me but use at your own risk ! Just edit the 2 Registry keys and replace the C: drive by the one you need.
    - I only had the Admin account created on the C: partition. Before creating any other user accounts, I modified the registry so that all new user accounts created would use my E partition.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList  ProfilesDirectory = E:\Users
    - I modified the registry so that the Public folder would be on my F partition.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList  Public = F:\Public
    Other notes of interest:
    - I had been a long-time subscriber to the Fred Langa Langalist
    (http://www.langa.com/backups/backups.htm). I now subscribe to the excellent Windows Secrets newsletter (http://www.windowssecrets.com/). The information provided is very useful.
    - I had considered an inexpensive boot manager, partition manager and imaging software (BootIt Next Generation) highly recommended by Fred Langa
    (http://www.terabyteunlimited.com/index.htm). But it seemed a bit like overkill for my needs. There is a fully-functioning trial version.
    - I regularly consult a complete list of recommended free software on Gizmo's Freeware review (http://www.techsupportalert.com). One recommended free open source defragmenter which I did not use was MyDefrag (http://www.mydefrag.com/).
    - download and install the latest version of the Lenovo System Tools (Toolbox). It is very easy to use and can troubleshoot all hardware problems. Search for MIGR-67520 on the Lenovo site.
    - you can find Roxio DVD burning software on the Lenovo site (MIGR-72359 on the Lenovo site). I have not installed it yet.
    - use the Lenovo System Update to keep your drivers up-to-date.
    - for info on how to use switchable graphics, search on the Lenovo site for MIGR-70495.
    - for tips on setting battery parameters, http://forum.notebookreview.com/showthread.php?t=320082
    Recommendations to Lenovo:
    - don't ship poor quality keyboards. You have too much to lose, for the small manufacturing savings.
    - don't pre-install trial versions of Office or McAfee. This should be an option and not be forced onto buyers.
    - at least ship the HDD with a 40 GB C primary partition and the rest as D: partition. This would make it easier for users who are not technical.
    - if you are going to include an integrated camera, provide software to use it. Currently, I have no way of taking a picture or making a video without acquiring other software. The technique described here
    (http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-67413) does not work !
    - provide some software to reduce the speed of the DVD drive when watching movies. The noise at the default maximum speed is very annoying.
    Thinkpad T500 | Model 2081-CTO | Intel Core 2 Duo P8700 (2.53GHz, 1066MHz 3MB L2 Cache) | 4 GB PC3-8500 DDR3 RAM | 15.4" WSXGA+ | ATI Mobility Radeon 3650 (256MB) | 250GB Hitachi HDD (5400rpm) | Bluetooth 2.1 | Integrated Camera | DVD Recordable UltraBay Slim | Intel Wifi Link 5100 | Sony 6-cell Li-Ion battery | Vista Home Premium 32-bit SP1

    people complaining about problems installing an office over another office are (dare i say it) stupid. it makes absolutely no sense installing one over the trial version. just uninstall the trial and you'll be fine. every single time.
    as for problem with uninstalling mcafee (or any other antivirus, for that matter, just download the uninstaller from the software company e.g. http://service.mcafee.com/FAQDocument.aspx?id=TS100507 for mcafee.
    that said i believe you get to choose if you want mcafee and/or office when you go through the inital boot, the "on-screen instructions"
    you can slow down the odd via power manager
    and thanks for the tips on changing the reg to have the user profiles somewhere else!
    T400s - 2815RW1 + Win7 Ultimate
    Don't pm me for help! That's what the forum is for. Also, Google's nicer than me. Ask him.

  • InternalFrame repaint problem, pls help

    I am develop my final year project which is a drawing tool using the Model-View-Controller with Observer and internalFrame. When more than one document is create in the program, the content of activated internalFrame can display properly, but the problem is that other internalFrame also repaint the content become to the activated internalFrame content.
    How can i make other inernalFrame repaint the content properly??
    public class Sketcher
    public static void main(String[] args)
    theApp = new Sketcher();
    theApp.init();
    public void init()
    window = new SketchFrame("Sketcher", this); // Create the app window
         window.setBounds(0,0,500,500);
    window.addWindowListener(new WindowHandler() // Add window listener
    // Handler for window closing event
    public void windowClosing(WindowEvent e)
    {  window.checkForSave();  };
    desktop = new JDesktopPane(); //a specialized layered pane
    createFrame();
    window.getContentPane().add(desktop, BorderLayout.CENTER);
    window.setVisible(true);
    // Return a reference to the application window
    public SketchFrame getWindow()
    return window;
    // Return a reference to the model
    public SketchModel getModel()
    return sketch;
    // Return a reference to the view
    public SketchView getView()
    return view;
    // Handler class for window events
    class WindowHandler extends WindowAdapter
    // Handler for window closing event
    public void windowClosing(WindowEvent e)
    // Code to be added here later...
    public void insertModel(SketchModel newSketch)
         MyInternalFrame frame2 = new MyInternalFrame();
         frame2.setVisible(true); //necessary as of kestrel
         sketch2 = new SketchModel(); // Create the model
         view2 = new SketchView(this); // Create the view
    sketch.addObserver((Observer)view2); // Add the view as observer
    sketch.addObserver((Observer)window); // Add the app window as observer
         JComponent c = (JComponent) frame2.getContentPane();
         c.add(view, BorderLayout.CENTER);
         desktop.add(frame2);
         try {
         frame2.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}
    protected void createFrame() {
    MyInternalFrame frame = new MyInternalFrame();
         frame.setVisible(true); //necessary as of kestrel
         sketch = new SketchModel(); // Create the model
         view = new SketchView(this); // Create the view
              JComponent c = (JComponent) frame.getContentPane();
         sketch.addObserver((Observer)view); // Register the view with the model
         sketch.addObserver((Observer)window); // Register window as observer
    c.add(view, BorderLayout.CENTER);
    desktop.add(frame);
    try {
    frame.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}
    JDesktopPane desktop;
    private JTextArea JtextArea;
    private SketchModel sketch, sketch2; // The data model for the sketch
    private SketchView view, view2; // The view of the sketch
    private static SketchFrame window; // The application window
    private static Sketcher theApp; // The application object

    You should call frame2.setVisible(true) after the addition of view in the contentPane of the frame :
    public void insertModel(SketchModel newSketch) {
       MyInternalFrame frame2 = new MyInternalFrame();
       sketch2 = new SketchModel(); // Create the model
       view2 = new SketchView(this); // Create the view
       sketch.addObserver((Observer)view2); // Add the view as observer
       sketch.addObserver((Observer)window); // Add the app window as observer
       JComponent c = (JComponent) frame2.getContentPane();
       c.add(view, BorderLayout.CENTER);
       desktop.add(frame2);
       try {
           frame2.setSelected(true);
       catch (java.beans.PropertyVetoException e) {}
       frame2.setVisible(true); //necessary as of kestrel
    }I hope this helps,
    Denis

  • PI 7.1 initial setup problem

    Hi,
    While installing PI 7.1 I started the Netweaver initial setup. At step 338 i got an error message as follows:
    "Error: ABAP technical system 'PI7 on nwpi71' not found"
    Any idea how to I can solve this problem.

    Just a quick question... Can you proceed past this step or does your install stop completely if this is not fulfilled?
    The reason I ask is that this should either be done automatically by the install or if not then once the install is finished you have the oppotunity to create the technical and business systems as post config steps...
    RZ70 is the transaction that you use to register the technical system

  • Repainting problems of the Menu items in Oracle Help Navigator

    All,
    I am facing a strange problem when using Oracle Help for my application which is developed in Java,Swings.
    Whenever, I open Help for any component through my application, the menu items in the Help screen are not visible. They are not getting repainted. Only when user drags the mouse over the items, they are getting repainted and visible to the user. This has been raised as a bug by our testing people. I couldn't get any help in aspects of any errors/exceptions being logged when the action takes place.
    Where can I have the log files for Help window?
    Can anyone help me and guide me to the right solution in this regards.
    My environ is like this:
    Windows NT, JRE1.4, Oracle Help - ohj-jewt-4_1_16.jar,
    Thanks in advance for all.
    regards,
    Kishore.

    iweb2 navbar is rendered by javascript widget, therefore you can change navbar font style with javascript; this is an efficient way to change navbar font style.
    Copy and paste the following into your pages using HTML Snippet:
    <script type = 'text/javascript'>
    function changeNavbar() {
    navCSS = parent.document.getElementById('widget0-navbar');
    navCSS.style.fontSize = '0.75em'; // font size, change to less than 1em to change font smaller;
    navCSSbg = parent.document.getElementById('widget0-bg');
    navCSSbg.style.textAlign = 'center'; // navbar list alignment;
    clearInterval(chkNavbar);
    chkNavbar = setInterval('changeNavbar()', 500);
    note: You won't see the changes in iweb, but you will see the change when view the pages online - after publishing.

  • PDF Initial Browser doesn't open PDF with Bookmarks as initial view - Problem (Help)

    I've saved a PDF with Initial view of Bookmarks panel and
    page opn my client and it opens with the bookmarks. I publish the
    file from my PC via Contribute and open it with my browser and it
    opens in the pages view. NOTE: when i open the PDF in Contribute,
    it opens with no special view.....

    Hey Jacksoup --
    I don't believe this is a "Contribute" issue at all.  I'm having the same problem with a .PDF of my own that I've published to the Web and I'm not using that software. 
    I had one original .pdf file that had no bookmarks.  Bookmarks were then added to the doc and resaved.  On the new version I have the document's file properties set to open bookmarks on initial view.  The document opens fine locally on my computer, but when I publish to the web (not using contribute), and then try to open the .pdf via hyperlink it opens in MSIE and the bookmarks do not appear on initial view.  It's driving me crazy.
    I'm wondering if this is some sort of adobe cache issue?  Where it's opening the document like the original?  Or if it's something to do with MSIE?  I have already cleared my browser cache and I also updated my adobe acrobat preferences to NOT restore last view settings when opening documents. 
    I have tried adding #pagemode=Bookmarks to the end of the URL to the doc...
    Everything I've read and researched on line tells me I have done all I can do.  Are we just $#!+ out of luck here or what's the deal Adobe?
    Thank you for your time! 

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

  • JTree Repaint Problem .

    I'm creating a dynamic JTree by querying th DB. The JTree has to reflect the changes if any.
    But the problem is that although I'm getting all the correct nodes in the JTree, the tree display is not repainted if the window is maximized or focussed and the tree area is displayed grey. Other components like buttons etc are correctly visible.
    If I click in the greyed area of the JTree then that particular node is visible and the rest nodes are hidden.
    same problem comes when I have a JPopup for the nodes.. It leaves a greyed rectangle in place of the JPopup.
    Any suggestions will be a great help.
    - Praveen

    I tried the reload , revalidate and the repaint method of the Treemodel, but nothing changed... its all the same.I'd like to explain in full what am I doing.
    I have some items in the DB which are shown in the JTree. When any Item is added to the DB I poll the DB
    after an interval to check new entries or deleted entries, and this is to be updated to the JTree.
    The additions and deletions are going on properly a/c to the DB the only problem being that , that if the window(JFrame) containing the JTree (JTree is contained in JScrollPane) is minimized or hidden, then only the JTree is greyed and not the other components such as the buttons.
    Interestingly if I double click in the JTree area then the Jtree becomes visible properly. This happens after each update of the JTree.
    Hope this description will give a better view.
    Thanks for all your previous helpful hints.

  • Initial Context Problem

    I have developed local entity bean in weblogic 8.1
    but i wouldnt able to get the Initial Context of the Bean.
    It throws javax.naming.NoInitialContextException
    But in jndi tree it shows the bean..
    the problem is only for Local Bean
    Remote Beans are working fine

    G,
    One thing I would make sure of is that you are not deploying oc4j.jar file as part of you ear. Check the 'exploded' ear file under WEB-INF/lib to ensure that you do not have an oc4j.jar file under it.
    It usually happens that in your Jdev Project, if you had included the oc4j.jar library solely to compile, but when you generated the deployment profile it would by default include all the libraries that are part of the project. You can correct this by right clicking the deployment profile and editing its properties to exclude the libraries that you don't want to deploy.

  • Urgent : JMenuBar repaint problem

    hello all,
    i'm facing a problem with jmenubar. i have developed an applet which contains a jmenubar, toolbaar & a panel. i'm doing some operation on the panel like rotating it by different angles. these operations are given in the menu. i have given accelerator keys for these menuitems. when i operate with these accelerator keys everything works fine. but when i click on the menuitem then a part of the panel gets panited on the menubar. but when i minimize the window & open it again the extra portion on the menubar disappears. can u suggest me what might be the problem with this. what is happening when we click a menuitem?
    any help is appreciated.
    Thanks in advance

    i solved it by changing repaint() into revalidate() & paintImmediately()
    i didn't get the reason why this works instead of repaint but now the code is working perfectly.
    This was the 1st time i did a cross posting. I had to deliver the solution that day itself that's why i posted it on different forms. i thought some experts will check the forms which they r interested. anyway learned a lesson from this. won't repeat it.

Maybe you are looking for

  • What dose a Mac Mini actually do?

    Yes i wanted to know what a mac mini, dose. lets say you use it with a iBook G3, but need a G4 processor, but can't buy a new computer, what dose it do? Can your iBook G3 get upgraded to a G4 or what? i'm confused about this whole deal, so if theres

  • Smartforms: logo to PDF

    We need to include our company logo in a PDF. The PDF is generated by FM CONVERT_OTF from Smartforms OTF output. Problem: The printed PDF has a nasty gray background in the white portions of the logo. Output directly from SAP looks fine both on scree

  • InfoPath 2010 and REST web services, custom code button firing twice and second click fires error

    Hi, I have two supposing simple issues which I'm having problems correcting. If a add a button to the form and write some custom code (See below) to submit some data via a REST Web Service data connection. The code runs but somehow fires the URL twic

  • Problems getting on my wireless network

    I am having problems getting on my wireless network. I have never had a problem with it before. I changed the password yesterday. However, I was on it until this morning. I have never had a problem before and I am on it currently with my MacBook Pro.

  • Base64 and iFS

    Hello forum, I want to process some xml documents with binary content using existing xml parser. Suppose my xml document is something like this: <?xml version = '1.0' standalone = 'yes'?> <PrintedDoc> <Name> filename.pdf </Name> <FolderPath> /printed