Ejemplo n.º 1
2
  public void changeLAF(int iLAFIndex) {
    try {
      // Change LAF
      if (iLAFIndex >= marrLaf.length) iLAFIndex = marrLaf.length - 1;
      UIManager.setLookAndFeel(
          (LookAndFeel) Class.forName(marrLaf[iLAFIndex].getClassName()).newInstance());

      // Update UI
      ((JMenuItem) mvtLAFItem.elementAt(iLAFIndex)).setSelected(true);
      SwingUtilities.updateComponentTreeUI(this);
      SwingUtilities.updateComponentTreeUI(mnuMain);
      WindowManager.updateLookAndField();

      // Store config
      try {
        Hashtable prt = Global.loadHashtable(Global.FILE_CONFIG);
        prt.put("LAF", String.valueOf(iLAFIndex));
        Global.storeHashtable(prt, Global.FILE_CONFIG);
      } catch (Exception e) {
      }
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }
Ejemplo n.º 2
0
  public void updateTreeUI() {
    super.updateTreeUI();

    if (this._btnHelpSource_ != null) {
      if (!isAncestorOf(this._btnHelpSource_))
        javax.swing.SwingUtilities.updateComponentTreeUI(this._btnHelpSource_);
    }

    if (this._btnHelpTrack_ != null) {
      if (!isAncestorOf(this._btnHelpTrack_))
        javax.swing.SwingUtilities.updateComponentTreeUI(this._btnHelpTrack_);
    }

    if (this._btnHelpOnlineHome_ != null) {
      if (!isAncestorOf(this._btnHelpOnlineHome_))
        javax.swing.SwingUtilities.updateComponentTreeUI(this._btnHelpOnlineHome_);
    }

    if (this._btnAboutAppli_ != null) {
      if (!isAncestorOf(this._btnAboutAppli_))
        javax.swing.SwingUtilities.updateComponentTreeUI(this._btnAboutAppli_);
    }

    if (this._btnExit_ != null) {
      if (!isAncestorOf(this._btnExit_)) // NOTE: should always be the case
      javax.swing.SwingUtilities.updateComponentTreeUI(this._btnExit_);
    }
  }
Ejemplo n.º 3
0
  /**
   * Updates the colour scheme by initializing the UI to the new Look and Fell and repainting. This
   * is a separate method since it cannot be directly invoked within an inner class due to the
   * necessity of passing this object as a parameter. Interestingly, {@link
   * javax.swing.SwingUtilities#updateComponentTreeUI(java.awt.Component)} will throw a
   * NullPointerException if this is not explicitly handles on the Swing event dispatch thread. This
   * is due to all children components of this appearing null otherwise.
   */
  private void updateColourScheme() {
    javax.swing.SwingUtilities.updateComponentTreeUI(this);

    // Needed to ensure that the text updates correctly and simultaneously with the background
    Set<Component> uiComponentsToUpdate = new HashSet<Component>();
    uiComponentsToUpdate.addAll(backgroundColourableComponents);
    uiComponentsToUpdate.addAll(complementaryAmenableForegroundColourableComponents);
    for (Component c : uiComponentsToUpdate) {
      javax.swing.SwingUtilities.updateComponentTreeUI(c);
      c.repaint();
    }

    // TODO Get tabbed panel members' text to update
    this.repaint();
  }
Ejemplo n.º 4
0
 private void jButton2ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed
   CadastroFuncionario cf = new CadastroFuncionario();
   this.setContentPane(cf);
   SwingUtilities.updateComponentTreeUI(this);
   cf.setVisible(true);
 } // GEN-LAST:event_jButton2ActionPerformed
Ejemplo n.º 5
0
  /** Creates new form Eleminator */
  public Eleminator() {
    getContentPane().add(MTP, BorderLayout.CENTER);
    try {
      String nativeLook = UIManager.getSystemLookAndFeelClassName();
      UIManager.setLookAndFeel(nativeLook);
      SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    }

    try {
      File custDir = new File(System.getProperty("user.home") + "/" + "WorkSpace.dat");
      ObjectInputStream In = new ObjectInputStream(new FileInputStream(custDir));
      workingDirectory = new File(((WorkSpace) In.readObject()).getWorkSpace());
    } catch (Exception ex) {
      workingDirectory = new File(System.getProperty("user.home"));
    }

    initComponents();
    LookAndFeelInfo[] li = UIManager.getInstalledLookAndFeels();

    for (int i = 0; li.length > i; i++) { // For more themes

      themeComboBox.addItem(new ThemeItem(li[i].getName(), li[i].getClassName()));
    }

    setBounds(0, 0, 640, 480);
    setTitle("eLEMinator");
    URL imageURL = getClass().getClassLoader().getResource("verifier/lem.jpg");
    Image lem = Toolkit.getDefaultToolkit().getImage(imageURL);
    setIconImage(lem);
  }
    @Override
    public void actionPerformed(ActionEvent e) {
      // JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
      TableColumnModel model = table.getColumnModel();

      if (colData.isVisible() == false) {
        colData.setVisible(true);
        model.addColumn(column);
        // column is added at right end of model
        // move column to its default place
        int lastPos = model.getColumnCount() - 1;
        int pos = data.getColumnNumber(colData);
        if (pos >= 0 && pos < lastPos) model.moveColumn(lastPos, pos);
        scrollPane.setSize(
            scrollPane.getWidth() + column.getPreferredWidth(), scrollPane.getHeight());

        // show breakPointColumn => show all lines
        if (isBreakPointColumn) {
          kernel.getConstruction().setShowOnlyBreakpoints(false);
          // cbShowOnlyBreakpoints.setSelected(false);
        }
      } else {
        colData.setVisible(false);
        model.removeColumn(column);
        // setSize(getWidth() - column.getWidth(), getHeight());
        // setSize(view.getWidth(), getHeight());
      }
      table.tableChanged(new TableModelEvent(((GAbstractTableModelD) data.getImpl()).getImpl()));

      // reinit view to update possible breakpoint changes
      ((ConstructionTableData) data).initView();
      SwingUtilities.updateComponentTreeUI(view.scrollPane);
    }
 /** Updates the UI of the passed in window and all its children. */
 private static void updateWindowUI(Window window) {
   SwingUtilities.updateComponentTreeUI(window);
   Window ownedWins[] = window.getOwnedWindows();
   for (int i = 0; i < ownedWins.length; i++) {
     updateWindowUI(ownedWins[i]);
   }
 }
Ejemplo n.º 8
0
 void updateUI() {
   for (int i = 0; i < controllers.size(); i++) {
     SwingController controller = controllers.get(i);
     JFrame frame = controller.getViewerFrame();
     if (frame != null) SwingUtilities.updateComponentTreeUI(frame);
   }
 }
  /** Update the look and feel of the toolbar. */
  public void updateLAF() {

    if (pbOpen != null) {
      pbOpen.setIcon(UIImages.get(OPEN_ICON));
    }
    if (pbClose != null) {
      pbClose.setIcon(UIImages.get(CLOSE_ICON));
    }
    pbCut.setIcon(UIImages.get(CUT_ICON));
    pbCopy.setIcon(UIImages.get(COPY_ICON));
    pbPaste.setIcon(UIImages.get(PASTE_ICON));
    pbDelete.setIcon(UIImages.get(DELETE_ICON));
    pbUndo.setIcon(UIImages.get(UNDO_ICON));
    pbRedo.setIcon(UIImages.get(REDO_ICON));
    pbShowBackHistory.setIcon(UIImages.get(PREVIOUS_ICON));
    pbBack.setIcon(UIImages.get(BACK_ICON));
    pbForward.setIcon(UIImages.get(FORWARD_ICON));
    pbShowForwardHistory.setIcon(UIImages.get(NEXT_ICON));
    pbSearch.setIcon(UIImages.get(SEARCH_ICON));
    pbHelp.setIcon(UIImages.get(HELP_ICON));

    if (FormatProperties.imageRollover) {
      pbImageRollover.setIcon(UIImages.get(IMAGE_ROLLOVER_ICON));
    } else {
      pbImageRollover.setIcon(UIImages.get(IMAGE_ROLLOVEROFF_ICON));
    }

    if (tbrToolBar != null) SwingUtilities.updateComponentTreeUI(tbrToolBar);
  }
Ejemplo n.º 10
0
 /** Updates the UI of the passed in window and all its children. */
 private static void updateWindowUI(Window window) {
   SwingUtilities.updateComponentTreeUI(window);
   Window ownedWins[] = window.getOwnedWindows();
   for (Window win : ownedWins) {
     updateWindowUI(win);
   }
 }
Ejemplo n.º 11
0
  public ControlWindow(String title) {
    props = Property.getProps();

    locale = new Locale(props.getProperty("resourcebundle"));
    rb = ResourceBundle.getBundle("language", locale);

    this.setBackground(new Color(1, 1, 1));
    container = this.getContentPane();
    container.setLayout(new FlowLayout());
    container.setSize(500, 300);

    // build the window frame
    createComponents();

    this.setSize(600, 400);
    this.setLocation(300, 200);

    // Now this will set the LAF(Look & Feel)
    setLookAndFeel();
    SwingUtilities.updateComponentTreeUI(this);
    this.pack();

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (monitor != null) {
              monitor.interrupt();
            }
            System.exit(0);
          }
        });

    this.setVisible(true);
  }
Ejemplo n.º 12
0
 /** Sanity: icons updated on LF change. */
 public void testTreeIconsUpdateUI() {
   JXTree tree = new JXTree();
   DefaultTreeRenderer renderer = new DefaultTreeRenderer();
   tree.setCellRenderer(renderer);
   WrappingIconPanel before =
       (WrappingIconPanel)
           renderer.getTreeCellRendererComponent(tree, "", false, false, true, -1, false);
   Icon leaf = before.getIcon();
   assertNotNull("sanity", leaf);
   assertEquals("sanity", UIManager.getIcon("Tree.leafIcon"), leaf);
   String lf = UIManager.getLookAndFeel().getName();
   setSystemLF(!defaultToSystemLF);
   if (lf.equals(UIManager.getLookAndFeel().getName())) {
     LOG.info("cannot run test - equal LF" + lf);
     return;
   }
   SwingUtilities.updateComponentTreeUI(tree);
   WrappingIconPanel after =
       (WrappingIconPanel)
           renderer.getTreeCellRendererComponent(tree, "", false, false, true, -1, false);
   Icon leafAfter = after.getIcon();
   assertNotNull("sanity", leafAfter);
   assertFalse("sanity", leaf.equals(leafAfter));
   assertEquals("icon must be updated", UIManager.getIcon("Tree.leafIcon"), leafAfter);
 }
Ejemplo n.º 13
0
  private void configureUI() {
    // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE);
    Options.setDefaultIconSize(new Dimension(18, 18));
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());
    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    // Swing Settings
    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();

    // Work around caching in MetalRadioButtonUI
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
      UIManager.setLookAndFeel(selectedLaf);
      SwingUtilities.updateComponentTreeUI(this);
    } catch (UnsupportedLookAndFeelException uslafe) {
      System.out.println("UnsupportedLookAndFeelException: " + uslafe.getMessage());
    } catch (Exception e) {
      System.out.println("Can't change L&F: " + e);
    }

    // // FensterIcon
    // String IconLocation = ResourceManager.getString("icon.IconImage");
    // System.out.println("[i] set IconImage: " +
    // getClass().getResource(IconLocation).toString());
    // setIconImage( new
    // ImageIcon(getClass().getResource(IconLocation)).getImage());

  }
Ejemplo n.º 14
0
 private void updateGUILabels() {
   lMonitor.setText(rb.getString("lbl_folder"));
   lClearFolder.setText(rb.getString("lbl_clear_folder"));
   buttonPanel.setBorder(new TitledBorder(new EtchedBorder(), rb.getString("brd_monitor_button")));
   SwingUtilities.updateComponentTreeUI(this);
   this.pack();
 }
Ejemplo n.º 15
0
 public void updateUI() {
   super.updateUI();
   if (pmn != null) {
     SwingUtilities.updateComponentTreeUI(pmn);
     Skin.applySkin(pmn);
   }
 }
Ejemplo n.º 16
0
 /** ***********private end******************* */
 public void start() {
   initGrid();
   PictureView image = refreshMatrix();
   this.panelView = new FrameView(image, this);
   SwingUtilities.updateComponentTreeUI(panelView);
   this.state = CONTROLLER_STATE.CONTROLLER_NO_HOLE;
 }
  /** Constructor */
  public MapListCellRenderer() {
    JPanel pFirst = new JPanel();
    pFirst.setOpaque(false);
    pFirst.setLayout(new BorderLayout(5, 0));
    pFirst.add(mapNameLabel, BorderLayout.CENTER);
    pFirst.add(playerCountLabel, BorderLayout.EAST);
    pFirst.setAlignmentX(Component.LEFT_ALIGNMENT);
    rightPanelPart.add(pFirst);
    rightPanelPart.add(mapIdLabel);
    mapIdLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    rightPanelPart.add(descriptionLabel);
    descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

    rightPanelPart.setOpaque(false);
    rightPanelPart.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    mapNameLabel.setFont(mapNameLabel.getFont().deriveFont(Font.BOLD));
    mapNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

    mapNameLabel.setForeground(FOREGROUND);
    mapIdLabel.setForeground(FOREGROUND);
    descriptionLabel.setForeground(FOREGROUND);
    playerCountLabel.setForeground(Color.BLUE);

    contentsPanel.setLayout(new BorderLayout());
    contentsPanel.add(rightPanelPart, BorderLayout.CENTER);
    contentsPanel.add(iconLabel, BorderLayout.WEST);
    contentsPanel.putClientProperty(ELFStyle.KEY, ELFStyle.PANEL_DRAW_BG_CUSTOM);

    iconLabel.setOpaque(false);
    iconLabel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));

    // Update UI
    SwingUtilities.updateComponentTreeUI(contentsPanel);
  }
Ejemplo n.º 18
0
 /**
  * Update the Look and Feel of the game
  *
  * @param lnf fully qualified look and feel class name
  */
 private void changeLnF(String lnf) {
   try {
     UIManager.setLookAndFeel(lnf);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
   }
 }
Ejemplo n.º 19
0
  public static void main(String[] args) {
    JFrame a = new JFrame();
    a.setSize(1000, 1000);
    a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    a.setVisible(true);
    SwingUtilities.updateComponentTreeUI(a);
  }
Ejemplo n.º 20
0
 private void setLookAndFeel() {
   try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
     System.out.println("Couldn't use the system " + "look andfeel: " + e);
   }
 }
Ejemplo n.º 21
0
 public void updateUI() {
   super.updateUI();
   // todo review it
   // when the laf is changed starting from the peer component
   // we enforce the UI update of the target componet
   // this can be dangerous, find a better solution
   if (target != null) SwingUtilities.updateComponentTreeUI(target);
 }
Ejemplo n.º 22
0
 /** Switch to a new Look&Feel */
 private void newLookAndFeel(String landf) {
   try {
     UIManager.setLookAndFeel(landf);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
     System.err.println(e);
   }
 }
Ejemplo n.º 23
0
 public IFCliente() {
   initComponents();
   // redimenciona o lookandFeeld de acordo com o selecionado
   SwingUtilities.updateComponentTreeUI(this);
   this.pack();
   PreencherJtableConsulta();
   PreencheComboRegioes();
   TFNome.requestFocus();
 }
Ejemplo n.º 24
0
 private void themeComboBoxItemStateChanged(
     java.awt.event.ItemEvent evt) { // GEN-FIRST:event_themeComboBoxItemStateChanged
   try {
     ThemeItem newLook = (ThemeItem) themeComboBox.getSelectedItem();
     UIManager.setLookAndFeel(newLook.getClassName());
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
   }
 } // GEN-LAST:event_themeComboBoxItemStateChanged
Ejemplo n.º 25
0
 /** Sets the current L&F on each demo module */
 public void updateLookAndFeel() {
   try {
     UIManager.setLookAndFeel(currentLookAndFeel);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception ex) {
     System.out.println("Failed loading L&F: " + currentLookAndFeel);
     System.out.println(ex);
   }
 }
Ejemplo n.º 26
0
  /** Creates new form FrmServer */
  public FrmServer() {
    initComponents();

    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception ex) {
    }
  }
Ejemplo n.º 27
0
 /** Updates the componentTreeUI of all top-level windows of the current application. */
 public static void updateAllComponentTreeUIs() {
   //        for (Frame frame : Frame.getFrames()) {
   //            updateAllComponentTreeUIs(frame);
   //        }
   // JW: updated to new 1.6 api - returns all windows, owned and ownerless
   for (Window window : Window.getWindows()) {
     SwingUtilities.updateComponentTreeUI(window);
   }
 }
Ejemplo n.º 28
0
  public static void updateComponentHierarchy() {
    // SwingUtilities.updateComponentTreeUI(GUIMediator.getMainOptionsComponent());
    TipOfTheDayMediator.instance().updateComponentTreeUI();
    NotifyUserProxy.instance().updateUI();
    updateThemeObservers();

    for (Window window : Window.getWindows()) {
      SwingUtilities.updateComponentTreeUI(window);
    }
  }
Ejemplo n.º 29
0
 public void actionPerformed(ActionEvent e) {
   try {
     UIManager.setLookAndFeel(info.getClassName());
     SwingUtilities.updateComponentTreeUI(demo);
   } catch (RuntimeException re) {
     throw re; // FindBugs
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
 private static void updateUI(Window window) {
   if (!window.isDisplayable()) {
     return;
   }
   SwingUtilities.updateComponentTreeUI(window);
   Window[] children = window.getOwnedWindows();
   for (Window aChildren : children) {
     updateUI(aChildren);
   }
 }