public void focusLost(FocusEvent e) {
   // We will still paint focus even if lost temporarily
   focusLostTemporarily = e.isTemporary();
   if (!focusLostTemporarily) {
     comp.repaint();
   }
 }
    /** refreshes the parents */
    protected void refreshParents() {

      if (componentToRefresh != null) {

        componentToRefresh.repaint();
      }
    }
Example #3
0
 private void repaint() {
   if (mPainter != null) {
     if (DEBUG.IMAGE) out("repaint in " + GUI.name(mPainter));
     mPainter.repaint();
   }
   // FYI, this will not repaint if the parent is a DefaultTreeCellRenderer,
   // and the parent of the parent (a JLabel), is null, so we can't get that.
 }
 public StatusText clear() {
   myText = "";
   myComponent.clear();
   myClickListeners.clear();
   myHasActiveClickListeners = false;
   if (myOwner != null && isStatusVisible()) myOwner.repaint();
   return this;
 }
Example #5
0
  private void updateSelectedObj() {
    // System.out.println("VtabbedToolPanel updateValue ");

    Component comp = getSelectedObj();
    if (comp != null) {
      if (comp instanceof ExpListenerIF) ((ExpListenerIF) comp).updateValue();
      if (comp instanceof EditListenerIF) {
        ((EditListenerIF) comp).setEditMode(inEditMode);
        comp.repaint();
      }
    }
  }
  /**
   * Display a file chooser dialog box.
   *
   * @param owner <code>Component</code> which 'owns' the dialog
   * @param mode Can be either <code>OPEN</code>, <code>SCRIPT</code> or <code>SAVE</code>
   * @return The path to selected file, null otherwise
   */
  public static String chooseFile(Component owner, int mode) {
    JFileChooser chooser = getFileChooser(owner, mode);
    chooser.setMultiSelectionEnabled(false);

    if (chooser.showDialog(owner, null) == JFileChooser.APPROVE_OPTION) {
      /*Jext*/ AbstractEditorPanel.setProperty(
          "lastdir." + mode, chooser.getSelectedFile().getParent());
      return chooser.getSelectedFile().getAbsolutePath();
    } else owner.repaint();

    return null;
  }
  /**
   * ������ѡ����
   *
   * @param cp ����Ҫ�ı�Ŀؼ�
   * @param style ���ܽ����±�
   * @return ���سɹ��������
   */
  public static boolean setUI(Component cp, int style) {

    try {
      switch (style) {
        case 0:
          UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "windows.WindowsLookAndFeel");
          break;
        case 1:
          UIManager.setLookAndFeel("javax.swing.plaf." + "metal.MetalLookAndFeel");
          break;
        case 2:
          UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "motif.MotifLookAndFeel");
          break;
        case 3:
          UIManager.setLookAndFeel(
              "com.sun.java.swing.plaf." + "windows.WindowsClassicLookAndFeel");
          break;
        case 4:
          UIManager.setLookAndFeel("com.incors.plaf." + "alloy.AlloyLookAndFeel");
          break;
        case 5:
          UIManager.setLookAndFeel("soft.wes.feels." + "GlassThemeAlloyLookAndFeel");
          break;
        case 6:
          UIManager.setLookAndFeel("soft.wes.feels." + "AcidThemeAlloyLookAndFeel");
          break;
        case 7:
          UIManager.setLookAndFeel("soft.wes.feels." + "BedouinThemeAlloyLookAndFeel");
          break;
        case 8:
          UIManager.setLookAndFeel("soft.wes.feels." + "DefaultThemeAlloyLookAndFeel");
          break;
        case 9:
          UIManager.put("swing.boldMetal", Boolean.FALSE);
          // �����öԻ������
          JDialog.setDefaultLookAndFeelDecorated(true);
          // �������������
          JFrame.setDefaultLookAndFeelDecorated(true);
          Toolkit.getDefaultToolkit().setDynamicLayout(true);
          System.setProperty("sun.awt.noerasebackground", "true");
          UIManager.setLookAndFeel(new MetalLookAndFeel());
          break;
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(null, "����ʧ��,��ԭ�����ʾ");
      return false;
    }
    SwingUtilities.updateComponentTreeUI(cp);
    cp.repaint();

    return true;
  }
 @Override
 public void run() {
   try {
     while (running) {
       sleep(100);
       paintBorder();
     }
     if (prev != null) {
       prev.repaint();
     }
   } catch (InterruptedException e) { //
   }
 }
 private void onClick() {
   try {
     DialogTabularParameter dlg =
         new DialogTabularParameter(cmpCaller, mbModal, mstrTitle, mvtDefinition, mvtValue);
     // DialogTableParameter dlg = new
     // DialogTableParameter(cmpCaller,mbModal,mstrTitle,mvtDefinition,mvtValue);
     WindowManager.centeredWindow(dlg);
     cmpCaller.repaint();
     setValue(mvtValue);
   } catch (Exception e) {
     e.printStackTrace();
     MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
   }
 }
  public StatusText appendText(String text, SimpleTextAttributes attrs, ActionListener listener) {
    if (myIsDefaultText) {
      clear();
      myIsDefaultText = false;
    }

    myText += text;
    myComponent.append(text, attrs);
    myClickListeners.add(listener);
    if (listener != null) {
      myHasActiveClickListeners = true;
    }
    if (myOwner != null && isStatusVisible()) myOwner.repaint();
    return this;
  }
 private void paintBorder() {
   final int row = FocusTracesDialog.this.myRequestsTable.getSelectedRow();
   if (row != -1) {
     final FocusRequestInfo info = FocusTracesDialog.this.myRequests.get(row);
     if (prev != null && prev != info.getComponent()) {
       prev.repaint();
     }
     prev = info.getComponent();
     if (prev != null && prev.isDisplayable()) {
       final Graphics g = prev.getGraphics();
       g.setColor(Color.RED);
       final Dimension sz = prev.getSize();
       UIUtil.drawDottedRectangle(g, 1, 1, sz.width - 2, sz.height - 2);
     }
   }
 }
Example #12
0
 private void dispatchEvent(MouseEvent me) {
   Component src = me.getComponent();
   comp.dispatchEvent(SwingUtilities.convertMouseEvent(src, me, comp));
   src.repaint();
 }
 /**
  * Invoked when the animated icon indicates that it is time for a repaint.
  *
  * @param context Component to refresh
  * @param key Substructure identification key
  */
 protected void repaint(Component context, Object key) {
   Rectangle rect = getRepaintRect(context, key);
   if (rect != null) {
     context.repaint(rect.x, rect.y, rect.width, rect.height);
   }
 }
 public void focusGained(FocusEvent e) {
   comp.repaint();
 }