本文整理汇总了Java中javax.swing.plaf.metal.MetalIconFactory类的典型用法代码示例。如果您正苦于以下问题:Java MetalIconFactory类的具体用法?Java MetalIconFactory怎么用?Java MetalIconFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetalIconFactory类属于javax.swing.plaf.metal包,在下文中一共展示了MetalIconFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCustomEntriesToTable
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
@Override
public void addCustomEntriesToTable(UIDefaults table) {
super.addCustomEntriesToTable(table);
final int internalFrameIconSize = 22;
table.put("InternalFrame.closeIcon", MetalIconFactory.
getInternalFrameCloseIcon(internalFrameIconSize));
table.put("InternalFrame.maximizeIcon", MetalIconFactory.
getInternalFrameMaximizeIcon(internalFrameIconSize));
table.put("InternalFrame.iconifyIcon", MetalIconFactory.
getInternalFrameMinimizeIcon(internalFrameIconSize));
table.put("InternalFrame.minimizeIcon", MetalIconFactory.
getInternalFrameAltMaximizeIcon(internalFrameIconSize));
table.put("ScrollBar.width", 21);
}
示例2: customizeButton
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public JButton customizeButton() {
final CustomJButton open = new CustomJButton("+", MetalIconFactory.getTreeLeafIcon());
open.setHorizontalTextPosition(JButton.CENTER);
open.setForeground(Color.lightGray);
open.setToolTipText(Messages.getString("RendererPanel.5"));
open.setFocusPainted(false);
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
DeviceConfiguration d = (DeviceConfiguration) renderer;
File f = chooseConf(d.getDeviceDir(), d.getDefaultFilename(d));
if (f != null) {
File file = DeviceConfiguration.createDeviceFile(d, f.getName(), true);
buildEditBar(true);
try {
java.awt.Desktop.getDesktop().open(file);
} catch (IOException ioe) {
LOGGER.debug("Failed to open default desktop application: " + ioe);
}
}
}
});
return open;
}
示例3: referenceButton
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public JButton referenceButton() {
final File ref = ((DeviceConfiguration) renderer).getConfiguration(DeviceConfiguration.RENDERER).getFile();
final CustomJButton open = new CustomJButton(MetalIconFactory.getTreeLeafIcon());
boolean exists = ref != null && ref.exists();
open.setToolTipText(exists ? (Messages.getString("RendererPanel.3") + ": " + ref) : Messages.getString("RendererPanel.4"));
open.setFocusPainted(false);
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
try {
java.awt.Desktop.getDesktop().open(ref);
} catch (IOException ioe) {
LOGGER.debug("Failed to open default desktop application: " + ioe);
}
}
});
if (!exists) {
open.setText("!");
open.setHorizontalTextPosition(JButton.CENTER);
open.setForeground(Color.lightGray);
open.setEnabled(false);
}
return open;
}
示例4: testReplaceSelection_AtTheBeginningOfParagraph
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public void testReplaceSelection_AtTheBeginningOfParagraph() {
StyledDocument doc = textPane.getStyledDocument();
try {
attrs = new SimpleAttributeSet();
StyleConstants.setUnderline(attrs, true);
doc.insertString(0, "Hello word!", attrs);
textPane.setCaretPosition(4);
textPane.insertIcon(MetalIconFactory.getTreeFolderIcon());
textPane.setCaretPosition(4);
textPane.replaceSelection("\n");
textPane.setCaretPosition(5);
textPane.replaceSelection("a");
textPane.setCaretPosition(6);
textPane.replaceSelection("b");
assertNull(StyleConstants.getIcon(doc.getCharacterElement(5).getAttributes()));
assertNull(StyleConstants.getIcon(doc.getCharacterElement(6).getAttributes()));
} catch (BadLocationException e) {
}
}
示例5: restored
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
@Override
public void restored() {
if (detectOldJava()) {
final String title = NbBundle.getMessage(Installer.class, "wlc-nbeditorconfig-version-error-title");
final String message = NbBundle.getMessage(Installer.class, "wlc-nbeditorconfig-version-error-message");
final int messageType = NotifyDescriptor.ERROR_MESSAGE;
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, messageType));
}
};
NotificationDisplayer.getDefault().notify(title, new MetalIconFactory.FileIcon16(), message, actionListener);
}
}
示例6: dragGestureRecognized
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public void dragGestureRecognized(DragGestureEvent e) {
Object o = view.locationToObject(e.getComponent(), e.getDragOrigin());
if(o != null) {
if(e.getDragSource().isDragImageSupported()) {
if(FILE == null) {
FILE = Swing.iconToImage(MetalIconFactory.getTreeLeafIcon());
FOLDER = Swing.iconToImage(MetalIconFactory.getTreeFolderIcon());
}
BufferedImage image = model.isLeaf(o) ? FILE : FOLDER;
e.startDrag(DragSource.DefaultMoveDrop,
image,
new Point(image.getWidth() / 2, image.getHeight() / 2),
new StringSelection(o.toString()),
this);
} else
e.startDrag(DragSource.DefaultMoveDrop, // cursor
new StringSelection(o.toString()), // transferable
this); // drag source listener
}
}
示例7: refreshTree
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
private void refreshTree() {
tree = new JTree(simDir);
if (!topLevel /*&& learnSpecs == null*/) {
tree.addMouseListener(this);
}
tree.putClientProperty("JTree.icons", makeIcons());
tree.setCellRenderer(new IconNodeRenderer());
DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer();
renderer.setLeafIcon(MetalIconFactory.getTreeLeafIcon());
renderer.setClosedIcon(MetalIconFactory.getTreeFolderIcon());
renderer.setOpenIcon(MetalIconFactory.getTreeFolderIcon());
}
示例8: makeIcons
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
private static Hashtable<String, Icon> makeIcons() {
Hashtable<String, Icon> icons = new Hashtable<String, Icon>();
icons.put("floppyDrive", MetalIconFactory.getTreeFloppyDriveIcon());
icons.put("hardDrive", MetalIconFactory.getTreeHardDriveIcon());
icons.put("computer", MetalIconFactory.getTreeComputerIcon());
icons.put("c", TextIcons.getIcon("c"));
icons.put("java", TextIcons.getIcon("java"));
icons.put("html", TextIcons.getIcon("html"));
return icons;
}
示例9: createPanel6
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
/**
* This panel contains combo boxes with a custom renderer.
*
* @return A panel.
*/
private JPanel createPanel6()
{
JPanel panel = new JPanel(new BorderLayout());
this.comboState6 = new JCheckBox("Enabled", true);
this.comboState6.setActionCommand("COMBO_STATE6");
this.comboState6.addActionListener(this);
panel.add(this.comboState6, BorderLayout.EAST);
JPanel controlPanel = new JPanel();
controlPanel.setBorder(BorderFactory.createTitledBorder("Custom Renderer: "));
this.combo11 = new JComboBox(new Object[] {
MetalIconFactory.getFileChooserHomeFolderIcon(),
MetalIconFactory.getFileChooserNewFolderIcon()});
this.combo11.setPreferredSize(new Dimension(100, 30));
this.combo11.setRenderer(new CustomCellRenderer());
this.combo12 = new JComboBox(new Object[] {
MetalIconFactory.getFileChooserHomeFolderIcon(),
MetalIconFactory.getFileChooserNewFolderIcon()});
this.combo12.setPreferredSize(new Dimension(100, 30));
this.combo12.setRenderer(new CustomCellRenderer());
this.combo12.setEditable(true);
controlPanel.add(combo11);
controlPanel.add(combo12);
panel.add(controlPanel);
return panel;
}
示例10: createButtonPanel
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
private JPanel createButtonPanel()
{
JPanel panel = new JPanel(new BorderLayout());
this.buttonState = new JCheckBox("Enabled", true);
this.buttonState.setActionCommand("BUTTON_STATE");
this.buttonState.addActionListener(this);
panel.add(this.buttonState, BorderLayout.EAST);
JPanel buttonPanel = new JPanel();
buttonPanel.setBorder(BorderFactory.createTitledBorder("JButton"));
this.button1 = new JButton("Button 1");
this.button2 = new JButton("Button 2");
this.button2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
this.button3 = new JButton("Button 3");
this.button3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
this.button3.setHorizontalTextPosition(SwingConstants.CENTER);
this.button3.setVerticalTextPosition(SwingConstants.BOTTOM);
this.button4 = new JButton("Button 4");
this.button4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
this.button4.setText(null);
buttonPanel.add(button1);
buttonPanel.add(button2);
buttonPanel.add(button3);
buttonPanel.add(button4);
panel.add(buttonPanel);
return panel;
}
示例11: installIcons
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
/**
* Installs the icons for this UI delegate.
*
* @param fc the file chooser (ignored).
*/
protected void installIcons(JFileChooser fc)
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
computerIcon = MetalIconFactory.getTreeComputerIcon();
detailsViewIcon = defaults.getIcon("FileChooser.detailsViewIcon");
directoryIcon = new MetalIconFactory.TreeFolderIcon();
fileIcon = new MetalIconFactory.TreeLeafIcon();
floppyDriveIcon = MetalIconFactory.getTreeFloppyDriveIcon();
hardDriveIcon = MetalIconFactory.getTreeHardDriveIcon();
homeFolderIcon = defaults.getIcon("FileChooser.homeFolderIcon");
listViewIcon = defaults.getIcon("FileChooser.listViewIcon");
newFolderIcon = defaults.getIcon("FileChooser.newFolderIcon");
upFolderIcon = defaults.getIcon("FileChooser.upFolderIcon");
}
示例12: createPanel6
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
/**
* This panel contains combo boxes with a custom renderer.
*
* @return A panel.
*/
private JPanel createPanel6()
{
JPanel panel = new JPanel(new BorderLayout());
this.comboState6 = new JCheckBox("Enabled", true);
this.comboState6.setActionCommand("COMBO_STATE6");
this.comboState6.addActionListener(this);
panel.add(this.comboState6, BorderLayout.EAST);
JPanel controlPanel = new JPanel();
controlPanel.setBorder(BorderFactory.createTitledBorder("Custom Renderer: "));
this.combo11 = new JComboBox(new Object[] {
MetalIconFactory.getFileChooserHomeFolderIcon(),
MetalIconFactory.getFileChooserNewFolderIcon()});
this.combo11.setPreferredSize(new Dimension(100, 30));
this.combo11.setRenderer(new CustomCellRenderer());
this.combo12 = new JComboBox(new Object[] {
MetalIconFactory.getFileChooserHomeFolderIcon(),
MetalIconFactory.getFileChooserNewFolderIcon()});
this.combo12.setPreferredSize(new Dimension(100, 30));
this.combo12.setRenderer(new CustomCellRenderer());
this.combo12.setEditable(true);
controlPanel.add(combo11);
controlPanel.add(combo12);
panel.add(controlPanel);
return panel;
}
示例13: createButtonPanel
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
private JPanel createButtonPanel()
{
JPanel panel = new JPanel(new BorderLayout());
this.buttonState = new JCheckBox("Enabled", true);
this.buttonState.setActionCommand("BUTTON_STATE");
this.buttonState.addActionListener(this);
panel.add(this.buttonState, BorderLayout.EAST);
JPanel buttonPanel = new JPanel();
buttonPanel.setBorder(BorderFactory.createTitledBorder("JButton"));
this.button1 = new JButton("Button 1");
this.button2 = new JButton("Button 2");
this.button2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
this.button3 = new JButton("Button 3");
this.button3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
this.button3.setHorizontalTextPosition(SwingConstants.CENTER);
this.button3.setVerticalTextPosition(SwingConstants.BOTTOM);
this.button4 = new JButton("Button 4");
this.button4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
this.button4.setText(null);
buttonPanel.add(button1);
buttonPanel.add(button2);
buttonPanel.add(button3);
buttonPanel.add(button4);
panel.add(buttonPanel);
return panel;
}
示例14: testReplaceSelection_WithSelection
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public void testReplaceSelection_WithSelection() {
textPane.setCaretPosition(4);
textPane.insertIcon(MetalIconFactory.getTreeFolderIcon());
textPane.select(4, 6);
textPane.replaceSelection("TEXT");
assertNull(StyleConstants.getIcon(textPane.getStyledDocument().getCharacterElement(4)
.getAttributes()));
}
示例15: testInputAttributes
import javax.swing.plaf.metal.MetalIconFactory; //导入依赖的package包/类
public void testInputAttributes() {
JEditorPane pane = new JEditorPane() {
private static final long serialVersionUID = 1L;
@Override
protected EditorKit createDefaultEditorKit() {
return new StyledEditorKit();
}
};
pane.setEditorKit(new StyledEditorKit());
StyledDocument doc = (StyledDocument) pane.getDocument();
StyledEditorKit kit = (StyledEditorKit) pane.getEditorKit();
try {
MutableAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setUnderline(attrs, true);
doc.insertString(0, "Hello word!", attrs);
pane.setCaretPosition(4);
attrs = new SimpleAttributeSet();
StyleConstants.setIcon(attrs, MetalIconFactory.getTreeFolderIcon());
doc.insertString(4, " ", attrs);
pane.setCaretPosition(4);
doc.insertString(4, "\n", kit.getInputAttributes());
assertFalse(StyleConstants.isUnderline(kit.getInputAttributes()));
pane.setCaretPosition(5);
assertFalse(StyleConstants.isUnderline(kit.getInputAttributes()));
} catch (BadLocationException e) {
}
}