예제 #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);
    }
  }
예제 #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_);
    }
  }
예제 #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();
  }
예제 #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
예제 #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]);
   }
 }
예제 #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);
  }
예제 #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);
   }
 }
예제 #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);
  }
예제 #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);
 }
예제 #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());

  }
예제 #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();
 }
예제 #15
0
 public void updateUI() {
   super.updateUI();
   if (pmn != null) {
     SwingUtilities.updateComponentTreeUI(pmn);
     Skin.applySkin(pmn);
   }
 }
예제 #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);
  }
예제 #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) {
   }
 }
예제 #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);
  }
예제 #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);
   }
 }
예제 #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);
 }
예제 #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);
   }
 }
예제 #23
0
 public IFCliente() {
   initComponents();
   // redimenciona o lookandFeeld de acordo com o selecionado
   SwingUtilities.updateComponentTreeUI(this);
   this.pack();
   PreencherJtableConsulta();
   PreencheComboRegioes();
   TFNome.requestFocus();
 }
예제 #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
예제 #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);
   }
 }
예제 #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) {
    }
  }
예제 #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);
   }
 }
예제 #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);
    }
  }
예제 #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);
   }
 }