List of usage examples for javax.swing UIManager getIcon
public static Icon getIcon(Object key)
Icon
from the defaults. From source file:Main.java
public static void main(String[] args) { Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon"); Object[] possibilities = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; Integer i = (Integer) JOptionPane.showOptionDialog(null, null, "ShowInputDialog", JOptionPane.PLAIN_MESSAGE, 1, errorIcon, possibilities, 0); Integer ii = (Integer) JOptionPane.showInputDialog(null, "Select number:\n\from JComboBox", "ShowInputDialog", JOptionPane.PLAIN_MESSAGE, errorIcon, possibilities, "Numbers"); }
From source file:Main.java
public static void main(String[] args) { Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon"); Object[] possibilities = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; Integer i = (Integer) JOptionPane.showOptionDialog(null, null, "ShowInputDialog", JOptionPane.PLAIN_MESSAGE, 1, errorIcon, possibilities, 0); // or/*from www .ja va 2 s .c om*/ Integer ii = (Integer) JOptionPane.showInputDialog(null, "Select number:\n\from JComboBox", "ShowInputDialog", JOptionPane.PLAIN_MESSAGE, errorIcon, possibilities, "Numbers"); }
From source file:Main.java
public static void main(String[] args) { Vector<Double> doubleVector = new Vector<Double>(); Vector<Integer> integerVector = new Vector<Integer>(); Vector<Boolean> booleanVector = new Vector<Boolean>(); Vector<Icon> iconVector = new Vector<Icon>(); Icon icon1 = ((UIManager.getIcon("OptionPane.errorIcon"))); Icon icon2 = (UIManager.getIcon("OptionPane.informationIcon")); Icon icon3 = (UIManager.getIcon("OptionPane.warningIcon")); Icon icon4 = (UIManager.getIcon("OptionPane.questionIcon")); doubleVector.addElement(1.001);//from www. j a v a 2 s . co m doubleVector.addElement(10.00); doubleVector.addElement(0.95); doubleVector.addElement(4.2); JComboBox comboBoxDouble = new JComboBox(doubleVector); integerVector.addElement(1); integerVector.addElement(2); integerVector.addElement(3); integerVector.addElement(4); JComboBox comboBoxInteger = new JComboBox(integerVector); booleanVector.add(Boolean.TRUE); booleanVector.add(Boolean.FALSE); JComboBox comboBoxBoolean = new JComboBox(booleanVector); iconVector.addElement(icon1); iconVector.addElement(icon2); iconVector.addElement(icon3); iconVector.addElement(icon4); JComboBox comboBoxIcon = new JComboBox(iconVector); JFrame frame = new JFrame(); frame.setLayout(new GridLayout(2, 2, 5, 5)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(comboBoxDouble); frame.add(comboBoxInteger); frame.add(comboBoxBoolean); frame.add(comboBoxIcon); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); final JTree tree = new JTree(buildDemoModel()); tree.setCellRenderer(new DefaultTreeCellRenderer() { private Icon loadIcon = UIManager.getIcon("OptionPane.errorIcon"); private Icon saveIcon = UIManager.getIcon("OptionPane.informationIcon"); @Override//from w w w.j a v a 2 s. c om public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean isLeaf, int row, boolean focused) { Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, isLeaf, row, focused); if (selected) setIcon(loadIcon); else setIcon(saveIcon); return c; } }); tree.setVisibleRowCount(10); frame.add(new JScrollPane(tree)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:core.PlanC.java
/** * inicio de aplicacion/*w w w . ja v a 2s . c om*/ * * @param arg - argumentos de entrada */ public static void main(String[] args) { // user.name /* * Properties prp = System.getProperties(); System.out.println(getWmicValue("bios", "SerialNumber")); * System.out.println(getWmicValue("cpu", "SystemName")); */ try { // log // -Djava.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n' // System.setProperty("java.util.logging.SimpleFormatter.format", // "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n"); System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %5$s%6$s%n"); FileHandler fh = new FileHandler(LOG_FILE); fh.setFormatter(new SimpleFormatter()); fh.setLevel(Level.INFO); ConsoleHandler ch = new ConsoleHandler(); ch.setFormatter(new SimpleFormatter()); ch.setLevel(Level.INFO); logger = Logger.getLogger(""); Handler[] hs = logger.getHandlers(); for (int x = 0; x < hs.length; x++) { logger.removeHandler(hs[x]); } logger.addHandler(fh); logger.addHandler(ch); // point apache log to this log System.setProperty("org.apache.commons.logging.Log", Jdk14Logger.class.getName()); TPreferences.init(); TStringUtils.init(); Font fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("Dosis-Light.ttf")); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo); fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("Dosis-Medium.ttf")); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo); fo = Font.createFont(Font.TRUETYPE_FONT, TResourceUtils.getFile("AERO_ITALIC.ttf")); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(fo); SwingTimerTimingSource ts = new SwingTimerTimingSource(); AnimatorBuilder.setDefaultTimingSource(ts); ts.init(); // parse app argument parameters and append to tpreferences to futher uses for (String arg : args) { String[] kv = arg.split("="); TPreferences.setProperty(kv[0], kv[1]); } RUNNING_MODE = TPreferences.getProperty("runningMode", RM_NORMAL); newMsg = Applet.newAudioClip(TResourceUtils.getURL("newMsg.wav")); } catch (Exception e) { SystemLog.logException1(e, true); } // pass icon from metal to web look and feel Icon i1 = UIManager.getIcon("OptionPane.errorIcon"); Icon i2 = UIManager.getIcon("OptionPane.informationIcon"); Icon i3 = UIManager.getIcon("OptionPane.questionIcon"); Icon i4 = UIManager.getIcon("OptionPane.warningIcon"); // Object fcui = UIManager.get("FileChooserUI"); // JFileChooser fc = new JFileChooser(); WebLookAndFeel.install(); // WebLookAndFeel.setDecorateFrames(true); // WebLookAndFeel.setDecorateDialogs(true); UIManager.put("OptionPane.errorIcon", i1); UIManager.put("OptionPane.informationIcon", i2); UIManager.put("OptionPane.questionIcon", i3); UIManager.put("OptionPane.warningIcon", i4); // UIManager.put("TFileChooserUI", fcui); // warm up the IDW. // in my computer, some weird error ocurr if i don't execute this preload. new RootWindow(null); frame = new TWebFrame(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Exit.shutdown(); } }); if (RUNNING_MODE.equals(RM_NORMAL)) { initEnviorement(); } if (RUNNING_MODE.equals(RM_CONSOLE)) { initConsoleEnviorement(); } if (RUNNING_MODE.equals(ONE_TASK)) { String cln = TPreferences.getProperty("taskName", "*TaskNotFound"); PlanC.logger.log(Level.INFO, "OneTask parameter found in .properties. file Task name = " + cln); try { Class cls = Class.forName(cln); Object dobj = cls.newInstance(); // new class must be extends form AbstractExternalTask TTaskManager.executeTask((Runnable) dobj); return; } catch (Exception e) { PlanC.logger.log(Level.SEVERE, e.getMessage(), e); Exit.shutdown(); } } }
From source file:Main.java
public static Icon getIconForType(int iconType) { switch (iconType) { case 0://w w w. ja v a2s .c o m return UIManager.getIcon("OptionPane.errorIcon"); case 1: return UIManager.getIcon("OptionPane.informationIcon"); case 2: return UIManager.getIcon("OptionPane.warningIcon"); case 3: return UIManager.getIcon("OptionPane.questionIcon"); } return null; }
From source file:Main.java
public static void disableNewFolderButton(Container c) { int len = c.getComponentCount(); for (int i = 0; i < len; i++) { Component comp = c.getComponent(i); if (comp instanceof JButton) { JButton b = (JButton) comp; Icon icon = b.getIcon(); if (icon != null && icon == UIManager.getIcon("FileChooser.newFolderIcon")) b.setEnabled(false);//from ww w .j a v a 2s. c o m } else if (comp instanceof Container) { disableNewFolderButton((Container) comp); } } }
From source file:Main.java
public Main() { Icon icon = UIManager.getIcon("html.pendingImage"); JTabbedPane jtb = new JTabbedPane(); JPanel jplInnerPanel1 = createInnerPanel("Tab 1: Tooltip and Icon"); jtb.addTab("One", icon, jplInnerPanel1, "Tab 1"); jtb.setSelectedIndex(0);/* w w w.j ava2 s .c o m*/ JPanel jplInnerPanel2 = createInnerPanel("Tab 2: Icon only"); jtb.addTab("Two", icon, jplInnerPanel2); JPanel jplInnerPanel3 = createInnerPanel("Tab 3: Tooltip and Icon"); jtb.addTab("Three", icon, jplInnerPanel3, "Tab 3"); JPanel jplInnerPanel4 = createInnerPanel("Tab 4: Text only"); jtb.addTab("Four", jplInnerPanel4); menu.add(new JMenuItem("Item 1")); menu.add(new JMenuItem("Item 2")); JLabel tab4Label = new JLabel(); tab4Label.setText("Four"); jtb.setTabComponentAt(3, tab4Label); tab4Label.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { jtb.getModel().setSelectedIndex(3); if (e.isPopupTrigger()) { menu.show(e.getComponent(), e.getX(), e.getY()); } } }); setLayout(new GridLayout()); add(jtb); }
From source file:com.mirth.connect.client.ui.ExportChannelLibrariesDialog.java
private void initComponents(Channel channel) { label1 = new JLabel(" The following code template libraries are linked to this channel:"); label1.setIcon(UIManager.getIcon("OptionPane.questionIcon")); librariesTextPane = new JTextPane(); librariesTextPane.setContentType("text/html"); HTMLEditorKit editorKit = new HTMLEditorKit(); StyleSheet styleSheet = editorKit.getStyleSheet(); styleSheet.addRule(".export-channel-libraries-dialog {font-family:\"Tahoma\";font-size:11;text-align:top}"); librariesTextPane.setEditorKit(editorKit); librariesTextPane.setEditable(false); librariesTextPane.setBackground(getBackground()); librariesTextPane.setBorder(null);/*from w w w. j a va 2s. co m*/ StringBuilder librariesText = new StringBuilder("<html><ul class=\"export-channel-libraries-dialog\">"); for (CodeTemplateLibrary library : PlatformUI.MIRTH_FRAME.codeTemplatePanel.getCachedCodeTemplateLibraries() .values()) { if (library.getEnabledChannelIds().contains(channel.getId()) || (library.isIncludeNewChannels() && !library.getDisabledChannelIds().contains(channel.getId()))) { librariesText.append("<li>").append(StringEscapeUtils.escapeHtml4(library.getName())) .append("</li>"); } } librariesText.append("</ul></html>"); librariesTextPane.setText(librariesText.toString()); librariesTextPane.setCaretPosition(0); librariesScrollPane = new JScrollPane(librariesTextPane); label2 = new JLabel("Do you wish to include these libraries in the channel export?"); alwaysChooseCheckBox = new JCheckBox( "Always choose this option by default in the future (may be changed in the Administrator settings)"); yesButton = new JButton("Yes"); yesButton.setMnemonic('Y'); yesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { result = JOptionPane.YES_OPTION; if (alwaysChooseCheckBox.isSelected()) { Preferences.userNodeForPackage(Mirth.class).putBoolean("exportChannelCodeTemplateLibraries", true); } dispose(); } }); noButton = new JButton("No"); noButton.setMnemonic('N'); noButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { result = JOptionPane.NO_OPTION; if (alwaysChooseCheckBox.isSelected()) { Preferences.userNodeForPackage(Mirth.class).putBoolean("exportChannelCodeTemplateLibraries", false); } dispose(); } }); cancelButton = new JButton("Cancel"); cancelButton.setMnemonic('C'); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { result = JOptionPane.CANCEL_OPTION; dispose(); } }); }
From source file:Main.java
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (value instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (node.getUserObject() instanceof String) { setIcon(UIManager.getIcon("FileView.computerIcon")); } else if (node.getUserObject() instanceof Contact) { Contact contact = (Contact) node.getUserObject(); if (contact.isSomeProperty()) { setIcon(UIManager.getIcon("FileView.hardDriveIcon")); } else { setIcon(UIManager.getIcon("FileChooser.homeFolderIcon")); }/*w w w . j av a 2 s . co m*/ } } return this; }