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); } }
public void updateUI() { super.updateUI(); if (pmn != null) { SwingUtilities.updateComponentTreeUI(pmn); Skin.applySkin(pmn); } }
/** 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); }
/** 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); } }
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); } }
/** 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); } }
public void propertyChange(PropertyChangeEvent evt) { if (DisplayOptions.isUpdateUIEvent(evt)) { SwingUtilities.updateComponentTreeUI(this); gradientPanel.remove(drawable); JPanel newpanel = createGradientPanel(); contentPane.remove(gradientPanel); gradientPanel = newpanel; gradientPanel.add(drawable, BorderLayout.CENTER); contentPane.add(gradientPanel, BorderLayout.CENTER); } }
public void setSpecificTaskPane(JPanel contents, String title, Icon icon) { if (currentSpecificTaskPane != null) { taskPaneContainer.remove(currentSpecificTaskPane); } currentSpecificTaskPane = new JXTaskPane(); currentSpecificTaskPane.setLayout(new BorderLayout()); currentSpecificTaskPane.setTitle(title); currentSpecificTaskPane.setIcon(icon); // contents.setOpaque(false); SwingUtilities.updateComponentTreeUI(contents); // currentSpecificTaskPane.setOpaque(false); currentSpecificTaskPane.add(contents, BorderLayout.CENTER); // this.mainTaskPane.setExpanded(false); taskPaneContainer.add(currentSpecificTaskPane); }
/** * Set the look and feel. The argument is the full name of the desired look&feel class, e.g. * com.sun.java.swing.plaf.windows.WindowsLookAndFeel */ public void setLookAndFeel(String lookAndFeel) { try { // Set the look and feel for the system.. UIManager.setLookAndFeel(lookAndFeel); // .. and tell all the components about it. SwingUtilities.updateComponentTreeUI(this); // Call the layout manager in case things need shuffling around. this.validate(); // And display the result of all that. this.repaint(); // Indicate success // System.out.println("Look and feel set to " + lookAndFeel ); } catch (Exception e) { // Indicate if desired L&F wasn't available for some reason. System.out.println(e); } }
/** PropertyChangeListener interface */ public void propertyChange(PropertyChangeEvent evt) { if (DisplayOptions.isUpdateUIEvent(evt)) SwingUtilities.updateComponentTreeUI(this); }
/** Update the look and feel of the toolbar. */ public void updateLAF() { if (tbrToolBar != null) SwingUtilities.updateComponentTreeUI(tbrToolBar); }
public Manage_Inv() { // this.setTitle("Home_Page"); // this.setSize(600,600); // this.setVisible(true); this.setTitle("Manage_Investments"); this.setSize(600, 600); this.setVisible(true); this.setLayout(new BorderLayout(10, 10)); // Frame Layout this.setLocation(200, 100); Container cp = this.getContentPane(); JPanel jp1 = new JPanel(); jp1.setLayout(new BorderLayout(10, 10)); JLabel jl1 = new JLabel("Welcome"); jl1.setForeground(Color.RED); jp1.add(jl1, BorderLayout.PAGE_START); JPanel jp2 = new JPanel(); jp2.setLayout(new GridLayout(2, 5, 20, 0)); jp2.add(new JButton("Sensex")); jp2.add(new JButton("Nifty")); jp2.add(new JButton("CNX Midcap")); jp2.add(new JButton("BSE Smallcap")); jp2.add(new JButton("Networth")); jp2.add(new JTextField(5)); jp2.add(new JTextField(5)); jp2.add(new JTextField(5)); jp2.add(new JTextField(5)); jp2.add(new JTextField(5)); jp1.add(jp2, BorderLayout.CENTER); jp1.add(new JSeparator(), BorderLayout.SOUTH); JPanel jp3 = new JPanel(); jp3.setLayout(new BorderLayout(20, 20)); jp3.add(new JPanel(), BorderLayout.WEST); jp3.add(new JPanel(), BorderLayout.EAST); jp3.add(new JPanel(), BorderLayout.NORTH); jp3.add(new JPanel(), BorderLayout.SOUTH); JPanel jp4 = new JPanel(); jp4.setLayout(new GridLayout(3, 2, 10, 10)); jp4.add(stocks); jp4.add(bullion); jp4.add(mf); jp4.add(fixed); jp4.add(property); jp4.add(loan); jp3.add(jp4); jp3.setBorder(BorderFactory.createTitledBorder("Manage_Investments")); cp.add(jp3, BorderLayout.CENTER); cp.add(jp1, BorderLayout.NORTH); // Adding action listner to stocks..................... stocks.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new Stocks().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of stocks....................... // Adding action listner to mf's..................... mf.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new MutualFunds().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of mf's....................... // adding of action listener of bullion....................... bullion.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new Bullion().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of bullion....................... // adding of action listener of fixed....................... fixed.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new FixedIncome().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of Fixed....................... // adding of action listener of property.5....................... property.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new Property().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of property.5....................... // adding of action listener of loan.6....................... loan.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { new Loan().setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); ref.setVisible(false); } }); // end of action listener of loan.6....................... try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(this); } catch (Exception e) { } }
public void login() { mbAutoLogIn = false; while (!mbAutoLogIn) { try { // Confirm logout if (isOpen()) { if (MessageBox.showConfirmDialog( this, MonitorDictionary.getString("Confirm.Exit"), Global.APP_NAME, MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) return; // Disconnect from server disconnect(); } // Login DialogLogin dlgLogin = new DialogLogin(this); WindowManager.centeredWindow(dlgLogin); if (dlgLogin.miReturn == JOptionPane.OK_OPTION) { // Update UI SwingUtilities.updateComponentTreeUI(pnlUser); SwingUtilities.updateComponentTreeUI(pnlThread); // Request to connect Socket sck = new Socket(dlgLogin.mstrHost, Integer.parseInt(dlgLogin.mstrPort)); sck.setSoLinger(true, 0); // Start up a channel thread that reads messages from the server channel = new SocketTransmitter(sck) { public void close() { if (msckMain != null) { super.close(); closeAll(); if (mbAutoLogIn) login(); } } }; channel.setUserName(dlgLogin.mstrUserName); channel.setPackage("com.fss.thread."); channel.start(); // Request to Server DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); request.setString("UserName", dlgLogin.mstrUserName); request.setString("Password", dlgLogin.mstrPassword); // Response from Server DDTP response = channel.sendRequest("ThreadProcessor", "login", request); mstrThreadAppName = response.getString("strThreadAppName"); mstrThreadAppVersion = response.getString("strThreadAppVersion"); mstrAppName = response.getString("strAppName"); mstrAppVersion = response.getString("strAppVersion"); if (response != null) { if (response.getString("PasswordExpired") != null) { DialogChangePassword frm = new DialogChangePassword(this, channel); WindowManager.centeredWindow(frm); if (frm.miReturnValue != JOptionPane.OK_OPTION) throw new AppException("FSS-10003"); } String strLog = StringUtil.nvl(response.getString("strLog"), ""); showResult(txtBoard, strLog); Vector vtThread = response.getVector("vtThread"); updateTabBar(vtThread); mstrChannel = response.getString("strChannel"); if (mstrChannel != null) removeUser(mstrChannel); } btnRefresh.doClick(); pnlThread.setVisible(true); pnlUser.setVisible(true); setResizeWeight(1); setDividerLocation((int) (getSize().getHeight() - 160)); } mbAutoLogIn = true; updateLanguage(); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); // Disconnect from server mstrChannel = null; disconnect(); } } }
private static void updateLookAndFeel() { for (Window window : Frame.getWindows()) { SwingUtilities.updateComponentTreeUI(window); } }
@Override public void updateUI() { SwingUtilities.updateComponentTreeUI(myEditor); }
public void updateLF() { SwingUtilities.updateComponentTreeUI(popupMenu); SwingUtilities.updateComponentTreeUI(groupPopupMenu); }
public ChooseColors() { setSize(600, 150); setDefaultCloseOperation(EXIT_ON_CLOSE); JButton start = new JButton("Start Game"); // start.addActionListener(new playGameUseController()); JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); JPanel jPanelSolution = new JPanel(); jPanelSolution.add(choosen); for (int i = 0; i < 6; i++) { JButton sol = new JButton("" + i); sol.addActionListener(new GameListener()); sol.setPreferredSize(new Dimension(37, 37)); sol.setBackground(Color.WHITE); solution[i] = sol; jPanelSolution.add(solution[i]); } JPanel boxes = new JPanel(); boxes.setLayout(new FlowLayout()); JButton yellow = new JButton(":::"); JButton magenta = new JButton(":::"); JButton cyan = new JButton(":::"); JButton green = new JButton(":::"); JButton red = new JButton(":::"); JButton blue = new JButton(":::"); yellow.addActionListener(new YellowListener()); magenta.addActionListener(new MagentaListener()); blue.addActionListener(new BlueListener()); green.addActionListener(new GreenListener()); red.addActionListener(new RedListener()); cyan.addActionListener(new CyanListener()); yellow.setBackground(Color.yellow); magenta.setBackground(Color.magenta); cyan.setBackground(Color.cyan); green.setBackground(Color.green); red.setBackground(Color.red); blue.setBackground(Color.blue); jButtonColor.setEnabled(false); jButtonColor.setBackground(Color.yellow); boxes.add(jButtonColor); boxes.add(yellow); boxes.add(magenta); boxes.add(cyan); boxes.add(green); boxes.add(red); boxes.add(blue); JPanel jLabelPanel = new JPanel(); jLabelPanel.add(jLabelPattern); Component add = jPanelSolution.add(start); pane.add(jLabelPanel, BorderLayout.NORTH); pane.add(boxes, BorderLayout.CENTER); pane.add(jPanelSolution, BorderLayout.SOUTH); getContentPane().add(pane); setResizable(false); setVisible(true); try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch (Exception ex) { } }