List of usage examples for javax.swing UIManager getIcon
public static Icon getIcon(Object key)
Icon
from the defaults. From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java
/** * Builds and lays out the GUI. /* www . j av a2 s .c o m*/ * * @param toSubmit The collection of files to send. */ private void buildGUI(List<ImportErrorObject> toSubmit) { JComponent component; Icon icon; IconManager icons = IconManager.getInstance(); String message; if (dialogType == SUBMIT_ERROR_TYPE) { message = SUBMIT_MESSAGE; component = buildExceptionPane(toSubmit); icon = icons.getIcon(IconManager.SUBMIT_ICON_64); if (icon == null) icon = UIManager.getIcon("OptionPane.errorIcon"); } else if (exception == null) { message = MESSAGE; icon = icons.getIcon(IconManager.COMMENT_ICON_64); if (icon == null) icon = UIManager.getIcon("OptionPane.questionIcon"); component = buildCommentPane(COMMENT_FIELD); } else { message = DEBUG_MESSAGE; component = buildExceptionPane(null); icon = icons.getIcon(IconManager.ERROR_ICON_64); if (icon == null) icon = UIManager.getIcon("OptionPane.errorIcon"); } Container c = getContentPane(); TitlePanel tp = new TitlePanel(getTitle(), message, icon); c.setLayout(new BorderLayout(0, 0)); c.add(tp, BorderLayout.NORTH); c.add(component, BorderLayout.CENTER); c.add(buildToolBar(toSubmit != null && toSubmit.size() > 0), BorderLayout.SOUTH); }
From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.util.RepositoryEntryCellRenderer.java
public RepositoryEntryCellRenderer() { this.leafIcon = (UIManager.getIcon("Tree.leafIcon")); this.closedIcon = (UIManager.getIcon("Tree.closedIcon")); putClientProperty("html.disable", Boolean.TRUE); // NON-NLS }
From source file:org.thelq.stackexchange.dbimport.gui.GUI.java
/** * Update the list of locations//from www .ja v a2 s .c om */ protected void updateLocations() { locationsBuilder.getPanel().removeAll(); for (final DumpContainer curContainer : controller.getDumpContainers()) { //Initialize components if (curContainer.getGuiHeader() == null) { String longLocation = Utils.getLongLocation(curContainer); JLabel headerLabel = new JLabel(longLocation); headerLabel.setToolTipText(longLocation); headerLabel.setIcon(UIManager.getIcon("Tree.collapsedIcon")); JPopupMenu popupMenu = new JPopupMenu(); JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { log.info("Removing " + curContainer.getType() + " " + curContainer.getLocation()); controller.getDumpContainers().remove(curContainer); updateLocations(); } }); popupMenu.add(deleteItem); headerLabel.setComponentPopupMenu(popupMenu); curContainer.setGuiHeader(headerLabel); //Handlers headerLabel.addMouseListener(new MouseAdapter() { boolean visible = true; @Override public void mouseClicked(MouseEvent e) { //Update labels visible = !visible; for (DumpEntry curEntry : curContainer.getEntries()) { curEntry.getGuiName().setVisible(visible); curEntry.getGuiSize().setVisible(visible); curEntry.getGuiLog().setVisible(visible); if (curEntry.getGuiSeparator() != null) curEntry.getGuiSeparator().setVisible(visible); } //Change icon if (visible) curContainer.getGuiHeader().setIcon(UIManager.getIcon("Tree.expandedIcon")); else curContainer.getGuiHeader().setIcon(UIManager.getIcon("Tree.collapsedIcon")); locationsPane.revalidate(); } }); } if (curContainer.getGuiTablePrefix() == null) { JTextField headerPrefix = new JTextField(6); curContainer.setGuiTablePrefix(headerPrefix); headerPrefix.setText(Utils.genTablePrefix(curContainer.getName())); if (StringUtils.isBlank(headerPrefix.getText())) log.warn("Unable to generate a table prefix for {}", curContainer.getLocation()); } //Start adding to panel locationsBuilder.leadingColumnOffset(0); locationsBuilder.append(curContainer.getGuiHeader(), 7); locationsBuilder.append(curContainer.getGuiTablePrefix()); locationsBuilder.nextLine(); locationsBuilder.leadingColumnOffset(2); Iterator<DumpEntry> entriesItr = curContainer.getEntries().iterator(); while (entriesItr.hasNext()) { DumpEntry curEntry = entriesItr.next(); if (curEntry.getGuiName() == null) curEntry.setGuiName(new JLabel(curEntry.getName())); locationsBuilder.append(curEntry.getGuiName()); if (curEntry.getGuiSize() == null) curEntry.setGuiSize(new JLabel(sizeInMegabytes(curEntry.getSizeBytes()))); locationsBuilder.append(curEntry.getGuiSize()); if (curEntry.getGuiLog() == null) curEntry.setGuiLog(new JLabel("Waiting...")); locationsBuilder.append(curEntry.getGuiLog(), 3); locationsBuilder.nextLine(); if (entriesItr.hasNext()) { if (curEntry.getGuiSeparator() == null) curEntry.setGuiSeparator(new JSeparator()); locationsBuilder.append(curEntry.getGuiSeparator(), 7); locationsBuilder.nextLine(); } } } locationsPane.validate(); }
From source file:org.wmediumd.WmediumdGraphView.java
public WmediumdGraphView() { JMenuBar menuBar;//ww w . jav a2s. c om JMenu menu; JMenuItem menuItem; setup(); setupVisualization(); setupMouse(); // Let's add a menu for changing mouse modes menuBar = new JMenuBar(); menu = new JMenu(); menu.setText("File"); menu.setIcon(null); menuItem = new JMenuItem("New file"); menuItem.setIcon(UIManager.getIcon("FileView.fileIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // TODO Use the Factory MyNode.nodeCount = 0; MyLink.linkCount = 0; graph.clear(); frame.repaint(); } }); menu.add(menuItem); menuItem = new JMenuItem("Load file"); menuItem.setIcon(UIManager.getIcon("FileChooser.upFolderIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { FileChooserLoad fl = new FileChooserLoad(); if (fl.getMatrixList().rates() == MyLink.rates) { MyNode.nodeCount = 0; MyLink.linkCount = 0; graph.clear(); graph.setDataFromMatrixList(fl.getMatrixList()); frame.repaint(); } } }); menu.add(menuItem); menuItem = new JMenuItem("Save as..."); menuItem.setIcon(UIManager.getIcon("FileView.floppyDriveIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (MyNode.nodeCount > 1) { System.out.println(generateConfigString()); new FileChooserSave(generateConfigString()); } } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem("Exit"); menuItem.setIcon(UIManager.getIcon("InternalFrame.closeIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.exit(0); } }); menu.add(menuItem); menuBar.add(menu); menu = graphMouse.getModeMenu(); // Obtain mode menu from the mouse menu.setText("Edit"); menu.setIcon(null); // I'm using this in a main menu menu.setPreferredSize(new Dimension(40, 15)); // Change the size menuBar.add(menu); menu = new JMenu("Help"); menuItem = new JMenuItem("Help"); menuItem.setIcon(UIManager.getIcon("FileChooser.detailsViewIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { openURL("http://o11s.org/trac/wiki/MeshTestingWmediumd#a4.1.Usingwconfig"); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem("About"); menuItem.setIcon(UIManager.getIcon("FileChooser.homeFolderIcon")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JOptionPane.showMessageDialog( frame, "Wireless medium daemon\n" + "configuration tool <v0.2b>\n\n" + "(C) 2011 - Javier Lopez\n" + "<jlopex@gmail.com>\n", "About", JOptionPane.INFORMATION_MESSAGE); } }); menu.add(menuItem); menuBar.add(menu); graphMouse.setMode(ModalGraphMouse.Mode.EDITING); // Start off in editing mode vViewer.setGraphMouse(graphMouse); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menuBar); frame.getContentPane().add(vViewer); frame.pack(); frame.setVisible(true); }