Пример #1
0
  /** Clear the current cells and replace with the indicated starting pattern. */
  public void reset(String patternName) {
    stop = true;
    int temp = generationMax;
    setGenerationCount(0);
    setMaxGenerations(0);
    if (patternName.equals("Random")) {
      theModel.reset(0.5);
    } else if (patternName.equals("R-Pentamino")) {
      theModel.reset(1);
    } else if (patternName.equals("Box")) {
      theModel.reset(2);
    } else if (patternName.equals("X Box")) {
      theModel.reset(3);
    }

    canvas.repaint();
    // runGenerations(); //* Replace this by appropriate use of a thread

    synchronized (canvas) {
      canvas.notifyAll();
      stop = false;
      canvas.repaint();
    }
    setMaxGenerations(temp);
    setGenerationCount(0);
  }
 /**
  * Respond to selections within the left list.
  *
  * @throws InvocationTargetException
  * @throws InterruptedException
  */
 private void respondToListClick() {
   this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   enableOrDisableActions();
   int idx = archetypeList.getSelectedIndex();
   if (idx == -1 || idx >= listData.size()) {
     // no selection
     if (archetypeControl == null) {
       return;
     }
     archetypeControl.removeNameChangeListener(this);
     rightPanel.removeAll();
     archetypeControl = null;
     rightPanel.add(selectLeftLabel);
     rightPanel.repaint();
     return;
   }
   if (archetypeControl == null) {
     archetypeControl = new ArchetypeControl(listData.get(idx));
     setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     rightPanel.removeAll();
     rightPanel.add(archetypeControl, BorderLayout.CENTER);
     rightPanel.repaint();
     rightPanel.revalidate();
     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     archetypeControl.addNameChangeListener(this);
   } else {
     archetypeControl.setArchetype(listData.get(idx));
     archetypeControl.repaint();
   }
   this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 }
Пример #3
0
  public static void main(String[] args) {
    final JavaMixer sm = new JavaMixer();
    final JFrame jf = new JFrame("Mixer Test");
    final JPanel jp = new JPanel();
    jf.add(jp);
    jp.add(sm.getTree());
    jf.setSize(600, 500);
    jf.setVisible(true);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    sm.getTree()
        .addTreeSelectionListener(
            e -> {
              TreePath path = e.getPath();
              if (path.getLastPathComponent() instanceof ControlNode) {
                ControlNode controlNode = (ControlNode) path.getLastPathComponent();
                if (!(controlNode.getControl() instanceof CompoundControl)) {
                  if (jp.getComponentCount() > 1) jp.remove(1);
                  jp.add(controlNode.getComponent(), 1);
                  jp.repaint();
                }
              }
            });
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedInputVolume());
    jp.repaint();
    sm.setMicrophoneInput();
    sm.setMuteForMicrophoneOutput();
  }
Пример #4
0
  private void browseItem(DiscoverItems.Item discoveredItem) {
    addAddress(discoveredItem.getEntityID());
    browsePanel.removeAll();
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
    DiscoverItems result;
    try {
      result = discoManager.discoverItems(discoveredItem.getEntityID());
    } catch (XMPPException e) {
      browsePanel.invalidate();
      browsePanel.validate();
      browsePanel.repaint();
      return;
    }

    Iterator<DiscoverItems.Item> discoverItems = result.getItems();
    List<Entity> list = new ArrayList<Entity>();

    while (discoverItems.hasNext()) {
      DiscoverItems.Item item = discoverItems.next();
      Entity entity = new Entity(item);
      browsePanel.add(entity);
      list.add(entity);
    }

    GraphicUtils.makeSameSize((JComponent[]) list.toArray(new JComponent[list.size()]));

    browsePanel.invalidate();
    browsePanel.validate();
    browsePanel.repaint();
  }
Пример #5
0
  public void findCabinets() throws DfException {
    // combo.setEnabled( false );
    treepanel.removeAll();
    treepanel.add(new JLabel("Loading..."));
    addWorkInProgress();
    treepanel.revalidate();
    treepanel.repaint();

    /*
     * IDfQuery query = con.createQuery(
     * "select object_name from dm_cabinet ORDER BY object_name" );
     * IDfCollection col = query.execute( con.getSession(),
     * IDfQuery.DF_READ_QUERY );
     *
     * combo.removeAllItems(); combo.addItem( "[All]" ); while ( col.next()
     * ) { IDfValue attrValue = col.getValue( "object_name" );
     * combo.addItem( "/" + attrValue.asString() ); } col.close();
     */

    treepanel.removeAll();
    treepanel.revalidate();
    treepanel.repaint();
    removeWorkInProgress();
    // combo.setEnabled( true );
    swingActionHotSelect();
  }
  public void acceptInstance(InstanceEvent e) {
    if (e.getStatus() == InstanceEvent.FORMAT_AVAILABLE) {
      Instances structure = e.getStructure();
      m_legendText = new Vector();
      m_max = 1.0;
      m_min = 0;
      int i = 0;
      for (i = 0; i < structure.numAttributes(); i++) {
        if (i > 10) {
          i--;
          break;
        }
        m_legendText.addElement(structure.attribute(i).name());
        m_legendPanel.repaint();
        m_scalePanel.repaint();
      }
      m_dataPoint = new double[i];
      m_xCount = 0;
      return;
    }

    // process data point
    Instance inst = e.getInstance();
    for (int i = 0; i < m_dataPoint.length; i++) {
      if (!inst.isMissing(i)) {
        m_dataPoint[i] = inst.value(i);
      }
    }
    acceptDataPoint(m_dataPoint);
    m_xCount++;
  }
Пример #7
0
 private JPanel addResultPane() {
   JPanel resultPane = new JPanel(new BorderLayout());
   resultPane.setOpaque(false);
   int componentCount = southPanel.getComponentCount();
   if (componentCount == 0) {
     southPanel.add(resultPane, BorderLayout.CENTER);
     southPanel.revalidate();
     southPanel.repaint();
   } else {
     JTabbedPane tabbedPane;
     Component component0 = southPanel.getComponent(0);
     if (component0 instanceof JTabbedPane) {
       tabbedPane = (JTabbedPane) component0;
     } else {
       JPanel query1Panel = (JPanel) component0;
       southPanel.remove(0);
       tabbedPane = new JTabbedPane();
       tabbedPane.addTab("Query 1", query1Panel);
       southPanel.add(tabbedPane, BorderLayout.CENTER);
       southPanel.revalidate();
       southPanel.repaint();
     }
     tabbedPane.addTab("Query " + (tabbedPane.getTabCount() + 1), resultPane);
   }
   return resultPane;
 }
  /**
   * Accept a data point (encapsulated in a chart event) to plot
   *
   * @param e a <code>ChartEvent</code> value
   */
  public void acceptDataPoint(ChartEvent e) {
    if (e.getReset()) {
      m_xCount = 0;
      m_max = 1;
      m_min = 0;
    }
    if (m_outputFrame != null) {
      boolean refresh = false;
      if (e.getLegendText() != null & e.getLegendText() != m_legendText) {
        m_legendText = e.getLegendText();
        refresh = true;
      }

      if (e.getMin() != m_min || e.getMax() != m_max) {
        m_oldMax = m_max;
        m_oldMin = m_min;
        m_max = e.getMax();
        m_min = e.getMin();
        refresh = true;
        m_yScaleUpdate = true;
      }

      if (refresh) {
        m_legendPanel.repaint();
        m_scalePanel.repaint();
      }

      acceptDataPoint(e.getDataPoint());
    }
    m_xCount++;
  }
Пример #9
0
  private void actionHotSelect() {
    // combo.setEnabled( false );
    try {
      treepanel.removeAll();
      treepanel.add(new JLabel("Loading...", LUF.DOT_RED, JLabel.CENTER));
      addWorkInProgress();
      treepanel.revalidate();
      treepanel.repaint();
      // String folderName = (String)combo.getSelectedItem();
      IDfId folderId = null;
      /*
       * if ( !"[All]".equals( folderName ) ) { IDfFolder folder =
       * con.getSession().getFolderByPath( folderName ); if( folder ==
       * null ) {
       * System.out.println("Folder or cabinet does not exist in the Docbase!"
       * ); return; } folderId = folder.getObjectId(); }
       */

      tree =
          new ContentTree(con, folderId, timer, (ApiTypes) node.getSingleApi(ApiTypes.class), this);
      tree.setShowDocuments(showDocuments);
      treepanel.removeAll();
      removeWorkInProgress();
      treepanel.add(tree, BorderLayout.CENTER);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    // combo.setEnabled( true );
    treepanel.revalidate();
    treepanel.repaint();
  }
  public void setTopRightPanelDeprecated(File f) {
    try {
      if (f.isDirectory()) {
        // Do nothing, leave it as it is
      } else if (f.getName().equalsIgnoreCase("General Settings.xml")) {
        //   JGeneralSetupPanel jgsp = new JGeneralSetupPanel(f);
        // rightTopPanel.add(jgsp);
        // System.exit(-1);
        // this.remove(rightTopPanel);
        // this.rightTopPanel = jgsp;
        // this.add(rightTopPanel);
        rightTopPanel.validate();
        rightTopPanel.repaint();

      } else if (f.getName().endsWith("xml")) {
        // JParameterSetupPanel jpsp = new JParameterSetupPanel(f);
        this.remove(rightTopPanel);
        // this.rightTopPanel = jpsp;
        this.add(rightTopPanel);
        rightTopPanel.validate();
        rightTopPanel.repaint();
      }
    } catch (Exception e) {
      System.out.println("Some error processing " + f.getName());
    }
  }
Пример #11
0
 private void edges() {
   int[] greypxls = imageUtils.convertToGrey(img);
   int[] edgepxls = imageUtils.edges(greypxls, img.getWidth(), img.getHeight());
   BufferedImage greyimg = imageUtils.intToImage(greypxls, img.getWidth(), img.getHeight());
   picLabel.setIcon(new ImageIcon(greyimg));
   panel.repaint();
   BufferedImage edgeimg = imageUtils.intToImage(edgepxls, img.getWidth(), img.getHeight());
   picLabel1.setIcon(new ImageIcon(edgeimg));
   panel_1.repaint();
 }
Пример #12
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == easy) {
      invSpeed = 50000;
      bombN = 1;
      timeDifficulty1 = 1000;
      distanceLimit = 400;
      monsterMultiplier = 1;
      multiplier = 1;
      setup();
    } else if (e.getSource() == hard) {
      invSpeed = 30000;
      bombN = 4;
      timeDifficulty1 = 500;
      distanceLimit = 200;
      monsterMultiplier = 2;
      multiplier = 2;
      setup();
    } else if (e.getSource() == back) {
      r = null;
      menu.setVisible(true);
      back.setVisible(false);
      this.revalidate();
      repaint();
    } else if (e.getSource() == howTo) {
      menu.removeAll();

      menu.add(howToBack);
      menu.add(howToIMGL);

      menu.revalidate();
      menu.repaint();
    } else if (e.getSource() == howToBack) {
      menu.remove(howToIMGL);
      menu.remove(howToBack);

      menu.add(keyboardSpeedL1);
      menu.add(keyboardSpeedL2);
      menu.add(easy);
      menu.add(hard);
      menu.add(howTo);
      menu.add(onePlayerRB);
      menu.add(twoPlayerRB);
      menu.add(mouseRB);
      menu.add(keyboardRB);
      menu.add(keyboardSpeedS1);
      menu.add(keyboardSpeedS2);
      menu.add(musicCB);
      menu.add(highscoreL);
      menu.add(menuIMGL);

      menu.revalidate();
      menu.repaint();
    }
  }
Пример #13
0
  /** Updates the list of photos displayed. */
  public void updatePhotos() {
    photosPanel.removeAll();
    drawPhotoThumbnails();

    photosPanel.repaint();
    photosPanel.revalidate();
    scrollPane.repaint();
    scrollPane.revalidate();
    contentPane.repaint();
    contentPane.revalidate();

    albumsScreen.updateAlbums();
  }
Пример #14
0
 /**
  * Method to set the mouse dragged actions
  *
  * @param e
  */
 public void mouseDragged(MouseEvent e) {
   if (dragging) {
     Point p = e.getPoint();
     int x = p.x - offset.x;
     int y = p.y - offset.y;
     Dimension d = selectedComponent.getSize();
     selectedComponent.setBounds(x, y, d.width, d.height);
     if (!selected) {
       activePanel.repaint();
       selected = false;
     }
     glassPanel.repaint();
   }
 }
Пример #15
0
  //    int frame = 0;
  public void paint(Graphics g) {
    // System.out.println("frame: " + (frame++));
    lStatus.setText(
        "t = "
            + df.format(md.dt * md.step)
            + ", "
            + "N = "
            + md.N
            + ", "
            + "E/N = "
            + df.format(md.E / md.N)
            + ", "
            + "U/N = "
            + df.format(md.U / md.N)
            + ", "
            + "K/N = "
            + df.format(md.K / md.N)
            + ", "
            + "p = "
            + df.format(md.p)
            + ";");
    tAvK.setText(df.format(md.avK.getAve() / md.N) + "  ");
    tAvU.setText(df.format(md.avU.getAve() / md.N) + "  ");
    tTemp.setText(df.format((2 * md.K) / (3 * (md.N - 1))) + "  ");
    tAvp.setText(df.format(md.avp.getAve()) + "  ");
    canvas.refresh(md.getXWrap(), md.N, true, false);
    cpnl.repaint();
    spnl.repaint();

    try {

      PrintWriter wavefunc =
          new PrintWriter(new FileOutputStream(new File("energyData.txt"), true));
      wavefunc.print(md.E / md.N + " " + md.K / md.N + " " + md.U / md.N);
      wavefunc.println();
      wavefunc.close();
    } catch (IOException ex) {
    }

    try {

      PrintWriter tempwriter =
          new PrintWriter(new FileOutputStream(new File("tempData.txt"), true));
      tempwriter.print(df.format((2 * md.K) / (3 * (md.N - 1))));
      tempwriter.println();
      tempwriter.close();
    } catch (IOException ex) {
    }
  }
Пример #16
0
 @Override
 public void canStartGame() {
   startGameButton.setEnabled(true);
   startGameButs.repaint();
   startGameButs.revalidate();
   startGameButs.updateUI();
 }
  /**
   * Show the specified wizard page
   *
   * @param index
   */
  private void showPage(Integer index, Direction dir) {
    AbstractWizardPanel page;
    try {
      page = pages.get(index);
    } catch (Exception e) {
      log.error("Error setting wizard page to index: " + index);
      e.printStackTrace();
      return;
    }

    // Check to see if page should be ignored
    if (isIgnoredPageClass(page)) {
      if (dir.equals(Direction.FORWARD)) {
        index++;
      } else {
        index--;
      }

      showPage(index, dir);
      return;
    }

    pagePanel.removeAll();
    pagePanel.add(page);
    lblTitle.setText(page.getTitle());
    txtInstructions.setText(page.getInstructions());
    currPageIndex = index;
    autoEnableNavButtons();

    page.initialViewTasks();

    pagePanel.repaint();
  }
 @Override
 public void go(JPanel menuLeft) {
   menuLeft.removeAll();
   menuLeft.add(display.getPanel());
   menuLeft.revalidate();
   menuLeft.repaint();
 }
Пример #19
0
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == back) {
        removeAll();
        JPanel newPanel = new MainPanel();
        add(newPanel);
        revalidate();
        newPanel.repaint();
      }

      if (e.getSource() == delete) {

        int user = list.getSelectedIndex();

        if (user != -1) {
          // LL changed ListItem to UserInfo / and listModel to listUser
          UserInfo tempUser = listUser.get(user);
          userDAO.deleteUser(tempUser);

          listUser.remove(user);
          list.setListData(listUser.toArray());

          scroll.revalidate();
          scroll.repaint();
        }

        System.out.println("Remove selected object");
      }
    }
Пример #20
0
 static void handleMouseClick(MouseEvent e) {
   double midX = (maxX + minX) / 2;
   double midXDist = midX - minX;
   double midY = (maxY + minY) / 2;
   double midYDist = midY - minY;
   // See if any of the navigation icons were under the mouse.
   if (withinBounds(e.getX(), e.getY(), D.width - 20, D.width - 15, 10, 20)) {
     // Plus.
     setXYRange(minX, midX, minY, midY);
   } else if (withinBounds(e.getX(), e.getY(), D.width - 20, D.width - 15, 40, 50)) {
     // Minus.
     setXYRange(minX, 2 * maxX, minY, 2 * maxY);
   } else if (withinBounds(e.getX(), e.getY(), D.width - 75, D.width - 65, 0, 20)) {
     //
     setXYRange(minX, maxX, minY + midYDist, maxY + midYDist);
   } else if (withinBounds(e.getX(), e.getY(), D.width - 75, D.width - 65, 30, 50)) {
     //
     setXYRange(minX, maxX, minY - midYDist, maxY - midYDist);
   } else if (withinBounds(e.getX(), e.getY(), D.width - 65, D.width - 45, 20, 30)) {
     //
     setXYRange(minX + midXDist, maxX + midXDist, minY, maxY);
   } else if (withinBounds(e.getX(), e.getY(), D.width - 95, D.width - 75, 20, 30)) {
     //
     setXYRange(minX - midXDist, maxX - midXDist, minY, maxY);
   }
   drawArea.repaint();
 }
Пример #21
0
 private void moveCacheToState(ComponentStatus state) {
   switch (state) {
     case INITIALIZING:
       cacheStatus.setText(statusStarting);
       processAction(actionButton, true);
       break;
     case RUNNING:
       setCacheTabsStatus(true);
       actionButton.setText(stopCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStarted);
       updateTitleBar();
       break;
     case STOPPING:
       cacheStatus.setText(statusStopping);
       processAction(actionButton, true);
       break;
     case TERMINATED:
       setCacheTabsStatus(false);
       actionButton.setText(startCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStopped);
       updateTitleBar();
   }
   controlPanelTab.repaint();
 }
Пример #22
0
 protected void displayMessage(String message) {
   cleanMessage();
   messagePanel.add(new JLabel(message));
   messagePanel.setVisible(true);
   messagePanel.validate();
   messagePanel.repaint();
 }
Пример #23
0
 public static void drawImage(int[][][] pixels, int startX, int startY) {
   // Key idea: draw a bunch (lots of rectangles) with the appropriate color
   DrawObject R = new DrawObject();
   R.pixels = pixels;
   R.startX = startX;
   R.startY = startY;
   R.sequenceNum = currentSequenceNum;
   images.add(R);
   // Rescale if needed.
   int leftX = startX;
   int rightX = startX + pixels.length;
   int lowY = startY;
   int highY = startY + pixels[0].length;
   if (minX > leftX) {
     minX = leftX;
   }
   if (maxX < rightX) {
     maxX = rightX;
   }
   if (minY > lowY) {
     minY = lowY;
   }
   if (maxY < highY) {
     maxY = highY;
   }
   drawArea.repaint();
 }
Пример #24
0
  public void drawPanel() {
    try {
      // System.out.println("right before the while loop of the thread");
      // layeredPane.add(background,99);

      panel.remove(layeredPane);
      Iterator<PlayerMob> allPlayers = players.iterator();
      PlayerMob aPlayer = null;
      /*while(allPlayers.hasNext()){
      	aPlayer = (PlayerMob) allPlayers.next();
      	//System.out.println("INTHELOOP:info.getUsername ="******" myChat.getUsername ="******"for loop index catch");
      	continue;
      }*/

    } catch (NullPointerException ed) {
      System.err.println("for loop null catch");
      // startDrawingPanelThread();
    } catch (Exception ev) {
      System.err.println("for loop catch");
      ev.printStackTrace();
    }
  }
Пример #25
0
 /**
  * Restore opened settings node if still there.
  *
  * @param oldProps properties inserted in the old model
  * @param selPath path to the node selected in the old model
  */
 private void restoreInsertedProperties(HashMap<String, Property[]> oldProps, TreePath selPath) {
   DefaultTreeModel newModel = levelTrees.get(permissionLvl);
   // Create properties panel for every properties panel existing in the old model
   updateUsedPanels(oldProps, newModel);
   final JPanel holderPropertiesPanel = (JPanel) splitPane.getRightComponent();
   holderPropertiesPanel.removeAll();
   if (selPath != null) {
     // returns node from previous model
     DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selPath.getLastPathComponent();
     if (selectedNode.getUserObject() instanceof ClassPropertiesInfo) {
       // find selected class by name
       ClassPropertiesInfo selectedClassInfo = (ClassPropertiesInfo) selectedNode.getUserObject();
       String selectedClassInfoName = selectedClassInfo.getName();
       // see if it's still visible
       DefaultMutableTreeNode classNode;
       ClassPropertiesInfo classInfo;
       DefaultMutableTreeNode root = (DefaultMutableTreeNode) newModel.getRoot();
       int classCount = newModel.getChildCount(root);
       for (int c = 0; c < classCount; c++) {
         classNode = (DefaultMutableTreeNode) newModel.getChild(root, c);
         classInfo = (ClassPropertiesInfo) classNode.getUserObject();
         if (classInfo.getName().equalsIgnoreCase(selectedClassInfoName)) {
           tree.setSelectionPath(new TreePath(classNode.getPath()));
           c = classCount;
         }
       }
     }
   }
   holderPropertiesPanel.repaint();
 }
Пример #26
0
 public void evaluateInternal(final String sql) {
   southPanel.removeAll();
   southPanel.revalidate();
   southPanel.repaint();
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           final int maxDisplayedRowCount =
               ((Number) displayedRowCountField.getValue()).intValue();
           // TODO: For now, if there is no max limit, consider we don't want the rows to be
           // updatable.
           // TODO: eventually, we want a distinct choice on the user interface.
           final boolean isUpdatable = isUsingMaxRowCount;
           Thread evaluationThread =
               new Thread("SQLConsole - Evaluation") {
                 @Override
                 public void run() {
                   evaluate_unrestricted_nothread(sql, maxDisplayedRowCount, isUpdatable);
                 }
               };
           evaluationThread.start();
         }
       });
 }
 private void clearDeleteRecord() {
   if (deleteList != null) {
     java.util.List list = deleteList.getSelection();
     if (list.size() > 0) {
       try {
         java.util.List dbIDs = new ArrayList(list.size());
         for (Iterator it = list.iterator(); it.hasNext(); ) {
           GKInstance instance = (GKInstance) it.next();
           dbIDs.add(instance.getDBID());
         }
         fileAdaptor.clearDeleteRecord(dbIDs);
       } catch (IOException e) {
         System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e);
         e.printStackTrace();
       }
       deleteList.deleteInstances(list);
       // Check if deleteList needs to be removed
       if (deleteList.getDisplayedInstances().size() == 0) {
         centerPane.remove(deleteList);
         centerPane.validate();
         centerPane.repaint();
       }
     }
   }
 }
Пример #28
0
  public synchronized void addThumbnail(File thumb, double percent) {
    ImagePanel panel_t = new ImagePanel();
    panel_t.setBackground(Color.DARK_GRAY);
    panel_t.setBounds(left, top, 100, 100);

    percent = 100 - (double) ((percent * 100) / 11041);

    DecimalFormat df = new DecimalFormat("#.##");

    textField = new JTextField();
    textField.setEditable(false);
    textField.setText(df.format(percent) + "%");
    textField.setBounds(left + 5, top - 5, 50, 20);
    textField.setColumns(10);

    panel_4.add(textField);
    panel_4.add(panel_t);

    panel_t.create(thumb, 100, 100);
    panel_t.repaint();
    panel_4.repaint();

    left += 110;
    top += 0;

    if (left % 450 == 0) {
      top += 110;
      left = 10;
    }
  }
Пример #29
0
  /**
   * Show a tool tip.
   *
   * @param tipText the tool tip text
   * @param pt the pixel position over which to show the tip
   */
  public void showTip(String tipText, Point pt) {
    if (getRootPane() == null) return;
    // draw in glass pane to appear on top of other components
    if (glassPane == null) {
      getRootPane().setGlassPane(glassPane = new JPanel());
      glassPane.setOpaque(false);
      glassPane.setLayout(null); // will control layout manually
      glassPane.add(tip = new JToolTip());
      tipTimer =
          new Timer(
              TIP_DELAY,
              new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                  glassPane.setVisible(false);
                }
              });
      tipTimer.setRepeats(false);
    }
    if (tipText == null) return;

    // set tip text to identify current origin of pannable view
    tip.setTipText(tipText);

    // position tip to appear at upper left corner of viewport
    tip.setLocation(SwingUtilities.convertPoint(this, pt, glassPane));
    tip.setSize(tip.getPreferredSize());

    // show glass pane (it contains tip)
    glassPane.setVisible(true);
    glassPane.repaint();

    // this timer will hide the glass pane after a short delay
    tipTimer.restart();
  }
 public void refreshPoolPreviewFlameImage(Flame flame) {
   FlamePanel imgPanel = getPoolPreviewFlamePanel();
   if (imgPanel == null) return;
   Rectangle bounds = imgPanel.getImageBounds();
   int width = bounds.width;
   int height = bounds.height;
   if (width >= 16 && height >= 16) {
     RenderInfo info = new RenderInfo(width, height, RenderMode.PREVIEW);
     if (flame != null) {
       imgPanel.setDrawTriangles(false);
       double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
       double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
       flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
       flame.setWidth(info.getImageWidth());
       flame.setHeight(info.getImageHeight());
       Flame renderFlame = new FlamePreparer(prefs).createRenderFlame(flame);
       FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
       renderer.setProgressUpdater(null);
       RenderedFlame res = renderer.renderFlame(info);
       imgPanel.setImage(res.getImage());
     } else {
       imgPanel.setImage(new SimpleImage(width, height));
     }
   } else {
     imgPanel.setImage(new SimpleImage(width, height));
   }
   poolFlamePreviewPnl.repaint();
 }