List of usage examples for javax.swing UIManager getIcon
public static Icon getIcon(Object key)
Icon
from the defaults. From source file:com.igormaznitsa.sciareto.ui.tree.TreeCellRenderer.java
private void ensureIcons(@Nonnull final JTree tree) { if (PROJECT_CLOSED == null) { PROJECT_CLOSED = new ImageIcon(UiUtils.makeBadgedRightBottom( UiUtils.iconToImage(tree, UIManager.getIcon("Tree.closedIcon")), PROJECT_BADGE)); PROJECT_CLOSED_RO = new ImageIcon( UiUtils.makeBadgedRightTop(((ImageIcon) PROJECT_CLOSED).getImage(), READONLY_BADGE)); }/*w w w. j a v a 2 s . c om*/ if (PROJECT_OPENED == null) { PROJECT_OPENED = new ImageIcon(UiUtils.makeBadgedRightBottom( UiUtils.iconToImage(tree, UIManager.getIcon("Tree.openIcon")), PROJECT_BADGE)); PROJECT_OPENED_RO = new ImageIcon( UiUtils.makeBadgedRightTop(((ImageIcon) PROJECT_OPENED).getImage(), READONLY_BADGE)); } if (FOLDER_CLOSED == null) { FOLDER_CLOSED = new ImageIcon(UiUtils.iconToImage(tree, UIManager.getIcon("Tree.closedIcon"))); FOLDER_CLOSED_RO = new ImageIcon( UiUtils.makeBadgedRightTop(((ImageIcon) FOLDER_CLOSED).getImage(), READONLY_BADGE)); } if (FOLDER_OPENED == null) { FOLDER_OPENED = new ImageIcon(UiUtils.iconToImage(tree, UIManager.getIcon("Tree.openIcon"))); FOLDER_OPENED_RO = new ImageIcon( UiUtils.makeBadgedRightTop(((ImageIcon) FOLDER_OPENED).getImage(), READONLY_BADGE)); } if (LEAF == null) { LEAF = new ImageIcon(UiUtils.iconToImage(tree, UIManager.getIcon("Tree.leafIcon"))); LEAF_RO = new ImageIcon( UiUtils.makeBadgedRightTop(((ImageIcon) PROJECT_OPENED).getImage(), READONLY_BADGE)); } if (LEAF_MINDMAP == null) { LEAF_MINDMAP = Icons.DOCUMENT.getIcon(); LEAF_MINDMAP_RO = new ImageIcon( UiUtils.makeBadgedRightTop(Icons.DOCUMENT.getIcon().getImage(), READONLY_BADGE)); } }
From source file:com.igormaznitsa.sciareto.ui.tabs.TabTitle.java
public TabTitle(@Nonnull final Context context, @Nonnull final TabProvider parent, @Nullable final File associatedFile) { super(new GridBagLayout()); this.parent = parent; this.context = context; this.associatedFile = associatedFile; this.changed = this.associatedFile == null; this.setOpaque(false); final GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1000.0d;/*w ww .j a v a 2 s.co m*/ final TabTitle theInstance = this; this.titleLabel = new JLabel() { private static final long serialVersionUID = 8689945842487138781L; @Override protected void processKeyEvent(@Nonnull final KeyEvent e) { theInstance.getParent().dispatchEvent(e); } @Override public String getToolTipText() { return theInstance.getToolTipText(); } @Override public boolean isFocusable() { return false; } }; this.add(this.titleLabel, constraints); final Icon uiCloseIcon = UIManager.getIcon("InternalFrameTitlePane.closeIcon"); this.closeButton = new JButton(uiCloseIcon == null ? NIMBUS_CLOSE_ICON : uiCloseIcon) { private static final long serialVersionUID = -8005282815756047979L; @Override public String getToolTipText() { return theInstance.getToolTipText(); } @Override public boolean isFocusable() { return false; } }; this.closeButton.setToolTipText("Close tab"); this.closeButton.setBorder(null); this.closeButton.setContentAreaFilled(false); this.closeButton.setMargin(new Insets(0, 0, 0, 0)); this.closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.closeButton.setOpaque(false); this.closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { doSafeClose(); } }); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 0.0d; constraints.insets = new Insets(2, 8, 2, 0); this.add(this.closeButton, constraints); updateView(); ToolTipManager.sharedInstance().registerComponent(closeButton); ToolTipManager.sharedInstance().registerComponent(this.titleLabel); ToolTipManager.sharedInstance().registerComponent(this); }
From source file:com.limegroup.gnutella.gui.themes.setters.SubstanceThemeSetter.java
public void apply() { SubstanceLookAndFeel.setSkin(_skinClassName); ThemeMediator.applyCommonSkinUI();/*from w w w . ja va 2 s .c om*/ float scaledFontPolicyFactor = WINDOWS_SCALED_FONT_POLICY_FACTOR; if (OSUtils.isMacOSX()) { scaledFontPolicyFactor = MAC_SCALED_FONT_POLICY_FACTOR; } else if (OSUtils.isLinux()) { scaledFontPolicyFactor = LINUX_SCALED_FONT_POLICY_FACTOR; } if (LookUtils.IS_OS_WINDOWS) { fixWindowsOSFont(); } else if (LookUtils.IS_OS_LINUX) { fixLinuxOSFont(); } SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(scaledFontPolicyFactor)); //reduceFont("Label.font"); //reduceFont("Table.font"); //ResourceManager.setFontSizes(-1); //ResourceManager.setFontSizes(0); UIManager.put("Tree.leafIcon", UIManager.getIcon("Tree.closedIcon")); // remove split pane borders UIManager.put("SplitPane.border", BorderFactory.createEmptyBorder()); if (!OSUtils.isMacOSX()) { UIManager.put("Table.focusRowHighlightBorder", UIManager.get("Table.focusCellHighlightBorder")); } UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1)); // Add a bold text version of simple text. Font normal = UIManager.getFont("Table.font"); FontUIResource bold = new FontUIResource(normal.getName(), Font.BOLD, normal.getSize()); UIManager.put("Table.font.bold", bold); UIManager.put("Tree.rowHeight", 0); }
From source file:au.org.ala.delta.intkey.ui.MultiStateInputDialog.java
/** * ctor/* ww w . ja v a 2s. c o m*/ * * @param owner * Owner frame of dialog * @param ch * the character whose states are being set * @param initialSelectedStates * initial states that should be selected in the dialog. In * general this should be any states already set for the * character. In the case that this is a controlling character * being set before its dependent character, all states that make * the dependent character applicable should be selected. * @param dependentCharacter * the dependent character - if the dialog is being used to set a * controlling character before its dependent character, this * argument should be a reference to the dependent character. In * all other cases it should be null. * @param imageSettings * image settings * @param displayNumbering * true if numbering should be displayed * @param enableImagesButton * the if the images button should be enabled * @param imagesStartScaled * true if images should start scaled. */ public MultiStateInputDialog(Frame owner, MultiStateCharacter ch, Set<Integer> initialSelectedStates, au.org.ala.delta.model.Character dependentCharacter, ImageSettings imageSettings, boolean displayNumbering, boolean enableImagesButton, boolean imagesStartScaled, boolean advancedMode) { super(owner, ch, imageSettings, displayNumbering, enableImagesButton, imagesStartScaled, advancedMode); ResourceMap resourceMap = Application.getInstance().getContext() .getResourceMap(MultiStateInputDialog.class); resourceMap.injectFields(this); setTitle(title); setPreferredSize(new Dimension(600, 350)); if (dependentCharacter != null) { _pnlControllingCharacterMessage = new JPanel(); _pnlControllingCharacterMessage.setFocusable(false); _pnlControllingCharacterMessage.setBorder(new EmptyBorder(5, 0, 0, 0)); _pnlMain.add(_pnlControllingCharacterMessage, BorderLayout.SOUTH); _pnlControllingCharacterMessage.setLayout(new BorderLayout(0, 0)); _lblWarningIcon = new JLabel(""); _lblWarningIcon.setFocusable(false); _lblWarningIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon")); _pnlControllingCharacterMessage.add(_lblWarningIcon, BorderLayout.WEST); _txtControllingCharacterMessage = new JTextArea(); _txtControllingCharacterMessage.setText(MessageFormat.format(setControllingCharacterMessage, _formatter.formatCharacterDescription(dependentCharacter), _formatter.formatCharacterDescription(ch))); _txtControllingCharacterMessage.setFocusable(false); _txtControllingCharacterMessage.setBorder(new EmptyBorder(0, 5, 0, 0)); _txtControllingCharacterMessage.setEditable(false); _pnlControllingCharacterMessage.add(_txtControllingCharacterMessage); _txtControllingCharacterMessage.setWrapStyleWord(true); _txtControllingCharacterMessage.setFont(UIManager.getFont("Button.font")); _txtControllingCharacterMessage.setLineWrap(true); _txtControllingCharacterMessage.setBackground(SystemColor.control); } _scrollPane = new JScrollPane(); _pnlMain.add(_scrollPane, BorderLayout.CENTER); _list = new JList(); _scrollPane.setViewportView(_list); _listModel = new DefaultListModel(); for (int i = 0; i < ch.getNumberOfStates(); i++) { _listModel.addElement(_formatter.formatState(ch, i + 1)); } _list.setModel(_listModel); _list.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { // Treat double click on a list item as the ok button being // pressed. _okPressed = true; handleBtnOKClicked(); } } }); // Select the list items that correspond to the initial selected states. if (initialSelectedStates != null) { List<Integer> listIndiciesToSelect = new ArrayList<Integer>(); for (int stateNumber : new ArrayList<Integer>(initialSelectedStates)) { listIndiciesToSelect.add(stateNumber - 1); } Integer[] wrappedPrimitivesList = listIndiciesToSelect .toArray(new Integer[initialSelectedStates.size()]); _list.setSelectedIndices(ArrayUtils.toPrimitive(wrappedPrimitivesList)); } _inputData = new HashSet<Integer>(); }
From source file:ca.canucksoftware.ipkpackager.IpkPackagerView.java
private 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") || icon == UIManager.getIcon("FileChooser.upFolderIcon"))) b.setEnabled(false);// w w w. ja va 2s .com } else if (comp instanceof Container) { disableNewFolderButton((Container) comp); } } }
From source file:com.googlecode.vfsjfilechooser2.filechooser.AbstractVFSFileSystemView.java
/** * Icon for a file, directory, or folder as it would be displayed in * a system file browser. Example from Windows: the "M:\" directory * displays a CD-ROM icon.// w w w .j av a2 s . com * * The default implementation gets information from the ShellFolder class. * * @param f a <code>File</code> object * @return an icon as it would be displayed by a native file chooser * @see JFileChooser#getIcon * @since 1.4 */ public Icon getSystemIcon(FileObject f) { if (f != null) { return UIManager.getIcon(VFSUtils.isDirectory(f) ? "FileView.directoryIcon" : "FileView.fileIcon"); } else { return null; } }
From source file:com.limegroup.gnutella.gui.notify.AnimatedWindow.java
public static void main(String[] args) { JPanel content = new JPanel(new BorderLayout()); content.setBorder(BorderFactory.createLineBorder(Color.black, 2)); JLabel label = new JLabel("Hello World"); label.setIcon(UIManager.getIcon("FileView.computerIcon")); label.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); content.add(label, BorderLayout.CENTER); final AnimatedWindow window = new AnimatedWindow(null); window.setFinalLocation(new Point(200, 200)); window.setContentPane(content);//from ww w .ja v a 2 s .c o m JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 10)); JButton button = new JButton("Bottom -> Top"); buttonPanel.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { window.setMode(AnimationMode.BOTTOM_TO_TOP); if (!window.isVisible() || window.isHideAnimationInProgress()) { window.doShow(); } else { window.doHide(); } } }); button = new JButton("Top -> Bottom"); buttonPanel.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { window.setMode(AnimationMode.TOP_TO_BOTTOM); if (!window.isVisible() || window.isHideAnimationInProgress()) { window.doShow(); } else { window.doHide(); } } }); button = new JButton("Fade"); buttonPanel.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { window.setMode(AnimationMode.FADE); if (!window.isVisible() || window.isHideAnimationInProgress()) { window.doShow(); } else { window.doHide(); } } }); JFrame app = new JFrame("AnimatedWindow Demo"); app.setContentPane(buttonPanel); app.pack(); app.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); app.setVisible(true); }
From source file:i18nplugin.TranslatorEditor.java
private void updateState() { String original = mOriginal.getText(); String translated = mTranslation.getText(); String text = ""; int state = mPropertiesEntryNode.getTranslationState(original, translated); if (state == LanguageNodeIf.STATE_MISSING_TRANSLATION) { text = mLocalizer.msg("state.missingTranslation", "Missing translation"); } else if (state == LanguageNodeIf.STATE_NON_WELLFORMED_ARG_COUNT) { text = mLocalizer.msg("state.wrongArgCount", "Wrong number of arguments"); } else if (state == LanguageNodeIf.STATE_NON_WELLFORMED_ARG_FORMAT) { text = mLocalizer.msg("state.differentArguments", "Different message arguments"); } else if (state == LanguageNodeIf.STATE_NON_WELLFORMED_PUNCTUATION_END) { text = mLocalizer.msg("state.wrongPunctuation", "Different punctuation at the end"); } else if (state == LanguageNodeIf.STATE_OK) { text = mLocalizer.msg("state.ok", "OK"); }/*from w ww. j a v a 2s .c o m*/ mState.setText(text); mIcon.setVisible(state != LanguageNodeIf.STATE_OK); if (state != LanguageNodeIf.STATE_OK) { if (state == LanguageNodeIf.STATE_MISSING_TRANSLATION) { mIcon.setIcon(UiUtilities.scaleIcon(UIManager.getIcon("OptionPane.errorIcon"), 16)); } else { mIcon.setIcon(UiUtilities.scaleIcon(UIManager.getIcon("OptionPane.warningIcon"), 16)); } } }
From source file:de.codesourcery.eve.skills.ui.utils.PersistentDialogManager.java
protected static Icon getWarningIcon() { return UIManager.getIcon("OptionPane.warningIcon"); }
From source file:com.sshtools.sshvnc.SshVncSessionPanel.java
/** * * * @param application// w w w.j a v a2 s . c o m * * @throws SshToolsApplicationException */ public void init(SshToolsApplication application) throws SshToolsApplicationException { super.init(application); setLayout(new BorderLayout()); sendTimer = new javax.swing.Timer(500, this); sendTimer.setRepeats(false); receiveTimer = new javax.swing.Timer(500, this); receiveTimer.setRepeats(false); statusBar = new StatusBar(); statusBar.setUser(""); statusBar.setHost(""); statusBar.setStatusText("Disconnected"); statusBar.setConnected(false); setLayout(new BorderLayout()); // Create our terminal emulation object try { emulation = createEmulation(); } catch (IOException ioe) { throw new SshToolsApplicationException(ioe); } // Set a scrollbar for the terminal - doesn't seem to be as simple as this emulation.setBufferSize(1000); // Create our swing terminal and add it to the main frame terminal = new TerminalPanel(emulation); terminal.requestFocus(); // try { vnc = new SshVNCViewer(); // Additional connection tabs additionalTabs = new SshToolsConnectionTab[] { new VNCTab(), new VNCAdvancedTab() }; add(vnc, BorderLayout.CENTER); initActions(); } catch (Throwable t) { StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); IconWrapperPanel p = new IconWrapperPanel(UIManager.getIcon("OptionPane.errorIcon"), new ErrorTextBox(((t.getMessage() == null) ? "<no message supplied>" : t.getMessage()) + (debug ? ("\n\n" + sw.getBuffer().toString()) : ""))); p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); add(p, BorderLayout.CENTER); throw new SshToolsApplicationException("Failed to start SshVNC. ", t); } }